Group text sections with prefixes .text.unlikely,.text.hot and .text.startup
[external/binutils.git] / gold / ChangeLog
1 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2
3         * layout.cc (Layout::is_section_name_prefix_grouped): New function.     
4         * layout.h (Layout::is_section_name_prefix_grouped): New function.
5         * output.cc (Output_section::add_input_section): Check if section
6         name contains special prefix.  Keep input sections to sort such
7         sections.
8         (Output_section::Input_section_sort_section_order_index_compare
9          ::operator()): Group sections according to prefixes.
10         * (Output_section::sort_attached_input_sections): Add condition
11         to Input_section_entry constructor call.
12         * testsuite/Makefile.am (text_section_grouping): New test.
13         * testsuite/Makefile.in: Regenerate.
14         * testsuite/text_section_grouping.cc: New file.
15         * testsuite/text_section_grouping.sh: New file.
16
17 2012-12-17  Nick Clifton  <nickc@redhat.com>
18
19         * Makefile.am: Add copyright notice.
20         * NEWS: Likewise.
21         * README: Likewise.
22         * configure.ac: Likewise.
23         * ftruncate.c: Likewise.
24         * Makefile.in: Regenerate.
25
26 2012-12-14  Cary Coutant  <ccoutant@google.com>
27
28         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
29         --no-as-needed flag.
30         (exception_separate_shared_12_test): Likewise.
31         (incremental_copy_test): Likewise.
32         * testsuite/Makefile.in: Regenerate.
33
34 2012-12-14  Cary Coutant  <ccoutant@google.com>
35
36         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
37         (Dwp_output_file::Dwp_index::enter_set): Add assert.
38
39 2012-12-12  Alan Modra  <amodra@gmail.com>
40
41         * powerpc.cc (class Track_tls): New.
42         (class Relocate, class Scan): Inherit Track_tls.
43         (Target_powerpc::Scan::local, global): Track tls optimization
44         and avoid creating plt entry for __tls_get_addr if all uses
45         are optimized away.
46         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
47
48 2012-12-12  Alan Modra  <amodra@gmail.com>
49
50         * options.h (General_options): Add --toc-sort/--no-toc-sort.
51         Replace no_toc_optimize with toc_optimize.
52         * output.h (Output_section::input_sections): Provide non-const variant.
53         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
54         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
55         accessors.
56         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
57         (class Sort_toc_sections): New.
58         (Target_powerpc::do_finalize_sections): Sort toc sections.
59         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
60
61 2012-12-10  Roland McGrath  <mcgrathr@google.com>
62
63         * testsuite/binary_unittest.cc (read_all): New function.
64         (Sized_binary_test): Use it instead of ::read.
65         * fileread.cc (do_read): Don't assume pread always reads the whole
66         amount in a single call.
67
68 2012-12-10  Alan Modra  <amodra@gmail.com>
69
70         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
71         Set EM_PPC64 or EM_PPC here.
72         (Target_selector_powerpc::do_recognize): Delete.
73
74 2012-12-10  Alan Modra  <amodra@gmail.com>
75
76         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
77         stub_table_.
78         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
79
80 2012-12-07  Roland McGrath  <mcgrathr@google.com>
81
82         * testsuite/binary_unittest.cc (Sized_binary_test):
83         Use open_descriptor rather than ::open.
84
85 2012-12-07  Alan Modra  <amodra@gmail.com>
86
87         * powerpc.cc (Stub_table::do_write): Delete redundant Address
88         typedef and invalid_address constant.
89         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
90         instantiate constants.
91
92 2012-12-06  Roland McGrath  <mcgrathr@google.com>
93
94         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
95         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
96         * aclocal.m4: Regenerate.
97         * configure: Regenerate.
98         * Makefile.in: Regenerate.
99         * testsuite/Makefile.in: Regenerate.
100
101 2012-12-07  Alan Modra  <amodra@gmail.com>
102
103         * options.h (General_options): Add no_toc_optimize.
104         * powerpc.cc (ok_lo_toc_insn): New function.
105         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
106
107 2012-12-06  Alan Modra  <amodra@gmail.com>
108
109         * options.h (General_options): Add plt_align, plt_static_chain,
110         plt_thread_safe.  Update stub_group_size help text.
111         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
112         for new plt_thread_safe_ var.
113         (use_plt_offset): Correct comments.
114         (Target_powerpc::do_relax): Look for thread creation symbols to
115         determine default plt_thread_safe value.  Clear plt call stubs
116         as well as branch stubs each iteration.
117         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
118         insn constants.
119         (l, hi, ha, write_insn): Move earlier.
120         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
121         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
122         plt stubs too.
123         (Stub_table::update_size): Adjust.
124         (Stub_table::prev_size, set_prev_size): Delete.
125         (Stub_table::stub_align): Let --plt-align affect result.
126         (Stub_table::plt_call_size): Calculate sizes for various stubs.
127         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
128         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
129         (Stub_table::do_write): Support more stub variants.
130
131 2012-12-04  Alan Modra  <amodra@gmail.com>
132
133         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
134         (Target_powerpc::do_define_standard_symbols): New function.
135
136 2012-12-03  Alan Modra  <amodra@gmail.com>
137
138         * output.h: Formatting, whitespace.
139
140 2012-12-03  Alan Modra  <amodra@gmail.com>
141
142         * layout.h (Layout::get_executable_sections): Declare.
143         * layout.cc (Layout::get_executable_sections): New function.
144         * arm.cc (Target_arm::group_sections): Use it.
145         (Arm_output_section::group_sections): Delete now redundant test.
146         * output.cc (Output_reloc::Output_reloc): Add is_relative.
147         param to handle relative relocs.
148         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
149         (Output_data_reloc::add_absolute): Adjust.
150         (Output_data_reloc::add_relative): New function.
151         (Output_data::reset_data_size): New function.
152         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
153         (Output_section::set_addralign): New function.
154         (Output_section::checkpoint_set_addralign): New function.
155         (Output_section::clear_section_offsets_need_adjustment): New function.
156         (Output_section::input_sections): Make public.
157         * powerpc.cc (class Output_data_brlt_powerpc): New.
158         (class Stub_table, class Stub_control): New.
159         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
160         stub_table_, set_stub_table, stub_table): New vectors and accessor
161         functions.
162         (Target_powerpc::do_may_relax, do_relax, push_branch,
163         new_stub_table, stub_tables, brlt_section, group_sections,
164         add_branch_lookup_table, find_branch_lookup_table,
165         write_branch_lookup_table, make_brlt_section): New functions.
166         (Target_powerpc::struct Sort_sections, class Branch_info): New.
167         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
168         branch_info_): New vars.
169         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
170         make call stubs here.
171         (Output_data_glink): Remove all call stub handling from this class.
172         (Target_powerpc::Scan::local, global): Save interesting branch
173         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
174         (Target_powerpc::do_finalize_sections): Only make reg save/restore
175         functions on final link.
176         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
177         Handle long branch destinations too.
178         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
179         do_plt_address_for_local): Adjust lookup of plt call stubs.
180
181 2012-11-30  Alan Modra  <amodra@gmail.com>
182
183         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
184         relocs against protected symbols when building 32-bit shared libs.
185
186 2012-11-30  Alan Modra  <amodra@gmail.com>
187
188         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
189         param.  Call got_section() to make .got.  Update all callers
190         and their callers and so on.
191
192 2012-11-30  Alan Modra  <amodra@gmail.com>
193
194         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
195         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
196         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
197         value if it already exists.
198
199 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
200
201         PR gold/14858
202         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
203
204 2012-11-14  Roland McGrath  <mcgrathr@google.com>
205
206         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
207         than bfc instruction for data sandboxing.
208
209 2012-11-08  Alan Modra  <amodra@gmail.com>
210
211         * po/POTFILES.in: Regenerate.
212
213 2012-11-05  Alan Modra  <amodra@gmail.com>
214
215         * configure.ac: Apply 2012-09-10 change to config.in here.
216         * configure: Regenerate.
217
218 2012-11-05  Alan Modra  <amodra@gmail.com>
219
220         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
221         (struct Opd_ent): Use "Address" rather than "Offset".
222         (Output_data_got_powerpc::got_base_offset): Return Valtype.
223         (Target_powerpc::got_section): Make public.
224         (Target_powerpc::scan_relocs): Move code setting symbols..
225         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
226         Create _SDA_BASE_ only when referenced.
227
228 2012-11-02  Roland McGrath  <mcgrathr@google.com>
229
230         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
231         from last change.
232
233 2012-11-01  Roland McGrath  <mcgrathr@google.com>
234
235         * target.h (Sized_target::relocate_relocs): Use Elf_Off
236         for offset_in_output_section parameter.
237         (Sized_target::relocate_special_relocatable): Likewise.
238         * arm.cc (Target_arm::relocate_relocs): Likewise.
239         (Target_arm::relocate_special_relocatable): Likewise.
240         * i386.cc (Target_i386::relocate_relocs): Likewise.
241         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
242         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
243         * target-reloc.h (relocate_relocs): Likewise.
244         * testsuite/testfile.cc (Target_test): Likewise.
245         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
246         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
247
248         * system.h: Move inclusion of <clocale> to after <libintl.h> in
249         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
250
251         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
252         parameter, which is unused in the [!F_SETFD] case.
253
254         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
255         SYMNDX to off_t before comparing it to this->data_size().
256         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
257         * incremental.cc (Output_section_incremental_inputs::do_write):
258         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
259
260         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
261
262 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
263
264         * gold.cc (Target_arm::do_adjust_elf_header): Add the
265         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
266         in EABI_VER5.
267
268 2012-10-29  Cary Coutant  <ccoutant@google.com>
269
270         * dwp.cc (usage): Add file and exit status parameters;
271         add --help and --version options.
272         (print_version): New function.
273         (main): Add --help and --version options.
274
275 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
276
277         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
278         final_layout_sequence.txt.
279         * testsuite/Makefile.in: Regenerated.
280
281 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
282
283         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
284         COMPILE generated by automake.
285         (LINK1): Likewise.
286         (CXXCOMPILE1): Likewise.
287         (CXXLINK1): Likewise.
288         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
289         (LINK): Likewise.
290         (CXXCOMPILE): Likewise.
291         (CXXLINK): Likewise.
292         * testsuite/Makefile.in: Regenerated.
293
294 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
295
296         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
297         on bad fwrite return.
298
299 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
300
301         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
302         on val.
303
304 2012-10-23  Cary Coutant  <ccoutant@google.com>
305
306         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
307         * testsuite/Makefile.in: Regenerate.
308         * testsuite/dwp_test.h: New source file.
309         * testsuite/dwp_test_1.cc: New source file.
310         * testsuite/dwp_test_1.s: New source file.
311         * testsuite/dwp_test_1.sh: New source file.
312         * testsuite/dwp_test_1b.cc: New source file.
313         * testsuite/dwp_test_1b.s: New source file.
314         * testsuite/dwp_test_2.cc: New source file.
315         * testsuite/dwp_test_2.s: New source file.
316         * testsuite/dwp_test_2.sh: New source file.
317         * testsuite/dwp_test_main.cc: New source file.
318         * testsuite/dwp_test_main.s: New source file.
319
320 2012-10-23  Cary Coutant  <ccoutant@google.com>
321
322         * dwp.h: New header file.
323         * dwp.cc: New source file.
324         * gold.h: Move shared declarations to system.h.
325         * system.h: New header file.
326         * Makefile.am: Add dwp.
327         * Makefile.in: Regenerate.
328
329 2012-10-23  Cary Coutant  <ccoutant@google.com>
330
331         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
332         Dwarf_info_reader::read_from_pointer.
333         (Dwarf_pubnames_table::read_header): Likewise.
334         (Dwarf_pubnames_table::next_name): Likewise.
335         (Dwarf_die::read_attributes): Likewise.
336         (Dwarf_die::skip_attributes): Likewise.
337         (Dwarf_info_reader::read_from_pointer): New function template.
338         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
339         (Dwarf_pubnames_table): Likewise.
340         (Dwarf_info_reader::read_from_pointer): New function template.
341         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
342         Dwarf_pubnames_table ctor.
343
344 2012-10-23  Cary Coutant  <ccoutant@google.com>
345
346         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
347         abbrev_shndx.
348         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
349         abbrev_shndx_.
350         (Dwarf_info_reader::set_abbrev_shndx): New method.
351         (Dwarf_info_reader::abbrev_shndx_): New data member.
352
353 2012-10-23  Cary Coutant  <ccoutant@google.com>
354
355         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
356         from object, not parameters.
357         (Dwarf_info_reader::parse): Likewise.
358         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
359         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
360         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
361         methods.
362
363 2012-10-23  Cary Coutant  <ccoutant@google.com>
364
365         * fileread.cc (Input_file::Input_file): New constructor.
366         * fileread.h (class Input_file): Add new constructor.
367
368 2012-10-18  Alan Modra  <amodra@gmail.com>
369
370         PR gold/14727
371         * object.cc (Relobj::is_section_name_included): Also match
372         .sdata personality section.
373
374 2012-10-18  Alan Modra  <amodra@gmail.com>
375
376         * target-reloc.h (class Default_comdat_behavior): New, package up..
377         (get_comdat_behaviour): ..this.
378         (relocate_section): Add Relocate_comdat_behavior template arg,
379         adjust code to suit.
380         * arm.cc (Target_arm::relocate_section): Adjust to suit.
381         (Target_arm::scan_reloc_section): Likewise.
382         * i386.cc (Target_i386::relocate_section): Likewise.
383         * sparc.cc (Target_sparc::relocate_section): Likewise.
384         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
385         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
386         * powerpc.cc (class Relocate_comdat_behavior): New.
387         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
388         gold::relocate_section with new template arg.
389
390 2012-10-18  Alan Modra  <amodra@gmail.com>
391
392         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
393         dynamic relocs for GOT_TPREL got entries, without symbol if
394         resolving locally.
395         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
396         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
397         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
398
399 2012-10-17  Alan Modra  <amodra@gmail.com>
400
401         PR gold/14726
402         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
403
404 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
405
406         * layout.cc (Layout::include_section): Keep sections marked
407         SHF_EXCLUDE when doing relocatable links.
408
409 2012-10-16  Alan Modra  <amodra@gmail.com>
410
411         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
412         (Target_powerpc::do_finalize_sections): Call it.
413         (Output_data_save_res): New class and supporting functions.
414         (Target_powerpc::symval_for_branch): Only look up .opd entry for
415         normal symbols defined in object files.
416
417 2012-10-12  Alan Modra  <amodra@gmail.com>
418
419         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
420         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
421         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
422         section if scan_opd_relocs not yet called.
423         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
424
425 2012-10-12  Alan Modra  <amodra@gmail.com>
426
427         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
428         add_local_ifunc_entry): Revert last change.
429         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
430
431 2012-10-05  Alan Modra  <amodra@gmail.com>
432
433         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
434         do_plt_address_for_global): New functions.
435         (Output_data_got_powerpc::do_write): Don't segfault when linking
436         statically.
437         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
438         add_local_ifunc_entry): Return true on adding entry..
439         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
440         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
441         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
442         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
443         set up symbols here.
444         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
445         syms here.  Do so even when no .iplt.  Don't segfault when linking
446         statically.
447         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
448         new variants without reloc param.
449         (Glink_sym_ent::Glink_sym_ent): Likewise.
450         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
451         reloc when refs will resolve to plt call stub.
452         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
453         R_PPC_PLTREL24 to resolve locally.
454         (Target_powerpc::Scan::global): Correct ifunc handling.
455         (Target_powerpc::Relocate::relocate): Correct local sym glink
456         lookup.  Don't destroy "value" when we have a plt call stub,
457         and when checking plt call validity.
458         (Target_powerpc::do_dynsym_value): Simplify.
459
460 2012-10-05  Alan Modra  <amodra@gmail.com>
461
462         * i386.cc (Output_data_plt_i386::address_for_global,
463         address_for_local): Add plt offset to returned value.  Adjust uses.
464         * sparc.cc (Output_data_plt_sparc::address_for_global,
465         address_for_local): Likewise.
466         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
467         address_for_local): Likewise.
468         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
469         address_for_local): Likewise.
470         * target.h (Target::plt_address_for_global, plt_address_for_local):
471         Update comment.
472         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
473         (Output_data_got::Got_entry::write): Nor here.
474         * output.h: Comment fix.
475
476 2012-10-02  Jiong Wang  <jiwang@tilera.com>
477
478         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
479         global_offset_table_ value for larget got.
480         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
481
482 2012-09-29  Alan Modra  <amodra@gmail.com>
483
484         * powerpc.cc (Target_powerpc::iplt_): New output section.
485         (Target_powerpc::iplt_section, make_iplt_section,
486         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
487         (Target_powerpc::make_plt_entry): Handle ifunc syms.
488         Target_powerpc::plt_entry_count): Count iplt entries too.
489         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
490         reloc section in constructor.  New params.
491         (Target_powerpc::make_plt_section): Create reloc section here instead.
492         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
493         functions.
494         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
495         (Output_data_glink::add_entry, find_entry): New functions to
496         deal with local syms.
497         (Glink_sym_ent): Add support for local syms.
498         (Output_data_glink::do_write): Handle ifunc plt entries.
499         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
500         (Target_powerpc::Scan::local, global): Handle ifunc syms.
501         (Target_powerpc::Relocate::relocate): Likewise.
502         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
503
504 2012-09-25  Alan Modra  <amodra@gmail.com>
505
506         * object.h (Sized_relobj_file::adjust_local_symbol,
507         do_adjust_local_symbol): New functions.
508         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
509         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
510         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
511         and irregular opd entry spacing.
512         (Powerpc_relobj::do_read_relocs): Add opd size checks.
513         (Global_symbol_visitor_opd): New functor.
514         (Target_powerpc::do_finalize_sections): Omit global symbols defined
515         on deleted opd entries.
516
517 2012-09-15  Jiong Wang  <jiwang@tilera.com>
518
519         * tilegx.cc: New file.
520         * Makefile.am (TARGETSOURCES): Add tilegx.cc
521         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
522         * configure.tgt: Add entries for tilegx*.
523         * configure.ac: Likewise.
524         * Makefile.in: Rebuild.
525         * configure: Likewise.
526         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
527         tilegx.
528
529 2012-09-13  Alan Modra  <amodra@gmail.com>
530
531         * target-reloc.h (scan_relocs): Call scan.local for relocs
532         against symbols in discarded sections.  Pass is_discarded
533         param.
534         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
535         Add is_discarded param.
536         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
537         is_discarded to flag opd entry as discarded.  Don't emit dyn
538         relocs on such entries.
539         (Target_powerpc::Scan::global): Similarly detect and handle
540         such opd entries.
541         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
542         opd_ent_.  Update all uses.
543         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
544         (Target_powerpc::relocate_section): Zero out discarded opd
545         entry relocs.
546
547 2012-09-12  Ian Lance Taylor  <iant@google.com>
548
549         PR gold/14570
550         * output.cc: Rename Output_data_got template parameter from size
551         to got_size for all functions.  Compile all variants of
552         Output_data_got.
553         (Output_data_got::Got_entry::write): Correct use of size for
554         symbol value.  Use local_is_tls rather than casting to
555         Sized_relobj_file.
556         * object.h (class Object): Add local_is_tls and do_local_is_tls.
557         (class Sized_relobj_file): Add do_local_is_tls.
558         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
559
560 2012-09-11  Alan Modra  <amodra@gmail.com>
561
562         PR gold/14566
563         * layout.cc (Layout::set_segment_offsets): When using
564         common-page-size alignment, ensure we are on a new max-page-size
565         page.
566         * output.cc (Output_segment::set_section_addresses): Use
567         abi_pagesize, not common_pagesize for relro boundary.
568         (Output_segment::set_offset): Likewise.
569
570 2012-09-11  Alan Modra  <amodra@gmail.com>
571
572         * output.h (Output_data_got::add_global_tls, add_local_tls,
573         add_local_tls_pair): New functions.
574         (Output_data_got::add_local_pair_with_rel): Remove second
575         reloc param.  Expand comment.
576         (Output_data_got::Got_entry): Rename use_plt_offset_ to
577         use_plt_or_tls_offset_, similarly for constructor param.
578         (Output_data_got::Got_entry::write): Add got_index param.
579         * output.cc (Output_data_got::add_global_tls, add_local_tls,
580         add_local_tls_pair): New functions.
581         (Output_data_got::Got_entry::write): Handle tls symbols
582         with use_plt_or_tls_offset_ set specially.
583         (Output_data_got::add_local_pair_with_rel): Only one reloc.
584         (Output_data_got::do_write): Replace iterator with index, pass
585         index to entry write function.
586         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
587         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
588         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
589         call.
590         * i386.cc (Target_i386::Scan::local): Likewise.
591         * sparc.cc (Target_sparc::Scan::local): Likewise.
592         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
593         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
594         do_tls_offset_for_global): New functions.
595         (Target_powerpc::Scan::local): Correct TLS relocations and got
596         entry values.
597         (Target_powerpc::Scan::global): Don't emit unnecessary
598         dynamic relocations on TLS GOT entries.
599
600 2012-09-10  Matthias Klose  <doko@ubuntu.com>
601
602         * config.in: Disable sanity check for kfreebsd.
603
604 2012-09-10  Sterling Augustine  <saugustine@google.com>
605
606         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
607         (Gdb_index::pubtypes_read): New parameter.
608         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
609         to calls.
610         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
611         pubtypes_object_.
612
613 2012-09-09  Alan Modra  <amodra@gmail.com>
614
615         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
616         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
617         * gc.h (gc_process_relocs): Call target gc_add_reference.
618         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
619         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
620         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
621         unnecessary cast.
622         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
623         to cater for when we don't need code offset.  Update use.
624         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
625         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
626         set_opd_valid): New functions.
627         (Target_powerpc::do_gc_add_reference): New function.
628         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
629         stashed refs.
630         (Target_powerpc::do_gc_mark_symbol): New function.
631
632 2012-09-06  Cary Coutant  <ccoutant@google.com>
633
634         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
635         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
636         (Dwarf_die::skip_attributes): Likewise.
637         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
638         * testsuite/gdb_index_test.cc (inline_func_1): New function.
639         (main): Call it.
640         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
641
642 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
643
644         * testsuite/script_test_3.t: Add .got.plt output section
645         statement.
646         * testsuite/script_test_4.t: Likewise.
647
648 2012-09-05  Alan Modra  <amodra@gmail.com>
649
650         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
651         update all uses and lose "enum" when using type.
652
653 2012-09-05  Alan Modra  <amodra@gmail.com>
654
655         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
656         * configure: Regenerate.
657         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
658         (plugin_final_layout.stdout): Likewise.
659         (memory_test): Set page sizes to 0x1000.
660         * testsuite/Makefile.in: Regenerate.
661         * testsuite/discard_locals_test.sh: Add FIXME comment.
662         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
663         * testsuite/pr14265.t: Add .got output section statement.
664         * testsuite/script_test_2.t: Likewise.
665         * testsuite/script_test_3.t: Likewise.
666         * testsuite/script_test_4.t: Likewise.
667         * testsuite/script_test_5.t: Likewise.
668         * testsuite/script_test_6.t: Likewise.
669         * testsuite/script_test_7.t: Likewise.
670         * testsuite/script_test_9.t: Likewise.
671
672 2012-09-05  Alan Modra  <amodra@gmail.com>
673
674         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
675         (Powerpc_relocate_functions::Status): New typedef.
676         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
677         (Target_powerpc::Scan::local): Handle REL64.
678         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
679         for REL32 and REL64.
680         (Target_powerpc::symval_for_branch): New function, extracted from..
681         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
682         checks.  Report overflow errors.
683
684 2012-09-05  Alan Modra  <amodra@gmail.com>
685
686         * object.h (Sized_relobj_file::emit_relocs): Delete.
687         (Sized_relobj_file::emit_relocs_reltype): Delete.
688         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
689         relocate_relocs for --emit-relocs.
690         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
691         * output.h: Update comment.
692         (Output_segment::first_section): New function.
693         (Output_segment::first_section_load_address): Use first_section.
694         * output.cc (Output_segment::first_section): New function extracted..
695         (Output_segment::first_section_load_address): ..from here.  Delete.
696         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
697         * target.h (Sized_target::relocate_for_relocatable): Likewise.
698         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
699         adjust call to target.h function.
700         * i386.cc (Target_i386): Likewise.
701         * sparc.cc (Target_sparc): Likewise.
702         * x86_64.cc (Target_x86_64): Likewise.
703         * powerpc.cc (Target_powerpc): Likewise.
704         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
705         first tls section has section symbol for optimised local dynamic
706         output relocs.
707         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
708         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
709         optimised tls code.
710         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
711         Rename to relocate_relocs.  Update error message.
712
713 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
714
715         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
716         --just-symbols.
717
718 2012-08-31  Alan Modra  <amodra@gmail.com>
719
720         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
721         (Powerpc_relobj::toc_base_offset): New stub function.
722         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
723         got_mod_index_offset to tlsld_got_offset.  Update all refs.
724         (Target_powerpc::Relocate::enum skip_tls): New.
725         (Target_powerpc::call_tls_get_addr_): New var.
726         (Target_powerpc::is_branch_reloc): Move to file scope.
727         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
728         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
729         New functions.
730         (Target_powerpc::enum Got_type): Delete old values, add new ones.
731         (powerpc_info): Correct common_pagesize for ppc64.
732         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
733         (Powerpc_relocate_functions): Add overflow check enums and functions.
734         Add non-shift version of rela, rela_ua.  Delete all rel public
735         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
736         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
737         addr16_ha3, addr14 functions.
738         (Output_data_got_powerpc::add_constant_pair): New function.
739         (Output_data_got_powerpc::got_base_offset): Likewise.
740         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
741         (instruction constants): Sort, add some more.
742         (Output_data_glink::do_write): Add and use Address typedef.  Use
743         object->toc_base_offset() stub for 64-bit.
744         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
745         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
746         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
747         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
748         Always treat .opd relocs as against locally defined symbol.
749         Correct condition for RELATIVE relocs.
750         (Target_powerpc::do_finalize_sections): Test for NULL sections.
751         (Target_powerpc::Relocate::relocate): Use plt call stub as value
752         for 32-bit syms with a plt entry.  Correct ppc64 toc base
753         calculations.  Handle TLS relocs, and more.  Add overflow
754         checking and adjust for Powerpc_relocate_functions changes.
755         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
756         Reinstate --emit-relocs code with FIXME.
757
758 2012-08-30  Alan Modra  <amodra@gmail.com>
759
760         * layout.cc (Layout::set_segment_offsets): Set p_align to
761         abi_pagesize, not common_pagesize.
762         (Layout::relaxation_loop_body): Similarly use abi_pagesize
763         to determine whether file header can go in segment.
764
765 2012-08-30  Alan Modra  <amodra@gmail.com>
766
767         * output.h (Output_reloc::Output_reloc <output section>): Add
768         is_relative param.  Adjust calls.
769         (Output_reloc::add_output_section_relative): New functions.
770         * output.cc (Output_reloc::Output_reloc <output section>): Handle
771         is_relative.
772         (Output_reloc::symbol_value): Handle SECTION_CODE.
773
774 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
775
776         * gold.cc (queue_middle_tasks): Call layout again when unique
777         segments for sections is desired.
778         * layout.cc (Layout::Layout): Initialize new members.
779         (Layout::get_output_section_flags): New function.
780         (Layout::choose_output_section): Call get_output_section_flags.
781         (Layout::layout): Make output section for mapping to a unique segment.
782         (Layout::insert_section_segment_map): New function.
783         (Layout::attach_allocated_section_to_segment): Make unique segment for
784         output sections marked so.
785         (Layout::segment_precedes): Check for unique segments when sorting.
786         * layout.h (Layout::Unique_segment_info): New struct.
787         (Layout::Section_segment_map): New typedef.
788         (Layout::insert_section_segment_map): New function.
789         (Layout::get_output_section_flags): New function.
790         (Layout::is_unique_segment_for_sections_specified): New function.
791         (Layout::set_unique_segment_for_sections_specified): New function.
792         (Layout::unique_segment_for_sections_specified_): New member.
793         (Layout::section_segment_map_): New member.
794         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
795         Rename is_gc_pass_one to is_pass_one.
796         Rename is_gc_pass_two to is_pass_two.
797         Rename is_gc_or_icf to is_two_pass.
798         Check for which pass based on whether symbols data is present.
799         Make it two pass when unique segments for sections is desired.
800         * output.cc (Output_section::Output_section): Initialize new
801         members.
802         * output.h (Output_section::is_unique_segment): New function.
803         (Output_section::set_is_unique_segment): New function.
804         (Output_section::is_unique_segment_): New member.
805         (Output_section::extra_segment_flags): New function.
806         (Output_section::set_extra_segment_flags): New function.
807         (Output_section::extra_segment_flags_): New member.
808         (Output_section::segment_alignment): New function.
809         (Output_section::set_segment_alignment): New function.
810         (Output_section::segment_alignment_): New member.
811         (Output_segment::Output_segment): Initialize is_unique_segment_.
812         (Output_segment::is_unique_segment): New function.
813         (Output_segment::set_is_unique_segment): New function.
814         (Output_segment::is_unique_segment_): New member.
815         * plugin.cc (allow_unique_segment_for_sections): New function.
816         (unique_segment_for_sections): New function.
817         (Plugin::load): Add new functions to transfer vector.
818         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
819         * Makefile.in: Regenerate.
820         * testsuite/plugin_final_layout.sh: Check if unique segment
821         functionality works.
822         * testsuite/plugin_section_order.c (onload): Check if new interfaces
823         are available.
824         (allow_unique_segment_for_sections): New global.
825         (unique_segment_for_sections): New global.
826         (claim_file_hook): Call allow_unique_segment_for_sections.
827         (all_symbols_read_hook): Call unique_segment_for_sections.
828
829 2012-08-22  Cary Coutant  <ccoutant@google.com>
830
831         * layout.cc (Layout::include_section): Don't assert on GROUP
832         sections with --emit-relocs.
833
834 2012-08-21  Cary Coutant  <ccoutant@google.com>
835
836         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
837         if --export-dynamic-symbol names an undef symbol.
838
839 2012-08-18  Alan Modra  <amodra@gmail.com>
840
841         * powerpc.cc: Formatting and white space.
842         (Powerpc_relobj): Rename got2_section_ to special_.
843         Add opd_ent_shndx_ and opd_ent_off_ vectors.
844         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
845         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
846         (Target_powerpc): Add Address typedef and invalid_address.  Use
847         throughout.
848         (Target_powerpc::is_branch_reloc): New function.
849         (Powerpc_relocate_functions): Add Address typedef, use throughout.
850         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
851         for dst_mask, value and addend.
852         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
853         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
854         (Output_data_glink::do_write): Correct toc base.  Don't try to use
855         uint16_t for 24-bit offset.  Use get_output_section_offset and
856         check return.
857         (Target_powerpc::Scan::local): Handle more relocs.
858         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
859         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
860         Plug in toc restoring insn after plt calls.  Translate branches
861         to function descriptor symbols to corresponding entry point.
862         (Target_powerpc::relocate_for_relocatable): Check return from
863         get_output_section_offset.
864         * symtab.h: Comment typo.
865
866 2012-08-14  Ian Lance Taylor  <iant@google.com>
867
868         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
869         unsupported_relocal_local to call unsupported_reloc_global.
870
871 2012-08-14  Nick Clifton  <nickc@redhat.com>
872
873         PR ld/14265
874         * script-sections.cc (Sections_element::output_section_name): Add
875         keep return parameter.
876         (Output_section_element::match_name): Add keep return parameter.
877         Return the value of the keep_ member.
878         * script-sections.h (class Output_section): Update
879         output_section_name prototype.
880         * layout.cc (Layout::keep_input_section): New public member
881         function.
882         (Layout::choose_output_section): Pass keep parameter to
883         output_section_name.
884         * layout.h (class Layout): Add keep_input_section.
885         * object.cc (Sized_relobj_file::do_layout): Check for kept input
886         sections.
887         * testsuite/Makefile.am: Add a test.
888         * testsuite/Makefile.in: Regenerate.
889         * testsuite/pr14265.c: Source file for the test.
890         * testsuite/pr14265.t: Linker script for the test.
891         * testsuite/pr14265.sh: Shell script for the test.
892
893 2012-08-14  Alan Modra  <amodra@gmail.com>
894
895         * target.h (Target::output_section_name): New function.
896         (Target::do_output_section_name): New function.
897         * layout.cc (Layout::choose_output_section): Call the above.
898         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
899
900 2012-08-14  Alan Modra  <amodra@gmail.com>
901
902         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
903         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
904         for replace_constant call.
905         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
906         (Output_data_glink::do_print_to_mapfile): New function.
907         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
908         (Target_powerpc::Relocate::relocate): Likewise.
909
910 2012-08-14  Alan Modra  <amodra@gmail.com>
911
912         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
913         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
914         (Output_data_glink::add_entry,find_entry): Remove shndx param.
915         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
916         all references to shndx_.  Handle special case for R_PPC_PLTREL24
917         here.
918         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
919         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
920         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
921         here.
922         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
923         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
924
925 2012-08-12  Alan Modra  <amodra@gmail.com>
926
927         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
928         (glink insn constants): Use uint32_t.
929         (Output_data_glink::add_entry): Use insert, not [] operator.
930
931 2012-08-11  Alan Modra  <amodra@gmail.com>
932
933         * object.h (Sized_relobj_file::find_shdr): New function.
934         (Sized_relobj_file::find_special_sections): New function.
935         * object.cc (Sized_relobj_file::find_shdr): New function.
936         (Sized_relobj_file::find_eh_frame): Use find_shdr.
937         (Sized_relobj_file::find_special_sections): New function, split out..
938         (Sized_relobj_file::do_read_symbols): ..from here.
939         * output.h (Output_data_got::replace_constant): New function.
940         (Output_data_got::num_entries): New function.
941         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
942         (Output_data_got::got_offset): Protected rather than private.
943         (Output_data_got::replace_got_entry): New function.
944         * output.cc (Output_data_got::replace_got_entry): New function.
945         * powerpc.cc (class Powerpc_relobj): New.
946         (class Powerpc_relocate_functions): Delete all psymval variants or
947         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
948         Implement _ha functions using corresponding _hi function.
949         (Powerpc_relobj::find_special_sections): New function.
950         (Target_powerpc::do_make_elf_object): New function.
951         (class Output_data_got_powerpc): New.
952         (class Output_data_glink): New.
953         (class Powerpc_scan_relocatable_reloc): New.
954         Many more changes througout file.
955
956 2012-08-09  Nick Clifton  <nickc@redhat.com>
957
958         * po/vi.po: Updated Vietnamese translation.
959
960 2012-08-07  Ian Lance Taylor  <iant@google.com>
961
962         * layout.cc (Layout::add_target_dynamic_tags): If
963         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
964         plt_rel.
965
966 2012-07-30  Nick Clifton  <nickc@redhat.com>
967
968         * po/gold.pot: Updated template.
969         * po/es.po: Updated Spanish translation.
970
971 2012-07-18  Cary Coutant  <ccoutant@google.com>
972
973         PR gold/14344
974         * configure.ac: Add check for -gpubnames support.
975         * configure: Regenerate.
976         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
977         support; force -gno-pubnames.
978         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
979         support.
980         (gdb_index_test_4): New test.
981         * testsuite/Makefile.in: Regenerate.
982         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
983         * testsuite/gdb_index_test_2.sh: Likewise.
984         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
985         * testsuite/gdb_index_test_4.sh: New script.
986         * testsuite/gdb_index_test_comm.sh: New script with common code;
987         don't look for space after colon.
988
989 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
990
991         * gold.cc (queue_middle_tasks): Update function order only after
992         deferred objects due to plugins are processed.
993
994 2012-07-11  Ian Lance Taylor  <iant@google.com>
995
996         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
997         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
998         (Target_arm::scan_reloc_for_stub): Likewise.
999         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1000         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1001         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1002         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1003         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1004
1005 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1006             Ian Lance Taylor  <iant@google.com>
1007
1008         PR gold/14309
1009         * configure.ac: Test whether std::tr1::hash<off_t> works.
1010         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1011         needed.
1012         * output.h (class Output_fill): Add virtual destructor.
1013         * configure, config.in: Rebuild.
1014
1015 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1016
1017         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1018
1019 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1020
1021         * plugin.cc (Plugin::load): Handle position independent executables.
1022
1023 2012-06-06  Cary Coutant  <ccoutant@google.com>
1024
1025         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1026         add .debug_macro.
1027         (lines_only_debug_sections): Likewise.
1028         (gdb_fast_lookup_sections): New static array.
1029         (is_gdb_debug_section): Rename formal parameter.
1030         (is_lines_only_debug_section): Likewise.
1031         (is_gdb_fast_lookup_section): New function.
1032         (Layout::include_section): Check for ".zdebug_" prefix; pass
1033         section name suffix to is_gdb_debug_section, et al.; check for
1034         fast-lookup sections when building .gdb_index.
1035         * options.h (--strip-debug-gdb): Update GDB version number.
1036
1037 2012-06-06  Cary Coutant  <ccoutant@google.com>
1038
1039         * configure.ac: Add check for fallocate.
1040         * configure: Regenerate.
1041         * config.in: Regenerate.
1042
1043         * options.h (class General_options): Add --mmap-output-file and
1044         --posix-fallocate options.
1045         * output.cc: (posix_fallocate): Remove; replace with...
1046         (gold_fallocate): New function.
1047         (Output_file::map_no_anonymous): Call gold_fallocate.
1048         (Output_file::map): Check --mmap-output-file option.
1049
1050 2012-06-05  Jing Yu  <jingyu@google.com>
1051
1052         * gold.h (textdomain): Add do {} to empty while(0).
1053         (bindtextdomain): Likewise.
1054
1055 2012-06-04  Cary Coutant  <ccoutant@google.com>
1056
1057         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1058         has_dynsym_index.
1059
1060 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1061
1062         * symtab.cc (Symbol_table::define_special_symbol):
1063         Initialize *poldsym to prevent uninitialized variable errors.
1064
1065 2012-05-23  Cary Coutant  <ccoutant@google.com>
1066
1067         * layout.cc (Layout::section_name_mapping): Add rules to handle
1068         exact match on .data.rel.ro.local or .data.rel.ro.
1069         (Layout::output_section_name): Check for exact matches.
1070
1071 2012-05-23  Cary Coutant  <ccoutant@google.com>
1072
1073         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1074         more carefully.
1075
1076 2012-05-22  Cary Coutant  <ccoutant@google.com>
1077
1078         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1079         object before exporting symbol.
1080
1081 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1082
1083         * testsuite/tls_test.cc: Include "config.h" first.
1084         * testsuite/tls_test_c.c: Likewise.
1085
1086 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1087             Nick Clifton  <nickc@redhat.com>
1088
1089         PR 14072
1090         * configure.in: Add check that sysdep.h has been included before
1091         any system header files.
1092         * configure: Regenerate.
1093         * config.in: Regenerate.
1094
1095 2012-05-14  Cary Coutant  <ccoutant@google.com>
1096
1097         * layout.cc (Layout::make_output_section): Mark .tdata section
1098         as RELRO.
1099         * testsuite/relro_test.cc: Add a TLS variable.
1100
1101 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1102
1103         PR gold/14091
1104         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1105         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1106         R_X86_64_64.
1107
1108 2012-05-08  Cary Coutant  <ccoutant@google.com>
1109
1110         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1111         (lines_only_debug_sections): Likewise.
1112
1113 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1114
1115         * nacl.cc: New file.
1116         * nacl.h: New file.
1117         * Makefile.am (CCFILES, HFILES): Add them.
1118         * Makefile.in: Regenerate.
1119         * i386.cc (Output_data_plt_i386_nacl): New class.
1120         (Output_data_plt_i386_nacl_exec): New class.
1121         (Output_data_plt_i386_nacl_dyn): New class.
1122         (Target_i386_nacl): New class.
1123         (Target_selector_i386_nacl): New class.
1124         (target_selector_i386): Use it instead of Target_selector_i386.
1125         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1126         (Target_x86_64_nacl): New class.
1127         (Target_selector_x86_64_nacl): New class.
1128         (target_selector_x86_64, target_selector_x32): Use it instead of
1129         Target_selector_x86_64.
1130         * arm.cc (Output_data_plt_arm_nacl): New class.
1131         (Target_arm_nacl): New class.
1132         (Target_selector_arm_nacl): New class.
1133         (target_selector_arm, target_selector_armbe): Use it instead of
1134         Target_selector_arm.
1135
1136         * target-select.cc (select_target): Take new Input_file* and off_t
1137         arguments, pass them on to recognize method of selector.
1138         * object.cc (make_elf_sized_object): Update caller.
1139         * parameters.cc (parameters_force_valid_target): Likewise.
1140         * incremental.cc (make_sized_incremental_binary): Likewise.
1141         * target-select.h: Update decl.
1142         (Target_selector::recognize): Take new Input_file* argument,
1143         pass it on to do_recognize.
1144         (Target_selector::do_recognize): Take new Input_file* argument.
1145         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1146         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1147         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1148         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1149
1150         * target.h (Target::Target_info): New members isolate_execinstr
1151         and rosegment_gap.
1152         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1153         * arm.cc (Target_arm::arm_info): Update initializer.
1154         * i386.cc (Target_i386::i386_info): Likewise.
1155         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1156         * sparc.cc (Target_sparc::sparc_info): Likewise.
1157         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1158         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1159         * layout.cc (Layout::attach_allocated_section_to_segment):
1160         Take new const Target* argument.  If target->isolate_execinstr(), act
1161         like --rosegment.
1162         (Layout::find_first_load_seg): Take new const Target* argument;
1163         if target->isolate_execinstr(), reject PF_X segments.
1164         (Layout::relaxation_loop_body): Update caller.
1165         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1166         reset file offset to zero when we hit LOAD_SEG, and then do a second
1167         loop over the segments before LOAD_SEG to reassign offsets after
1168         addresses have been determined.  Handle target->rosegment_gap().
1169         (Layout::attach_section_to_segment): Take new const Target* argument;
1170         pass it to attach_allocated_section_to_segment.
1171         (Layout::make_output_section): Update caller.
1172         (Layout::attach_sections_to_segments): Take new const Target* argument;
1173         pass it to attach_section_to_segment.
1174         * gold.cc (queue_middle_tasks): Update caller.
1175         * layout.h (Layout): Update method decls with new arguments.
1176
1177         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1178         Target_info pointer to use.
1179         (Target_arm::do_make_data_plt): New virtual method.
1180         (Target_arm::make_data_plt): New method that calls it.
1181         (Target_arm::make_plt_entry): Use it.
1182         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1183         for the section alignment.
1184         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1185         method.
1186         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1187         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1188         method.
1189         (Output_data_plt_arm::get_plt_entry_size): Call it.
1190         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1191         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1192         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1193         method.
1194         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1195         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1196         method instead of sizeof(plt_entry).
1197         (Output_data_plt_arm::add_entry): Likewise.
1198         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1199         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1200         than static method.
1201         (Target_arm::plt_entry_size): Likewise.
1202         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1203         Move to ...
1204         (Output_data_plt_arm_standard): ... here, new class.
1205         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1206         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1207         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1208
1209         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1210         Take additional argument for the PLT entry size.
1211         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1212         Use get_plt_entry_size method rather than plt_entry_size variable.
1213         (Output_data_plt_x86_64::reserve_slot): Likewise.
1214         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1215         (Output_data_plt_x86_64::add_entry): Likewise.
1216         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1217         (Output_data_plt_x86_64::address_for_global): Likewise.
1218         (Output_data_plt_x86_64::address_for_local): Likewise.
1219         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1220         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1221         Make method non-static.
1222         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1223         method.
1224         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1225         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1226         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1227         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1228         virtual method.
1229         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1230         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1231         virtual method.
1232         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1233         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1234         virtual method.
1235         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1236         (Output_data_plt_x86_64::plt_entry_size)
1237         (Output_data_plt_x86_64::first_plt_entry)
1238         (Output_data_plt_x86_64::plt_entry)
1239         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1240         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1241         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1242         (Output_data_plt_x86_64_standard): ... here, new class.
1243         (Target_x86_64::Target_x86_64): Take optional argument for the
1244         Target_info pointer to use.
1245         (Target_x86_64::do_make_data_plt): New virtual method.
1246         (Target_x86_64::make_data_plt): New method to call it.
1247         (Target_x86_64::init_got_plt_for_update): Use that.
1248         Call this->plt_->add_eh_frame method here.
1249         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1250         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1251         rather than static method.
1252         (Target_x86_64::plt_entry_size): Likewise.
1253         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1254         rather than plt_entry_size variable.  Move guts of PLT filling to...
1255         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1256         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1257         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1258
1259         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1260         additional argument for the section alignment.
1261         Don't do add_eh_frame_for_plt here.
1262         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1263         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1264         variable.
1265         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1266         method.
1267         (Output_data_plt_i386::get_plt_entry_size): Call it.
1268         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1269         (Output_data_plt_i386::add_eh_frame): New method to call it.
1270         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1271         method.
1272         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1273         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1274         method.
1275         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1276         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1277         method instead of plt_entry_size.
1278         (Output_data_plt_i386::plt_entry_size)
1279         (Output_data_plt_i386::plt_eh_frame_fde_size)
1280         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1281         (Output_data_plt_i386_standard): ... here, new class.
1282         (Output_data_plt_i386_exec): New class.
1283         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1284         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1285         (Output_data_plt_i386::exec_plt_entry): Move to ...
1286         (Output_data_plt_i386_exec::plt_entry): ... here.
1287         (Output_data_plt_i386_dyn): New class.
1288         (Output_data_plt_i386::first_plt_entry): Move to ...
1289         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1290         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1291         (Output_data_plt_i386_dyn::plt_entry): ... here.
1292         (Target_i386::Target_i386): Take optional argument for the Target_info
1293         pointer to use.
1294         (Target_i386::do_make_data_plt): New virtual method.
1295         (Target_i386::make_data_plt): New method to call it.
1296         (Target_i386::make_plt_section): Use that.
1297         Call this->plt_->add_eh_frame method here.
1298         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1299         rather than plt_entry_size variable.
1300         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1301         (Output_data_plt_i386::address_for_local): Likewise.
1302         (Output_data_plt_i386::do_write): Likewise.
1303         Move guts of PLT filling to...
1304         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1305         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1306         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1307         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1308
1309 2012-05-01  Cary Coutant  <ccoutant@google.com>
1310
1311         * dwarf_reader.cc (Dwarf_die::read_attributes)
1312         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1313         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1314         * reduced_debug_output.cc
1315         (Output_reduced_debug_info_section::get_die_end): Remove
1316         DW_FORM_GNU_ref_index.  Add default case.
1317
1318 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1319
1320         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1321         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1322         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1323         DW_AT_high_pc as offset from DW_AT_low_pc.
1324
1325         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1326         * testsuite/Makefile.in: Regenerate.
1327         * testsuite/gdb_index_test_3.c: New test source file.
1328         * testsuite/gdb_index_test_3.sh: New test source file.
1329
1330 2012-04-25  Ian Lance Taylor  <iant@google.com>
1331
1332         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1333         pointer.
1334         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1335         as a class, not a struct.
1336         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1337         (Target_arm::apply_cortex_a8_workaround): Likewise.
1338         * gc.h: Declare Reloc_types as a struct, not a class.
1339         * object.h: Declare Symbols_data as a struct.
1340         * reloc.h: Declare Read_relocs_data as a struct.
1341         * target.h: Declare Relocate_info as a struct.
1342
1343 2012-04-24  David S. Miller  <davem@davemloft.net>
1344
1345         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1346         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1347         and R_SPARC_WPLT30.
1348
1349 2012-04-24  Cary Coutant  <ccoutant@google.com>
1350
1351         * incremental-dump.cc (find_input_containing_global): Replace
1352         magic number with symbolic constant.
1353         (dump_incremental_inputs): Update version number.
1354         * incremental.cc (Output_section_incremental_inputs): Update version
1355         number; import symbolic constants from Incremental_inputs_reader.
1356         (Incremental_inputs::create_data_sections): Align relocations
1357         section correctly for 64-bit targets.
1358         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1359         constants; add padding.
1360         (Output_section_incremental_inputs::write_header): Add assert for
1361         header_size.
1362         (Output_section_incremental_inputs::write_input_files): Add assert
1363         for input_entry_size.
1364         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1365         add assert for object_info_size, input_section_entry_size,
1366         global_sym_entry_size.
1367         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1368         for data structure sizes; use them.
1369         (Incremental_input_entry_reader): Import symbolic constants from
1370         Incremental_inputs_reader; use them.
1371
1372 2012-04-23  David S. Miller  <davem@davemloft.net>
1373
1374         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1375         and elf_flags_set_.
1376         (Target_sparc::Target_sparc): Initialize new fields.
1377         (Target_sparc::do_make_elf_object): New function.
1378         (Target_sparc::do_adjust_elf_header): New function.
1379
1380 2012-04-23  Cary Coutant  <ccoutant@google.com>
1381
1382         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1383         CU range table of gdb index.
1384
1385 2012-04-20  David S. Miller  <davem@davemloft.net>
1386
1387         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1388         instead of false.
1389
1390 2012-04-16  David S. Miller  <davem@davemloft.net>
1391
1392         * sparc.cc (Target_sparc::got_address): New function.
1393         (Sparc_relocate_functions::gdop_hix22): New function.
1394         (Sparc_relocate_functions::gdop_lox10): New function.
1395         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1396         relocs.
1397         (Target_sparc::Scan::local): Likewise if the global symbol is not
1398         preemptible and is not IFUNC.
1399         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1400         transformations for local and non-preemptible non-IFUNC global
1401         symbols.
1402
1403         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1404         writing out 64-bit part of ranges.
1405
1406         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1407         -fpic and -fpie respectively.
1408         * Makefile.in: Regenerate.
1409
1410         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1411         (Target_sparc::Target_sparc): Initialize new field.
1412         (Target_sparc::do_plt_section_for_global): New function.
1413         (Target_sparc::do_plt_section_for_local): New function.
1414         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1415         (Target_sparc::make_plt_section): New function, broken out of
1416         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1417         (Target_sparc::make_plt_entry): Call make_plt_section.
1418         (Target_sparc::make_local_ifunc_plt_entry): New function.
1419         (Target_sparc::rela_ifunc_section): New function.
1420         (Target_sparc::plt_section): Remove const.
1421         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1422         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1423         and ifunc_count_ fields.
1424         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1425         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1426         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1427         (Output_data_plt_sparc::rela_ifunc): New function.
1428         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1429         (Output_data_plt_sparc::has_ifunc_section): New function.
1430         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1431         (Output_data_plt_sparc::address_for_global): New function.
1432         (Output_data_plt_sparc::address_for_local): New function.
1433         (Output_data_plt_sparc::plt_index_to_offset): New function.
1434         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1435         and entry_count.
1436         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1437         entry_count.
1438         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1439         R_SPARC_JMP_IREL to switch.
1440         (Target_sparc::Scan::check_non_pic): Likewise.
1441         (Target_sparc::Scan::local): Handle IFUNC symbols.
1442         (Target_sparc::Scan::local): Likewise.
1443         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1444         and plt_address_for_local.
1445         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1446         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1447
1448         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1449         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1450         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1451         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1452         global relocs too.
1453         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1454         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1455         calls.
1456         * sparc.cc (Target_sparc::Scan::global): Likewise.
1457         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1458
1459 2012-04-16  Cary Coutant  <ccoutant@google.com>
1460
1461         * archive.cc (Library_base::should_include_member): Check for
1462         --export-dynamic-symbol.
1463         * options.h (class General_options): Add --export-dynamic-symbol.
1464         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1465         --export-dynamic-symbol.
1466         (Symbol_table::gc_mark_undef_symbols): Likewise.
1467         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1468
1469 2012-04-12  David S. Miller  <davem@davemloft.net>
1470
1471         * sparc.cc (Reloc::wdisp10): New relocation method.
1472         (Reloc::h34): Likewise.
1473         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1474         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1475         R_SPARC_WDISP10.
1476         (Target_sparc::Scan::local): Likewise.
1477         (Target_sparc::Scan::global): Likewise.
1478         (Target_sparc::Relocate::relocate): Likewise.
1479
1480 2012-04-09  Cary Coutant  <ccoutant@google.com>
1481
1482         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1483         low_pc == 0.
1484
1485 2012-04-06  Ian Lance Taylor  <iant@google.com>
1486
1487         * timer.cc: #include <unistd.h>.
1488
1489 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1490
1491         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1492         * config.in: Regenerate.
1493         * configure: Regenerate.
1494
1495 2012-04-05  Nick Clifton  <nickc@redhat.com>
1496
1497         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1498         (AM_LC_MESSAGES): Add.
1499         * aclocal.m4: Regenerate.
1500         * config.in: Regenerate.
1501         * configure: Regenerate.
1502
1503 2012-03-21  Cary Coutant  <ccoutant@google.com>
1504
1505         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1506         * Makefile.in: Regenerate.
1507         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1508         (Sized_elf_reloc_mapper::symbol_section): New function.
1509         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1510         (make_elf_reloc_mapper): New function.
1511         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1512         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1513         (Dwarf_abbrev_table::do_get_abbrev): New function.
1514         (Dwarf_ranges_table::read_ranges_table): New function.
1515         (Dwarf_ranges_table::read_range_list): New function.
1516         (Dwarf_pubnames_table::read_section): New function.
1517         (Dwarf_pubnames_table::read_header): New function.
1518         (Dwarf_pubnames_table::next_name): New function.
1519         (Dwarf_die::Dwarf_die): New function.
1520         (Dwarf_die::read_attributes): New function.
1521         (Dwarf_die::skip_attributes): New function.
1522         (Dwarf_die::set_name): New function.
1523         (Dwarf_die::set_linkage_name): New function.
1524         (Dwarf_die::attribute): New function.
1525         (Dwarf_die::string_attribute): New function.
1526         (Dwarf_die::int_attribute): New function.
1527         (Dwarf_die::uint_attribute): New function.
1528         (Dwarf_die::ref_attribute): New function.
1529         (Dwarf_die::child_offset): New function.
1530         (Dwarf_die::sibling_offset): New function.
1531         (Dwarf_info_reader::check_buffer): New function.
1532         (Dwarf_info_reader::parse): New function.
1533         (Dwarf_info_reader::do_parse): New function.
1534         (Dwarf_info_reader::do_read_string_table): New function.
1535         (Dwarf_info_reader::lookup_reloc): New function.
1536         (Dwarf_info_reader::get_string): New function.
1537         (Dwarf_info_reader::visit_compilation_unit): New function.
1538         (Dwarf_info_reader::visit_type_unit): New function.
1539         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1540         Sized_elf_reloc_mapper.
1541         (Sized_dwarf_line_info::symbol_section): Remove function.
1542         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1543         (Sized_dwarf_line_info::read_line_mappings): Remove object
1544         parameter, adjust callers.
1545         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1546         * dwarf_reader.h: Include <sys/types.h>.
1547         (class Track_relocs): Remove forward declaration.
1548         (class Elf_reloc_mapper): New class.
1549         (class Sized_elf_reloc_mapper): New class.
1550         (class Dwarf_abbrev_table): New class.
1551         (class Dwarf_range_list): New class.
1552         (class Dwarf_ranges_table): New class.
1553         (class Dwarf_pubnames_table): New class.
1554         (class Dwarf_die): New class.
1555         (class Dwarf_info_reader): New class.
1556         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1557         (Sized_dwarf_line_info::symbol_section): Remove member function.
1558         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1559         base class.
1560         * gdb-index.cc: New source file.
1561         * gdb-index.h: New source file.
1562         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1563         and .debug_types sections, call Layout::add_to_gdb_index.
1564         (Sized_relobj_incr::do_section_name): Implement.
1565         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1566         return type; Implement.
1567         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1568         return type.
1569         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1570         parameter list and return type.
1571         (Sized_incr_dynobj::do_section_contents): Likewise.
1572         * layout.cc: Include gdb-index.h.
1573         (Layout::Layout): Initialize gdb_index_data_.
1574         (Layout::init_fixed_output_section): Check for .gdb_index section.
1575         (Layout::add_to_gdb_index): New function. Instantiate.
1576         * layout.h: Add forward declaration for class Gdb_index.
1577         (Layout::add_to_gdb_index): New member function.
1578         (Layout::gdb_index_data_): New data member.
1579         * main.cc: Include gdb-index.h.
1580         (main): Print statistics for gdb index.
1581         * object.cc (Object::section_contents): Move code into
1582         do_section_contents.
1583         (need_decompressed_section): Check for sections needed when building
1584         gdb index.
1585         (build_compressed_section_map): Likewise.
1586         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1587         gdb index.
1588         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1589         sections; call Layout::add_to_gdb_index.
1590         (Sized_relobj_file::do_decompressed_section_contents): Call
1591         do_section_contents directly.
1592         * object.h (Object::do_section_contents): Adjust parameter list and
1593         return type.
1594         (Object::do_decompressed_section_contents): Call do_section_contents
1595         directly.
1596         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1597         return type.
1598         * options.h (class General_options): Add --gdb-index option.
1599         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1600         list and return type.
1601         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1602         * reloc.h (Track_relocs::checkpoint): New function.
1603         (Track_relocs::reset): New function.
1604
1605         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1606         New test cases.
1607         * testsuite/Makefile.in: Regenerate.
1608         * testsuite/gdb_index_test.cc: New test source file.
1609         * testsuite/gdb_index_test_1.sh: New test source file.
1610         * testsuite/gdb_index_test_2.sh: New test source file.
1611
1612 2012-03-19  Doug Kwan  <dougkwan@google.com>
1613
1614         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1615         (Target_arm::do_finalize_sections): Remove code which defines
1616         __exidx_start and __exidx_end.  Make symbol table parameter
1617         anonymous as it is not used.
1618         * gold.cc (queue_middle_tasks): Call target hook to define any
1619         target-specific symbols.
1620         * target.h (Target::define_standard_symbols): New method.
1621         (Target::do_define_standard_symbols): Same.
1622         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1623         * testsuite/Makefile.in: Regenerate.
1624         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1625         and __exidx_end.
1626         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1627         relocations are generated for __exidx_start and __exidx_end.
1628
1629 2012-03-16  Doug Kwan  <dougkwan@google.com>
1630
1631         * testsuite/Makefile.am: Disable test initpri3b.
1632         * testsuite/Makefile.in: Regenerate.
1633
1634 2012-03-15  Doug Kwan  <dougkwan@google.com>
1635
1636         * arm.cc (Target_arm::got_section): Make .got section read-only
1637         if -z now is given.
1638
1639 2012-03-15  Ian Lance Taylor  <iant@google.com>
1640
1641         PR gold/13850
1642         * layout.cc (Layout::make_output_section): Correctly mark
1643         SHT_INIT_ARRAY, et. al., as relro.
1644
1645 2012-03-14  Doug Kwan  <dougkwan@google.com>
1646
1647         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1648         dynamic relocations for protected symbols in shared objects.
1649
1650 2012-03-13  Ian Lance Taylor  <iant@google.com>
1651
1652         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1653         keep the larger alignment.
1654
1655 2012-03-12  Cary Coutant  <ccoutant@google.com>
1656
1657         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1658         handling of DW_LNE_define_file.
1659
1660 2012-03-12  Cary Coutant  <ccoutant@google.com>
1661
1662         * reduced_debug_output.cc
1663         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1664         codes to switch.
1665
1666 2012-02-29  Cary Coutant  <ccoutant@google.com>
1667
1668         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1669
1670 2012-02-29  Cary Coutant  <ccoutant@google.com>
1671
1672         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1673         Call Object::decompressed_section_contents.
1674         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1675         New dtor.
1676         (Sized_dwarf_line_info::buffer_start_): New data member.
1677         * merge.cc (Output_merge_data::do_add_input_section): Call
1678         Object::decompressed_section_contents.
1679         (Output_merge_string::do_add_input_section): Likewise.
1680         * object.cc (need_decompressed_section): New function.
1681         (build_compressed_section_map): Decompress sections needed later.
1682         (Sized_relobj_file::do_decompressed_section_contents): New function.
1683         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1684         * object.h (Object::decompressed_section_contents): New function.
1685         (Object::discard_decompressed_sections): New function.
1686         (Object::do_decompressed_section_contents): New function.
1687         (Object::do_discard_decompressed_sections): New function.
1688         (Compressed_section_info): New type.
1689         (Compressed_section_map): Include decompressed section contents.
1690         (Sized_relobj_file::do_decompressed_section_contents): New function.
1691         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1692
1693 2012-02-16  Cary Coutant  <ccoutant@google.com>
1694
1695         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1696         * testsuite/Makefile.in: Regenerate.
1697
1698 2012-02-14  Cary Coutant  <ccoutant@google.com>
1699
1700         * options.cc (General_options::finalize): Disallow -pie and -static.
1701
1702 2012-02-03  Doug Kwan  <dougkwan@google.com>
1703
1704         * arm.cc (Arm_relocate_functions::abs8,
1705         Arm_relocate_functions::abs16): Use
1706         Bits::has_signed_unsigned_overflow32.
1707         (Arm_relocate_functions::thm_abs8): Correct range of
1708         overflow check.
1709         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1710         in assertions.
1711
1712 2012-02-02  Doug Kwan  <dougkwan@google.com>
1713
1714         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1715         position independent outputs, not just shared objects.
1716
1717 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1718
1719         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1720         * configure: Regenerated.
1721
1722 2012-01-27  Ian Lance Taylor  <iant@google.com>
1723
1724         * reloc.h (Bits): New class with static functions, copied from
1725         namespace utils in arm.cc.
1726         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1727         instead.
1728
1729 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1730
1731         * incremental.cc (write_info_blocks): Correct relocation offset.
1732
1733 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1734
1735         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1736         (Relocate::tls_gd_to_le): Likewise.
1737
1738 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1739
1740         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1741
1742 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1743
1744         * configure.ac: Check if -mcmodel=medium works.
1745         * configure: Regenerated.
1746
1747 2012-01-24  Cary Coutant  <ccoutant@google.com>
1748
1749         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1750         definition and ...
1751         (read_unsigned_LEB_128_x): ... this new function.
1752         (read_signed_LEB_128): Replaced with inline definition and ...
1753         (read_signed_LEB_128_x): ... this new function.
1754         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1755         (read_unsigned_LEB_128): Add inline definition.
1756         (read_signed_LEB_128_x): New function.
1757         (read_signed_LEB_128): Add inline definition.
1758         * testsuite/Makefile.am (leb128_unittest): New unit test.
1759         * testsuite/Makefile.in: Regenerate.
1760         * testsuite/leb128_unittest.cc: New unit test.
1761
1762 2012-01-23  Ian Lance Taylor  <iant@google.com>
1763
1764         PR gold/13617
1765         * i386.cc (Target_i386::do_code_fill): When using a jmp
1766         instruction, pad with nop instructions.
1767         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1768
1769 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1770
1771         * x86_64.cc (gc_process_relocs): Add typename on types used in
1772         template.
1773         (scan_relocs): Likewise.
1774         (relocate_section): Likewise.
1775         (apply_relocation): Likewise.
1776
1777 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1778
1779         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1780         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1781         under x32.
1782
1783 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1784
1785         * x86_64.cc: Initial support for x32.
1786
1787 2012-01-03  Cary Coutant  <ccoutant@google.com>
1788
1789         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1790         Use abstract base class for GOT.
1791         * gold/output.h (class Output_data_got_base): New abstract base class.
1792         (class Output_data_got): Derive from new base class, adjust ctors.
1793         (Output_data_got::reserve_slot): Make virtual; rename to
1794         do_reserve_slot; Adjust callers.
1795         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1796         pointer to abstract base class.
1797         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1798
1799 2011-12-18  Ian Lance Taylor  <iant@google.com>
1800
1801         * object.h (Relobj::local_symbol_value): New function.
1802         (Relobj::local_plt_offset): New function.
1803         (Relobj::local_has_got_offset): New function.
1804         (Relobj::local_got_offset): New function.
1805         (Relobj::set_local_got_offset): New function.
1806         (Relobj::do_local_symbol_value): New pure virtual function.
1807         (Relobj::do_local_plt_offset): Likewise.
1808         (Relobj::do_local_has_got_offset): Likewise.
1809         (Relobj::do_local_got_offset): Likewise.
1810         (Relobj::do_set_local_got_offset): Likewise.
1811         (Sized_relobj::do_local_has_got_offset): Rename from
1812         local_has_got_offset.
1813         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1814         (Sized_relobj::do_set_local_got_offset): Rename from
1815         set_local_got_offset.
1816         (Sized_relobj_file::do_local_plt_offset): Rename from
1817         local_plt_offset.
1818         (Sized_relobj_file::do_local_symbol_value): New function.
1819         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1820         local_plt_offset.
1821         * output.cc (Output_data_got::Got_entry::write): Change object to
1822         Relobj.  Use local_symbol_value.
1823         (Output_data_got::add_global_with_rel): Change rel_dyn to
1824         Output_data_reloc_generic*.  Use add_global_generic.
1825         (Output_data_got::add_global_with_rela): Remove.  Change all
1826         callers to use add_global_with_rel.
1827         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1828         Output_data_reloc_generic*.  Use add_global_generic.
1829         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1830         callers to use add_global_pair_with_rel.
1831         (Output_data_got::add_local): Change object to Relobj*.
1832         (Output_data_got::add_local_plt): Likewise.
1833         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1834         change rel_dyn to Output_data_reloc_generic*.  Use
1835         add_local_generic.
1836         (Output_data_got::add_local_with_rela): Remove.  Change all
1837         callers to use all_local_with_rel.
1838         (Output_data_got::add_local_pair_with_rel): Change object to
1839         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1840         add_output_section_generic.
1841         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1842         callers to use add_local_pair_with_rel.
1843         (Output_data_got::reserve_local): Change object to Relobj*.
1844         * output.h: (class Output_data_reloc_generic): Add pure virtual
1845         declarations for add_global_generic, add_local_generic,
1846         add_output_section_generic.
1847         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1848         functions for Output_data_reloc_generic.  Update declarations for
1849         changes listed in output.cc.
1850         (class Output_data_got): Change template parameter to got_size.
1851         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1852         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1853         function.
1854         (Sized_relobj_incr::do_local_plt_offset): New function.
1855         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1856         add_global_generic.
1857
1858 2011-12-17  Cary Coutant  <ccoutant@google.com>
1859
1860         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1861         * resolve.cc (Symbol_table::resolve): Likewise.
1862         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1863         arrays.
1864         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1865
1866 2011-12-16  Ian Lance Taylor  <iant@google.com>
1867
1868         * output.h (Output_data_reloc_generic::add): Only call
1869         add_dynamic_reloc if this is a dynamic reloc section.
1870
1871 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1872
1873         PR gold/13505
1874         * target-reloc.h (apply_relocation): Replace <64, false> with
1875         <size, big_endian>.
1876
1877 2011-11-25  Nick Clifton  <nickc@redhat.com>
1878
1879         * po/it.po: New Italian translation.
1880
1881 2011-11-17  Sterling Augustine  <saugustine@google.com>
1882
1883         * script.cc (script_include_directive): Implement.
1884         (read_script_file): New local variables name and search_path. Update
1885         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1886         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1887         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1888
1889 2011-11-11  Sterling Augustine  <saugustine@google.com>
1890
1891         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1892         (file_or_sections_cmd): Likewise.
1893
1894 2011-11-11  Doug Kwan  <dougkwan@google.com>
1895
1896         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1897         if --just-symbols is given.
1898
1899 2011-11-10  Doug Kwan  <dougkwan@google.com>
1900
1901         PR gold/13362
1902         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1903         when processing data relocs.
1904         * reloc.h (Relocate_functions::rel_unaligned): New method.
1905         (Relocate_functions::pcrel_unaligned): Ditto.
1906         (Relocate_functions::rel32_unaligned): Ditto.
1907         (Relocate_functions::pcrel32_unaligned): Ditto.
1908
1909 2011-11-09  Doug Kwan  <dougkwan@google.com>
1910
1911         PR gold/13362
1912         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1913         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1914         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1915         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1916         (Relocate_functions::rel_unaligned): New.
1917         (Relocate_functions::rel32_unaligned): New.
1918         * target-reloc.h (relocate_for_relocatable): Add code to handle
1919         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1920         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1921         arm_unaligned_reloc_r): New targets.
1922         * testsuite/Makefile.in: Regenerate.
1923         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1924         linking.
1925
1926 2011-11-02  Ian Lance Taylor  <iant@google.com>
1927
1928         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1929         NATIVE_LINKER.
1930         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1931         * options.cc (General_options::finalize): Use library search path
1932         from configure script if specified.  If not native and no sysroot,
1933         only search TOOLLIBDIR.
1934         * options.h (Search_directory::Search_directory): Change name to
1935         const std::string&.
1936         (General_options::add_to_library_path_with_sysroot): Change arg to
1937         const std::string&.
1938         * configure, Makefile.in, config.in: Rebuild.
1939
1940 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1941
1942         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1943         we are working around the ARM1176 Erratum.
1944         * options.h (General_options::fix_arm1176): Add option.
1945         * testsuite/Makefile.am: Add testcases, and keep current ones
1946         working.
1947         * testsuite/Makefile.in: Regenerate.
1948         * testsuite/arm_fix_1176.s: New file.
1949         * testsuite/arm_fix_1176.sh: Likewise.
1950
1951 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1952
1953         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1954         may_use_blx_.
1955         (Target_arm::may_use_blx): Remove method.
1956         (Target_arm::set_may_use_blx): Likewise.
1957         (Target_arm::may_use_v4t_interworking): New method.
1958         (Target_arm::may_use_v5t_interworking): Likewise.
1959         (Target_arm::may_use_blx_): Remove member variable.
1960         (Arm_relocate_functions::arm_branch_common): Check for v5T
1961         interworking.
1962         (Arm_relocate_functions::thumb_branch_common): Likewise.
1963         (Reloc_stub::stub_type_for_reloc): Likewise.
1964         (Target_arm::do_finalize_sections): Correct interworking checks.
1965         * testsuite/Makefile.am: Add new tests.
1966         * testsuite/Makefile.in: Regenerate.
1967         * testsuite/arm_farcall_arm_arm.s: New test.
1968         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1969         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1970         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1971         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1972         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1973         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1974         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1975
1976 2011-10-31  Cary Coutant  <ccoutant@google.com>
1977
1978         PR gold/13023
1979         * expression.cc (Expression::eval_with_dot): Add
1980         is_section_dot_assignment parameter.
1981         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1982         absolute and assigning to dot within a section.
1983         * script-sections.cc
1984         (Output_section_element_assignment::set_section_addresses): Pass
1985         dot_section to set_if_absolute.
1986         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1987         as is_section_dot_assignment flag to eval_with_dot.
1988         (Output_section_element_dot_assignment::set_section_addresses):
1989         Likewise.
1990         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1991         parameter.  Also set value if relative to dot_section; set the
1992         symbol's output_section.
1993         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1994         parameter.  Adjust all callers.
1995         (Expression::eval_maybe_dot): Likewise.
1996         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1997         Adjust all callers.
1998         * testsuite/script_test_2.t: Test assignment of an absolute value
1999         to dot within an output section element.
2000
2001 2011-10-31  Cary Coutant  <ccoutant@google.com>
2002
2003         * options.h (class General_options): Add --[no-]gnu-unique options.
2004         * symtab.cc (Symbol_table::sized_write_globals): Convert
2005         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2006
2007 2011-10-31  Cary Coutant  <ccoutant@google.com>
2008
2009         PR gold/13359
2010         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2011         unnecessary assertion.
2012         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2013
2014 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2015
2016         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2017         gc_mark_symbol.
2018         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2019         gc_mark_symbol.
2020         Change to just keep the section associated with symbol.
2021         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2022         they are externally visible and --export-dynamic is turned on.
2023         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2024
2025 2011-10-19  Ian Lance Taylor  <iant@google.com>
2026
2027         PR gold/13163
2028         * script-sections.cc
2029         (Output_section_element_dot_assignment::needs_output_section): New
2030         function.
2031
2032 2011-10-19  Ian Lance Taylor  <iant@google.com>
2033
2034         PR gold/13204
2035         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2036         --section-start option was seen.
2037         * options.h (General_options::any_section_start): New function.
2038
2039 2011-10-18  David S. Miller  <davem@davemloft.net>
2040
2041         PR binutils/13301
2042         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2043         member to track relocation locations that have moved during TLS
2044         reloc optimizations.
2045         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2046         (Target_sparc::Relocate::relocate): Adjust view down by 4
2047         bytes if it matches reloc_adjust_addr_.
2048         (Target_sparc::Relocate::relocate_tls): Always move the
2049         __tls_get_addr call delay slot instruction forward 4 bytes when
2050         performing relaxation.
2051
2052 2011-10-18  Cary Coutant  <ccoutant@google.com>
2053
2054         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2055         (Output_file::map_no_anonymous): Check for non-zero
2056         return code from posix_fallocate.
2057
2058 2011-10-17  Cary Coutant  <ccoutant@google.com>
2059
2060         PR gold/13245
2061         * plugin.cc (is_visible_from_outside): Check for symbols
2062         referenced from dynamic objects.
2063         * resolve.cc (Symbol_table::resolve): Don't count references
2064         from dynamic objects as references from real ELF files.
2065         * testsuite/plugin_test_2.sh: Adjust expected result.
2066
2067 2011-10-17  Cary Coutant  <ccoutant@google.com>
2068
2069         * gold.cc: Include timer.h.
2070         (queue_middle_tasks): Stamp time.
2071         (queue_final_tasks): Likewise.
2072         * main.cc (main): Store timer in parameters.  Print timers
2073         for each pass.
2074         * parameters.cc (Parameters::Parameters): Initialize timer_.
2075         (Parameters::set_timer): New function.
2076         (set_parameters_timer): New function.
2077         * parameters.h (Parameters::set_timer): New function.
2078         (Parameters::timer): New function.
2079         (Parameters::timer_): New data member.
2080         (set_parameters_timer): New function.
2081         * timer.cc (Timer::stamp): New function.
2082         (Timer::get_pass_time): New function.
2083         * timer.h (Timer::stamp): New function.
2084         (Timer::get_pass_time): New function.
2085         (Timer::pass_times_): New data member.
2086
2087 2011-10-17  Cary Coutant  <ccoutant@google.com>
2088
2089         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2090         task for members of lib groups.
2091
2092 2011-10-17  Cary Coutant  <ccoutant@google.com>
2093
2094         PR gold/13288
2095         * fileread.cc (File_read::find_view): Add assert.
2096         (File_read::make_view): Move bounds check (replace with assert)...
2097         (File_read::find_or_make_view): ... to here.
2098
2099 2011-10-12  Cary Coutant  <ccoutant@google.com>
2100
2101         * output.cc (Output_file::open_base_file): Handle case where
2102         ::read returns less than requested size.
2103
2104 2011-10-10  Cary Coutant  <ccoutant@google.com>
2105
2106         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2107         Initialize defined_count_.
2108         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2109         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2110         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2111         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2112         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2113         * incremental.h (Sized_relobj_incr::defined_count_): New data
2114         member.
2115         (Sized_incr_dynobj::defined_count_): New data member.
2116         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2117         Return zeroes instead of internal error.
2118
2119 2011-10-10  Cary Coutant  <ccoutant@google.com>
2120
2121         PR gold/13249
2122         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2123         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2124         * output.h (class Output_reloc): Add use_plt_offset flag.
2125         (Output_reloc::type_): Adjust size of bit field.
2126         (Output_reloc::use_plt_offset_): New bit field.
2127         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2128         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2129         flag.  Adjust all callers.
2130         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2131         creating RELATIVE relocations.
2132
2133 2011-10-10  Nick Clifton  <nickc@redhat.com>
2134
2135         * po/es.po: Updated Spanish translation.
2136         * po/fi.po: Updated Finnish translation.
2137
2138 2011-10-03   Diego Novillo  <dnovillo@google.com>
2139
2140         * options.cc (parse_uint): Fix dereference of RETVAL.
2141
2142 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2143
2144         * layout.h (section_order_map_): New member.
2145         (get_section_order_map): New member function.
2146         * output.cc (Output_section::add_input_section): Check for patterns
2147         only when --section-ordering-file is specified.
2148         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2149         output_sections have been formed.
2150         * layout.cc (Layout_Layout): Initialize section_order_map_.
2151         * plugin.cc (update_section_order): Store order in order_map. Do not
2152         update the order.
2153         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2154         * testsuite/Makefile.in: Regenerate.
2155         * testsuite/plugin_section_order.c: New file.
2156         * testsuite/plugin_final_layout.cc: New file.
2157         * testsuite/plugin_final_layout.sh: New file.
2158
2159 2011-09-29  Cary Coutant  <ccoutant@google.com>
2160
2161         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2162         Check for NULL.
2163         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2164         symbols during incremental update.
2165         (Symbol_table::add_from_dynobj): Likewise.
2166
2167 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2168             Ian Lance Taylor  <iant@google.com>
2169
2170         * symtab.cc (Symbol_table::define_special_symbol): Always
2171         canonicalize version string.
2172
2173 2011-09-26  Cary Coutant  <ccoutant@google.com>
2174
2175         * gold.cc (queue_initial_tasks): Move option checks ...
2176         * options.cc (General_options::finalize): ... to here. Disable
2177         some options; make others fatal.
2178
2179 2011-09-26  Cary Coutant  <ccoutant@google.com>
2180
2181         gcc PR lto/47247
2182         * plugin.cc (get_symbols_v2): New function.
2183         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2184         (is_referenced_from_outside): New function.
2185         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2186         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2187         (get_symbols): Pass version parameter.
2188         (get_symbols_v2): New function.
2189         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2190         parameter.
2191         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2192         (onload): Add LDPT_GET_SYMBOLS_V2.
2193         (all_symbols_read_hook): Use get_symbols_v2; check for
2194         LDPR_PREVAILING_DEF_IRONLY_EXP.
2195         * testsuite/plugin_test_3.sh: Update expected results.
2196
2197 2011-09-23  Simon Baldwin  <simonb@google.com>
2198
2199         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2200         configuration options.
2201         * configure: Regenerate.
2202         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2203         * Makefile.in: Regenerate.
2204         * testsuite/Makefile.in: Regenerate.
2205
2206 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2207
2208         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2209
2210 2011-09-19  Cary Coutant  <ccoutant@google.com>
2211
2212         * incremental.cc (can_incremental_update): Fix typo in comment.
2213         * incremental.h (can_incremental_update): Likewise.
2214
2215 2011-09-18  Cary Coutant  <ccoutant@google.com>
2216
2217         * incremental.cc (can_incremental_update): New function.
2218         * incremental.h (can_incremental_update): New function.
2219         * layout.cc (Layout::init_fixed_output_section): Call it.
2220         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2221         * object.cc (Sized_relobj_file::do_layout): Call
2222         can_incremental_update.
2223
2224 2011-09-13  Cary Coutant  <ccoutant@google.com>
2225
2226         * configure.ac: Check for glibc support for gnu_indirect_function
2227         support with static linking, setting automake conditional
2228         IFUNC_STATIC.
2229         * Makefile.in: Regenerate.
2230         * configure: Regenerate.
2231
2232         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2233         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2234         for IFUNC_STATIC.
2235         * testsuite/Makefile.in: Regenerate.
2236
2237 2011-09-13  Cary Coutant  <ccoutant@google.com>
2238
2239         * incremental.cc (Sized_relobj_incr::do_layout): Call
2240         report_comdat_group for kept comdat sections.
2241         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2242         * testsuite/Makefile.in: Regenerate.
2243         * testsuite/incr_comdat_test_1.cc: New source file.
2244         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2245         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2246         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2247
2248 2011-09-13  Ian Lance Taylor  <iant@google.com>
2249
2250         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2251         variable external_symbols_offset.
2252
2253 2011-09-12  Ian Lance Taylor  <iant@google.com>
2254
2255         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2256         triggered if object has no symbols.
2257
2258 2011-09-09  David S. Miller  <davem@davemloft.net>
2259
2260         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2261         (Output_fill_debug_line::do_write): Likewise.
2262
2263 2011-08-29  Cary Coutant  <ccoutant@google.com>
2264
2265         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2266         casts to match formatting specs.
2267         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2268
2269 2011-08-26  Cary Coutant  <ccoutant@google.com>
2270
2271         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2272         remaining hole size when allocating.
2273         (Layout::make_output_section): Set fill methods for debug sections.
2274         * layout.h (Free_list::Free_list_node): Move from private to
2275         public.
2276         (Free_list::set_min_hole_size): New function.
2277         (Free_list::begin, Free_list::end): New functions.
2278         (Free_list::min_hole_): New data member.
2279         * output.cc: Include dwarf.h.
2280         (Output_fill_debug_info::do_minimum_hole_size): New function.
2281         (Output_fill_debug_info::do_write): New function.
2282         (Output_fill_debug_line::do_minimum_hole_size): New function.
2283         (Output_fill_debug_line::do_write): New function.
2284         (Output_section::Output_section): Initialize new data member.
2285         (Output_section::set_final_data_size): Ensure patch space is larger
2286         than minimum hole size.
2287         (Output_section::do_write): Fill holes in debug sections.
2288         * output.h (Output_fill): New class.
2289         (Output_fill_debug_info): New class.
2290         (Output_fill_debug_line): New class.
2291         (Output_section::set_free_space_fill): New function.
2292         (Output_section::free_space_fill_): New data member.
2293         * testsuite/Makefile.am (incremental_test_3): Add
2294         --incremental-patch option.
2295         (incremental_test_4): Likewise.
2296         (incremental_test_5): Likewise.
2297         (incremental_test_6): Likewise.
2298         (incremental_copy_test): Likewise.
2299         (incremental_common_test_1): Likewise.
2300         * testsuite/Makefile.in: Regenerate.
2301
2302 2011-08-26  Nick Clifton  <nickc@redhat.com>
2303
2304         * po/es.po: Updated Spanish translation.
2305
2306 2011-08-01  Cary Coutant  <ccoutant@google.com>
2307
2308         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2309         * gold/testsuite/Makefile.in: Regenerate.
2310         * gold/testsuite/justsyms_exec.c: New source file.
2311         * gold/testsuite/justsyms_lib.c: New source file.
2312
2313 2011-08-01  Cary Coutant  <ccoutant@google.com>
2314
2315         * layout.cc (Layout::set_segment_offsets): Don't realign text
2316         segment if -Ttext was specified.
2317         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2318         file type.
2319         * object.h (Sized_relobj_file::e_type): New function.
2320         (Sized_relobj_file::e_type_): New data member.
2321         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2322         base address for ET_EXEC files.
2323         * target.cc (Target::do_make_elf_object_implementation): Allow
2324         ET_EXEC files with --just-symbols option.
2325
2326 2011-07-28  Cary Coutant  <ccoutant@google.com>
2327
2328         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2329         Add thread_number parameter.
2330         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2331         * workqueue-threads.cc
2332         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2333         current thread if its thread number is greater than desired thread
2334         count.
2335         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2336         Add thread_number parameter.
2337         (Workqueue::should_cancel_thread): Likewise.
2338         (Workqueue::find_runnable_or_wait): Pass thread_number to
2339         should_cancel_thread.
2340         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2341         parameter.
2342
2343 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2344
2345         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2346         only after checking if it cannot be forced local.
2347         * symtab.h (is_externally_visible): Check if the symbol is not forced
2348         local.
2349
2350 2011-07-15  Ian Lance Taylor  <iant@google.com>
2351
2352         * options.h (class General_options): Add --print-output-format.
2353         Move -EL next to -EB, for  better --help output.
2354         * target-select.cc: Include <cstdio>, "options.h", and
2355         "parameters.h".
2356         (Target_selector::do_target_bfd_name): New function.
2357         (print_output_format): New function.
2358         * target-select.h (class Target_selector): Update declarations.
2359         (Target_selector::target_bfd_name): New function.
2360         (print_output_format): Declare.
2361         * main.cc: Include "target-select.h".
2362         (main): Handle --print-output-format.
2363         * gold.cc: Include "target-select.h".
2364         (queue_initial_tasks): Handle --print-output-format when there are
2365         no input files.
2366         * parameters.cc (parameters_force_valid_target): Give a better
2367         error message if -EB/-EL does not match target.
2368         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2369         function.
2370
2371 2011-07-15  Ian Lance Taylor  <iant@google.com>
2372
2373         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2374         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2375         (Output_data_plt_i386::do_write): Write address of .dynamic
2376         section to first entry in .got.plt section.
2377         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2378         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2379         Initialize layout_.
2380         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2381         section to first entry in .got.plt section.
2382         * layout.h (Layout::dynamic_section): New function.
2383
2384 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2385
2386         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2387         to claim_file call.
2388         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2389         input_section_position_, and input_section_glob_.
2390         (read_layout_from_file): Call function section_ordering_specified.
2391         * layout.h (is_section_ordering_specified): New function.
2392         (section_ordering_specified): New function.
2393         (section_ordering_specified_): New boolean member.
2394         * main.cc(main): Call load_plugins after layout object is defined.
2395         * output.cc (Output_section::add_input_section): Use
2396         function section_ordering_specified to check if section ordering is
2397         needed.
2398         * output.cc (Output_section::add_relaxed_input_section): Use
2399         function section_ordering_specified to check if section ordering is
2400         needed.
2401         (Output_section::update_section_layout): New function.
2402         (Output_section::sort_attached_input_sections): Check if input section
2403         must be reordered.
2404         * output.h (Output_section::update_section_layout): New function.
2405         * plugin.cc (get_section_count): New function.
2406         (get_section_type): New function.
2407         (get_section_name): New function.
2408         (get_section_contents): New function.
2409         (update_section_order): New function.
2410         (allow_section_ordering): New function.
2411         (Plugin::load): Add the new interfaces to the transfer vector.
2412         (Plugin_manager::load_plugins): New parameter.
2413         (Plugin_manager::all_symbols_read): New parameter.
2414         (Plugin_manager::claim_file): New parameter. Save the elf object for
2415         unclaimed objects.
2416         (Plugin_manager::get_elf_object): New function.
2417         (Plugin_manager::get_view): Change to directly use the bool to check
2418         if get_view is called from claim_file_hook.
2419         * plugin.h (input_objects): New function
2420         (Plugin__manager::load_plugins): New parameter.
2421         (Plugin_manager::claim_file): New parameter.
2422         (Plugin_manager::get_elf_object): New function.
2423         (Plugin_manager::in_claim_file_handler): New function.
2424         (Plugin_manager::in_claim_file_handler_): New member.
2425         (layout): New function.
2426         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2427         handler with an extra parameter. Make the elf object before calling
2428         claim_file handler.
2429         * testsuite/plugin_test.c (get_section_count): New function pointer.
2430         (get_section_type): New function pointer.
2431         (get_section_name): New function pointer.
2432         (get_section_contents): New function pointer.
2433         (update_section_order): New function pointer.
2434         (allow_section_ordering): New function pointer.
2435         (onload): Check if the new interfaces exist.
2436
2437 2011-07-13  Ian Lance Taylor  <iant@google.com>
2438
2439         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2440         relro section.
2441         * x86_64.cc (Target_x86_64::got_section): Likewise.
2442         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2443         (relro_now_test_SOURCES): New variable.
2444         (relro_now_test_DEPENDENCIES): New variable.
2445         (relro_now_test_LDFLAGS): New variable.
2446         (relro_now_test_LDADD): New variable.
2447         (relro_now_test.so): New target.
2448         * testsuite/Makefile.in: Rebuild.
2449
2450 2011-07-12  Ian Lance Taylor  <iant@google.com>
2451
2452         PR gold/12980
2453         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2454         GLOB_DAT relocation rather than a RELATIVE relocation for a
2455         protected symbol when creating a shared library.
2456         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2457         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2458         * testsuite/protected_main_1.cc (main): Test that protected
2459         function has same address.
2460
2461 2011-07-11  Ian Lance Taylor  <iant@google.com>
2462
2463         PR gold/12979
2464         * options.h (class General_options): Add -Bgroup.
2465         * options.cc (General_options::finalize): If -Bgroup is set,
2466         default to --unresolved-symbols=report-all.
2467         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2468         * target-reloc.h (issue_undefined_symbol_error): Handle
2469         --unresolved-symbols=report-all.
2470
2471 2011-07-08  Ian Lance Taylor  <iant@google.com>
2472
2473         PR gold/11985
2474         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2475         if linker script discards key sections.
2476         (Layout::create_dynamic_symtab): Likewise.
2477         (Layout::assign_local_dynsym_offsets): Likewise.
2478         (Layout::sized_create_version_sections): Likewise.
2479         (Layout::create_interp): Likewise.
2480         (Layout::finish_dynamic_section): Likewise.
2481         (Layout::set_dynamic_symbol_size): Likewise.
2482
2483 2011-07-08  Ian Lance Taylor  <iant@google.com>
2484
2485         PR gold/12386
2486         * options.h (class General_options): Add --unresolved-symbols.
2487         * target-reloc.h (issue_undefined_symbol_error): Check
2488         --unresolved-symbols.  Add comments.
2489
2490 2011-07-08  Ian Lance Taylor  <iant@google.com>
2491
2492         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2493         expression more complex.
2494
2495 2011-07-08  Ian Lance Taylor  <iant@google.com>
2496
2497         PR gold/11317
2498         * target-reloc.h (issue_undefined_symbol_error): New inline
2499         function, broken out of relocate_section.
2500         (relocate_section): Call issue_undefined_symbol_error.
2501         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2502         there is no TLS segment if we are about to issue an undefined
2503         symbol error.
2504         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2505
2506 2011-07-08  Ian Lance Taylor  <iant@google.com>
2507
2508         PR gold/12279
2509         * resolve.cc (Symbol_table::should_override): Add fromtype
2510         parameter.  Change all callers.  Give error when linking together
2511         TLS and non-TLS symbol.
2512         (Symbol_table::should_override_with_special): Add fromtype
2513         parameter.  Change all callers.
2514         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2515         there is no TLS segment if we have reported some errors.
2516         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2517
2518 2011-07-08  Ian Lance Taylor  <iant@google.com>
2519
2520         PR gold/12372
2521         * target.h (Target::plt_address_for_global): New function.
2522         (Target::plt_address_for_local): New function.
2523         (Target::plt_section_for_global): Remove.
2524         (Target::plt_section_for_local): Remove.
2525         (Target::do_plt_address_for_global): New virtual function.
2526         (Target::do_plt_address_for_local): New virtual function.
2527         (Target::do_plt_section_for_global): Remove.
2528         (Target::do_plt_section_for_local): Remove.
2529         (Target::register_global_plt_entry): Add Symbol_table and Layout
2530         parameters.
2531         * output.cc (Output_data_got::Got_entry::write): Use
2532         plt_address_for_global and plt_address_for_local.
2533         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2534         address of output section.
2535         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2536         got_irelative_, and irelative_count_ fields.  Update
2537         declarations.
2538         (Output_data_plt_i386::has_irelative_section): New function.
2539         (Output_data_plt_i386::entry_count): Add irelative_count_.
2540         (Output_data_plt_i386::set_final_data_size): Likewise.
2541         (class Target_i386): Add got_irelative_ and rel_irelative_
2542         fields.  Update declarations.
2543         (Target_i386::Target_i386): Initialize new fields.
2544         (Target_i386::do_plt_address_for_global): New function replacing
2545         do_plt_section_for_global.
2546         (Target_i386::do_plt_address_for_local): New function replacing
2547         do_plt_section_for_local.
2548         (Target_i386::got_section): Create got_irelative_.
2549         (Target_i386::rel_irelative_section): New function.
2550         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2551         fields.  Don't define __rel_iplt_{start,end}.
2552         (Output_data_plt_i386::add_entry): Add symtab and layout
2553         parameters.  Change all callers.  Use different PLT and GOT for
2554         IFUNC symbols.
2555         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2556         layout parameters.  Change all callers.  Use different PLT and
2557         GOT.
2558         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2559         (Output_data_plt_i386::rel_irelative): New function.
2560         (Output_data_plt_i386::address_for_global): New function.
2561         (Output_data_plt_i386::address_for_local): New function.
2562         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2563         IRELATIVE GOT when changing IFUNC GOT entries.
2564         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2565         reloc.
2566         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2567         if we didn't create an IRELATIVE GOT.
2568         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2569         plt_address_for_local.
2570         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2571         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2572         got_irelative_, and irelative_count_ fields.  Update
2573         declarations.
2574         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2575         Initialize new fields.  Remove symtab parameter.  Change all
2576         callers.
2577         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2578         irelative_count_.
2579         (Output_data_plt_x86_64::has_irelative_section): New function.
2580         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2581         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2582         fields.  Update declarations.
2583         (Target_x86_64::Target_x86_64): Initialize new fields.
2584         (Target_x86_64::do_plt_address_for_global): New function replacing
2585         do_plt_section_for_global.
2586         (Target_x86_64::do_plt_address_for_local): New function replacing
2587         do_plt_section_for_local.
2588         (Target_x86_64::got_section): Create got_irelative_.
2589         (Target_x86_64::rela_irelative_section): New function.
2590         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2591         all callers.  Don't create __rel_iplt_{start,end}.
2592         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2593         parameters.  Change all callers.  Use different PLT and GOT for
2594         IFUNC symbols.
2595         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2596         layout parameters.  Change all callers.  Use different PLT and
2597         GOT.
2598         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2599         parameters.  Change all callers.  Use different PLT and GOT for
2600         IFUNC symbols.
2601         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2602         (Output_data_plt_x86_64::rela_irelative): New function.
2603         (Output_data_plt_x86_64::address_for_global): New function.
2604         (Output_data_plt_x86_64::address_for_local): New function.
2605         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2606         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2607         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2608         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2609         parameters.
2610         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2611         reloc.
2612         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2613         symbols if we didn't create an IRELATIVE GOT.
2614         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2615         plt_address_for_local.
2616         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2617         * testsuite/ifuncvar1.c: New test file.
2618         * testsuite/ifuncvar2.c: New test file.
2619         * testsuite/ifuncvar3.c: New test file.
2620         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2621         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2622         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2623         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2624         * testsuite/Makefile.in: Rebuild.
2625
2626 2011-07-07  Cary Coutant  <ccoutant@google.com>
2627
2628         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2629         (two_file_test_1_ndebug.o): Likewise.
2630         (two_file_test_1b_ndebug.o): Likewise.
2631         (two_file_test_2_ndebug.o): Likewise.
2632         (two_file_test_main_ndebug.o): Likewise.
2633         (incremental_test_2): Link with no-debug versions.
2634
2635 2011-07-06  Cary Coutant  <ccoutant@google.com>
2636
2637         * gold/incremental.cc
2638         (Output_section_incremental_inputs::write_info_blocks): Check for
2639         hidden and internal symbols.
2640
2641 2011-07-06  Cary Coutant  <ccoutant@google.com>
2642
2643         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2644         Check disposition for startup file.
2645         (Incremental_inputs::report_command_line): Ignore
2646         --incremental-startup-unchanged option.
2647         * options.cc (General_options::parse_incremental_startup_unchanged):
2648         New function.
2649         (General_options::General_options): Initialize new data member.
2650         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2651         (General_options): Add --incremental-startup-unchanged option.
2652         (General_options::incremental_startup_disposition): New function.
2653         (General_options::incremental_startup_disposition_): New data member.
2654
2655 2011-07-06  Cary Coutant  <ccoutant@google.com>
2656
2657         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2658         input file index to Script_info ctor.
2659         (Sized_incremental_binary::do_file_has_changed): Find the
2660         command-line argument for files named in scripts.
2661         * incremental.h (Script_info::Script_info): New ctor
2662         with input file index.
2663         (Script_info::input_file_index): New function.
2664         (Script_info::input_file_index_): New data member.
2665         (Incremental_binary::get_library): Add const.
2666         (Incremental_binary::get_script_info): Add const.
2667         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2668         * testsuite/Makefile.am (incremental_test_5): New test case.
2669         (incremental_test_6): New test case.
2670         * testsuite/Makefile.in: Regenerate.
2671
2672 2011-07-06  Cary Coutant  <ccoutant@google.com>
2673
2674         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2675         debug output when command lines differ.
2676
2677 2011-07-06  Cary Coutant  <ccoutant@google.com>
2678
2679         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2680         --incremental-patch option.
2681         * layout.cc (Free_list::allocate): Extend allocation beyond original
2682         end if enabled.
2683         (Layout::make_output_section): Mark sections that should get
2684         patch space.
2685         * options.cc (parse_percent): New function.
2686         * options.h (parse_percent): New function.
2687         (DEFINE_percent): New macro.
2688         (General_options): Add --incremental-patch option.
2689         * output.cc (Output_section::Output_section): Initialize new data
2690         members.
2691         (Output_section::add_input_section): Print section name when out
2692         of patch space.
2693         (Output_section::add_output_section_data): Likewise.
2694         (Output_section::set_final_data_size): Add patch space when
2695         doing --incremental-full.
2696         (Output_section::do_reset_address_and_file_offset): Remove patch
2697         space.
2698         (Output_segment::set_section_list_addresses): Print debug output
2699         only if --incremental-update.
2700         * output.h (Output_section::set_is_patch_space_allowed): New function.
2701         (Output_section::is_patch_space_allowed_): New data member.
2702         (Output_section::patch_space_): New data member.
2703         * parameters.cc (Parameters::incremental_full): New function.
2704         * parameters.h (Parameters::incremental_full): New function
2705         * testsuite/Makefile.am (incremental_test_2): Add test for
2706         --incremental-patch option.
2707         * testsuite/Makefile.in: Regenerate.
2708         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2709         (t18): Remove function body.
2710
2711 2011-07-05  Doug Kwan  <dougkwan@google.com>
2712
2713         PR gold/12771
2714         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2715         Arm_Address type for relocation result.
2716         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2717         overflow check.
2718         (Arm_relocate_functions::abs32): Use unaligned access.
2719         (Arm_relocate_functions::rel32): Ditto.
2720         (Arm_relocate_functions::prel31): Ditto.
2721         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2722         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2723         static data relocations.
2724         * testsuite/Makefile.in: Regnerate.
2725         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2726
2727 2011-07-05  Ian Lance Taylor  <iant@google.com>
2728
2729         PR gold/12392
2730         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2731         symbols if necessary.
2732         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2733
2734 2011-07-05  Ian Lance Taylor  <iant@google.com>
2735
2736         PR gold/12952
2737         * resolve.cc (Symbol::override_base_with_special): Simply override
2738         version with special symbol version, ignoring previous version.
2739
2740 2011-07-05  Ian Lance Taylor  <iant@google.com>
2741
2742         * object.cc (Sized_relobj_file::include_section_group): Add
2743         information to comment about signature location.
2744
2745 2011-07-02  Ian Lance Taylor  <iant@google.com>
2746
2747         PR gold/12957
2748         * options.h (class General_options): Add -f and -F.
2749         * options.cc (General_options::finalize): Fatal error if -f/-F
2750         are used without -shared.
2751         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2752
2753 2011-07-02  Ian Lance Taylor  <iant@google.com>
2754
2755         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2756
2757 2011-07-01  Ian Lance Taylor  <iant@google.com>
2758
2759         PR gold/12525
2760         PR gold/12952
2761         * resolve.cc (Symbol::override_base_with_special): Don't override
2762         the version if the overriding symbol has a different name.
2763         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2764         all callers.  If we give an error about an undefined version,
2765         define the base version if necessary.
2766         * dynobj.h (class Versions): Update declaration.
2767         * testsuite/weak_alias_test_5.cc: New file.
2768         * testsuite/weak_alias_test.script: New file.
2769         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2770         and versioned_alias have the right value, and call t2.
2771         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2772         weak_alias_test_5.so.
2773         (weak_alias_test_LDADD): Likewise.
2774         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2775         * testsuite/Makefile.in: Rebuild.
2776
2777 2011-07-01  Ian Lance Taylor  <iant@google.com>
2778
2779         PR gold/12525
2780         * options.h (class General_options): Support -z notext.
2781         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2782         -Wl,-z,notext.
2783         (two_file_shared_nonpic.so): Likewise.
2784         (two_file_shared_mixed.so): Likewise.
2785         (two_file_shared_mixed_1.so): Likewise.
2786         (weak_undef_lib_nonpic.so): Likewise.
2787         (alt/weak_undef_lib_nonpic.so): Likewise.
2788         (tls_test_shared_nonpic.so): Likewise.
2789         * testsuite/Makefile.in: Rebuild.
2790
2791 2011-07-01  Ian Lance Taylor  <iant@google.com>
2792
2793         PR gold/12525
2794         * configure.ac: Test whether static linking works, setting
2795         the automake conditional HAVE_STATIC.
2796         * testsuite/Makefile.am: Disable tests using -static if
2797         HAVE_STATIC is not true.
2798         * configure, testsuite/Makefile.in: Rebuild.
2799
2800 2011-07-01  Ian Lance Taylor  <iant@google.com>
2801
2802         PR gold/12525
2803         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2804         Assert if we see DW_EH_PE_indirect.
2805         * target.h (Target::ehframe_datarel_base): New function.
2806         (Target::do_ehframe_datarel_base): New target function.
2807         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2808         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2809         function.
2810
2811 2011-07-01  Ian Lance Taylor  <iant@google.com>
2812
2813         PR gold/12571
2814         * options.h (class General_options): Add
2815         --ld-generated-unwind-info.
2816         * ehframe.cc (Fde::write): Add address parameter.  Change all
2817         callers.  If associated with PLT, fill in address and size.
2818         (Cie::set_output_offset): Only add merge mapping if there is an
2819         object.
2820         (Cie::write): Add address parameter.  Change all callers.
2821         (Eh_frame::add_ehframe_for_plt): New function.
2822         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2823         input_offset_ fields into union u_, with new plt field.
2824         (Fde::Fde): Adjust for new union field.
2825         (Fde::Fde) [Output_data version]: New constructor.
2826         (Fde::add_mapping): Only add merge mapping if there is an object.
2827         (class Cie): Update declarations.
2828         (class Eh_frame): Declare add_ehframe_for_plt.
2829         * layout.cc (Layout::layout_eh_frame): Break out code into
2830         make_eh_frame_section, and call it.
2831         (Layout::make_eh_frame_section): New function.
2832         (Layout::add_eh_frame_for_plt): New function.
2833         * layout.h (class Layout): Update declarations.
2834         * merge.cc (Merge_map::add_mapping): Add assertion.
2835         * i386.cc: Include "dwarf.h".
2836         (class Output_data_plt_i386): Make first_plt_entry,
2837         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2838         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2839         and plt_eh_frame_fde.
2840         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2841         boundary.  Call add_eh_frame_for_plt if appropriate.
2842         * x86_64.cc: Include "dwarf.h".
2843         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2844         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2845         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2846         and plt_eh_frame_fde.
2847         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2848         appropriate.
2849
2850 2011-06-29  Ian Lance Taylor  <iant@google.com>
2851
2852         PR gold/12629
2853         * object.cc (Sized_relobj_file::layout_section): Change shdr
2854         parameter to be const.
2855         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2856         out of do_layout.
2857         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2858         appropriate.  Call layout_eh_frame_section.
2859         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2860         sections.
2861         * object.h (class Sized_relobj_file): Update declarations.
2862
2863 2011-06-29  Ian Lance Taylor  <iant@google.com>
2864
2865         PR gold/12652
2866         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2867         modifier.
2868         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2869
2870 2011-06-29  Ian Lance Taylor  <iant@google.com>
2871
2872         PR gold/12675
2873         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2874         SHT_X86_64_UNWIND.
2875         * layout.cc (Layout::layout_eh_frame): Likewise.
2876
2877 2011-06-29  Ian Lance Taylor  <iant@google.com>
2878
2879         PR gold/12695
2880         * layout.cc (Layout::symtab_section_shndx): New function.
2881         * layout.h (class Layout): Declare symtab_section_shndx.
2882         * output.cc (Output_section::write_header): Call it.
2883
2884 2011-06-29  Ian Lance Taylor  <iant@google.com>
2885
2886         PR gold/12818
2887         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2888         symbols which are not used in a relocation.
2889
2890 2011-06-28  Ian Lance Taylor  <iant@google.com>
2891
2892         PR gold/12898
2893         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2894         script create indistinguishable segments.
2895         (Layout::set_segment_offsets): Use stable_sort when sorting
2896         segments.  Pass this to Compare_segments constructor.
2897         * layout.h (class Layout): Make segment_precedes non-static.
2898         (class Compare_segments): Change from struct to class.  Add
2899         layout_ field.  Add constructor.
2900         * script-sections.cc
2901         (Script_sections::attach_sections_using_phdrs_clause): Rename
2902         local orphan to is_orphan.  Don't report failure to put empty
2903         section in segment.  On attachment failure, report name of
2904         section, and attach to first PT_LOAD segment.
2905
2906 2011-06-28  Ian Lance Taylor  <iant@google.com>
2907
2908         PR gold/12934
2909         * target-select.cc (Target_selector::Target_selector): Add
2910         emulation parameter.  Change all callers.
2911         (select_target_by_bfd_name): Rename from select_target_by_name.
2912         Change all callers.
2913         (select_target_by_emulation): New function.
2914         (supported_emulation_names): New function.
2915         * target-select.h (class Target_selector): Add emulation_ field.
2916         Update declarations.
2917         (Target_selector::recognize_by_bfd_name): Rename from
2918         recognize_by_name.  Change all callers.
2919         (Target_selector::supported_bfd_names): Rename from
2920         supported_names.  Change all callers.
2921         (Target_selector::recognize_by_emulation): New function.
2922         (Target_selector::supported_emulations): New function.
2923         (Target_selector::emulation): New function.
2924         (Target_selector::do_recognize_by_bfd_name): Rename from
2925         do_recognize_by_name.  Change all callers.
2926         (Target_selector::do_supported_bfd_names): Rename from
2927         do_supported_names.  Change all callers.
2928         (Target_selector::do_recognize_by_emulation): New function.
2929         (Target_selector::do_supported_emulations): New function.
2930         (select_target_by_bfd_name): Change name in declaration.
2931         (select_target_by_emulation): Declare.
2932         (supported_emulation_names): Declare.
2933         * parameters.cc (parameters_force_valid_target): Try to find
2934         target based on emulation from -m option.
2935         * options.h (class General_options): Change doc string for -m.
2936         * options.cc (help): Print emulations.
2937         (General_options::parse_V): Likewise.
2938         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2939         Add emulation parameter.  Change all callers.
2940
2941 2011-06-28  Ian Lance Taylor  <iant@google.com>
2942
2943         * target.h (class Target): Add osabi_ field.
2944         (Target::osabi): New function.
2945         (Target::set_osabi): New function.
2946         (Target::Target): Initialize osabi_.
2947         (Target::do_adjust_elf_header): Make pure virtual.
2948         (Sized_target::do_adjust_elf_header): Declare.
2949         * target.cc (Sized_target::do_adjust_elf_header): New function.
2950         (class Sized_target): Instantiate all versions.
2951         * freebsd.h (class Target_freebsd): Remove.
2952         (Target_selector_freebsd::do_recognize): Call set_osabi on
2953         Target.
2954         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2955         (Target_selector_freebsd::set_osabi): Remove.
2956         * i386.cc (class Target_i386): Inherit from Sized_target rather
2957         than Target_freebsd.
2958         * x86_64.cc (class Target_x86_64): Likewise.
2959
2960 2011-06-28  Ian Lance Taylor  <iant@google.com>
2961
2962         * target.h (Target::can_check_for_function_pointers): Rewrite.
2963         Make non-virtual.
2964         (Target::can_icf_inline_merge_sections): Likewise.
2965         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2966         (Target::Target_info): Add can_icf_inline_merge_sections field.
2967         (Target::do_can_check_for_function_pointers): New virtual
2968         function.
2969         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2970         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2971         from can_check_for_function_pointers, move in file.
2972         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2973         section_may_have_icf_unsafe_poineters, move in file.
2974         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2975         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2976         Rename from can_check_for_function_pointers, move in file.
2977         (Target_i386::can_icf_inline_merge_sections): Remove.
2978         (Target_i386::i386_info): Initialize
2979         can_icf_inline_merge_sections.
2980         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2981         Initialize can_icf_inline_merge_sections.
2982         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2983         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2984         Rename from can_check_for_function_pointers, move in file.
2985         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2986         (Target_x86_64::x86_64_info): Initialize
2987         can_icf_inline_merge_sections.
2988         * testsuite/testfile.cc (Target_test::test_target_info):
2989         Likewise.
2990         * icf.cc (get_section_contents): Correct formatting.
2991
2992 2011-06-27  Ian Lance Taylor  <iant@google.com>
2993
2994         * symtab.cc (Symbol::versioned_name): New function.
2995         (Symbol_table::add_to_final_symtab): Use versioned_name when
2996         appropriate.
2997         (Symbol_table::sized_write_symbol): Likewise.
2998         * symtab.h (class Symbol): Declare versioned_name.
2999         * stringpool.h (class Stringpool_template): Add variant of add
3000         which takes a std::basic_string.
3001         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3002         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3003         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3004         (ver_test_12.o): New target.
3005         * testsuite/Makefile.in: Rebuild.
3006
3007 2011-06-27  Doug Kwan  <dougkwan@google.com>
3008
3009         * arm.cc (Arm_relocate_functions::thm_jump8,
3010         Arm_relocate_functions::thm_jump11): Use a wider signed
3011         type to compute offset.
3012         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3013         arm_thm_jump8.
3014         * testsuite/Makefile.in: Regenerate.
3015         * testsuite/arm_branch_in_range.sh: Check test results of
3016         arm_thm_jump11 and arm_thm_jump8.
3017         * testsuite/arm_thm_jump11.s: New test source file.
3018         * testsuite/arm_thm_jump11.t: New linker script.
3019         * testsuite/arm_thm_jump8.s: New test source file.
3020         * testsuite/arm_thm_jump8.t: New linker script.
3021
3022 2011-06-24  Ian Lance Taylor  <iant@google.com>
3023
3024         * layout.cc: Include "object.h".
3025         (ctors_sections_in_init_array): New static variable.
3026         (Layout::is_ctors_in_init_array): New function.
3027         (Layout::layout): Add entry to ctors_sections_in_init_array if
3028         appropriate.
3029         * layout.h (class Layout): Declare is_ctors_in_init_array.
3030         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3031         is_ctors_reverse_view is set.
3032         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3033         all callers.  Set is_ctors_reverse_view field of View_size.
3034         (Sized_relobj_file::reverse_words): New function.
3035         * object.h (Sized_relobj_file::View_size): Add
3036         is_ctors_reverse_view field.
3037         (class Sized_relobj_file): Update declarations.
3038         * testsuite/initpri3.c: New test.
3039         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3040         initpri3b.
3041         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3042         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3043         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3044         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3045         * testsuite/Makefile.in: Rebuild.
3046
3047 2011-06-24  Cary Coutant  <ccoutant@google.com>
3048
3049         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3050         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3051         (debug_msg_cdebug.err): New targets.
3052         * testsuite/Makefile.in: Regenerate.
3053         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3054         Fix checks for link with shared library.
3055
3056 2011-06-24  Doug Kwan  <dougkwan@google.com>
3057
3058         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3059         skip empty text sections.
3060         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3061
3062 2011-06-22  Ian Lance Taylor  <iant@google.com>
3063
3064         PR gold/12910
3065         * options.h (class General_options): Add --ctors-in-init-array.
3066         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3067         friends as SHT_PROGBITS for merging sections.
3068         (Layout::layout): Remove special handling of .init_array and
3069         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3070         and .dtors if ctors_in_init_array.
3071         (Layout::make_output_section): Force correct section types for
3072         .init_array and friends.  Don't sort if doing relocatable link,
3073         Don't sort .ctors and .dtors if ctors_in_init_array.
3074         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3075         (Layout::output_section_name): Add relobj parameter.  Change all
3076         callers.  Handle .ctors. and .dtors. in code rather than table.
3077         Handle .ctors and .dtors if ctors_in_init_array.
3078         (Layout::match_file_name): New function, moved from output.cc.
3079         * layout.h (class Layout): Update declarations.
3080         * output.cc: Include "layout.h".
3081         (Input_section_sort_entry::get_priority): New function.
3082         (Input_section_sort_entry::match_file_name): Just call
3083         Layout::match_file_name.
3084         (Output_section::Input_section_sort_init_fini_compare::operator()):
3085         Handle .ctors and .dtors.  Sort by explicit priority rather than
3086         by name.
3087         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3088         * testsuite/initpri2.c: New test.
3089         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3090         (check_PROGRAMS): Add initpri2.
3091         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3092         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3093         * configure, testsuite/Makefile.in: Rebuild.
3094
3095 2011-06-19  Ian Lance Taylor  <iant@google.com>
3096
3097         PR gold/12880
3098         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3099         .interp section to a PT_INTERP segment even if we have seen a
3100         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3101         clause in a linker script.
3102         (Layout::finalize): Don't create a .interp section if we've
3103         already create a PT_INTERP segment.
3104         (Layout::create_interp): Always call choose_output_section (revert
3105         patch of 2011-06-17).  Don't create PT_INTERP segment.
3106         * script-sections.cc
3107         (Script_sections::create_note_and_tls_segments): Add a .interp
3108         section to a PT_INTERP segment even if we have seen a
3109         --dynamic-linker option.
3110
3111 2011-06-18  Ian Lance Taylor  <iant@google.com>
3112
3113         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3114         merely because a non-PT_LOAD segment has a dynamic reloc.
3115
3116 2011-06-18  Ian Lance Taylor  <iant@google.com>
3117
3118         * layout.cc (Layout::finish_dynamic_section): Don't create
3119         DT_FLAGS entry if not needed.
3120
3121 2011-06-18  Ian Lance Taylor  <iant@google.com>
3122
3123         PR gold/12745
3124         * layout.cc (Layout::layout_eh_frame): Correct handling of
3125         writable .eh_frame section.
3126
3127 2011-06-17  Ian Lance Taylor  <iant@google.com>
3128
3129         PR gold/12893
3130         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3131         symbol is redefined with the exact same object and value.
3132
3133 2011-06-17  Ian Lance Taylor  <iant@google.com>
3134
3135         PR gold/12880
3136         * layout.h (class Layout): Add interp_segment_ field.
3137         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3138         (Layout::attach_allocated_section_to_segment): If making shared
3139         library, put .interp section in PT_INTERP segment.
3140         (Layout::finalize): Also call create_interp if -dynamic-linker
3141         option was used.
3142         (Layout::create_interp): Assert that there is no PT_INTERP
3143         segment.  If not using a SECTIONS clause, use make_output_section.
3144         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3145         * script-sections.cc
3146         (Script_sections::create_note_and_tls_segments): If making shared
3147         library, put .interp section in PT_INTERP segment.
3148
3149 2011-06-17  Ian Lance Taylor  <iant@google.com>
3150
3151         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3152         when making a shared library.
3153
3154 2011-06-17  Ian Lance Taylor  <iant@google.com>
3155
3156         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3157         parameter.  Change all callers.  Don't issue warning about PC32
3158         against locally defined symbol.
3159
3160 2011-06-16  Ian Lance Taylor  <iant@google.com>
3161
3162         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3163         occurs in same object.
3164
3165 2011-06-14  Alan Modra  <amodra@gmail.com>
3166
3167         * po/POTFILES.in: Regenerate.
3168
3169 2011-06-09  Ian Lance Taylor  <iant@google.com>
3170
3171         * script-sections.cc
3172         (Orphan_output_section::set_section_addresses): For a relocatable
3173         link set address to 0.
3174
3175 2011-06-09  Cary Coutant  <ccoutant@google.com>
3176
3177         PR gold/12804
3178         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3179         used with --compress-debug-sections.
3180         * gold/object.cc (Sized_relobj_file::do_layout): Report
3181         uncompressed size of compressed input sections.
3182
3183 2011-06-08  Cary Coutant  <ccoutant@google.com>
3184
3185         PR gold/12804
3186         * testsuite/two_file_test_2_v1.cc: Change initialization of
3187         v2 to keep it in .data.
3188
3189 2011-06-07  Cary Coutant  <ccoutant@google.com>
3190
3191         * common.cc (Symbol_table::do_allocate_commons_list): Call
3192         gold_fallback.
3193         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3194         (Errors::fallback): New function.
3195         (gold_fallback): New function.
3196         * errors.h (Errors::fallback): New function.
3197         * gold.cc (gold_exit): Change status parameter to enum; adjust
3198         all callers.
3199         (queue_initial_tasks): Call gold_fallback.
3200         * gold.h: Include cstdlib.
3201         (Exit_status): New enum type.
3202         (gold_exit): Change status parameter to enum.
3203         (gold_fallback): New function.
3204         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3205         (Layout::create_symtab_sections): Likewise.
3206         (Layout::create_shdrs): Likewise.
3207         * main.cc (main): Adjust call to gold_exit.
3208         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3209         (Output_data_got::add_got_entry_pair): Likewise.
3210         (Output_section::add_input_section): Likewise.
3211         (Output_section::add_output_section_data): Likewise.
3212         (Output_segment::set_section_list_addresses): Likewise.
3213         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3214
3215 2011-06-07  Cary Coutant  <ccoutant@google.com>
3216
3217         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3218         for incremental links.
3219         * output.cc (Output_segment::set_section_list_addresses): Remove
3220         FIXME and test for TLS or BSS.
3221
3222 2011-06-07  Cary Coutant  <ccoutant@google.com>
3223
3224         * testsuite/Makefile.am: Add incremental_copy_test,
3225         incremental_common_test_1.
3226         * testsuite/Makefile.in: Regenerate.
3227         * testsuite/common_test_1_v1.c: New source file.
3228         * testsuite/common_test_1_v2.c: New source file.
3229         * testsuite/copy_test_v1.cc: New source file.
3230
3231 2011-06-07  Cary Coutant  <ccoutant@google.com>
3232
3233         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3234         update, allocate common from bss section's free list.
3235         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3236         linker-defined symbols.
3237         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3238         Skip GOT and PLT entries that are no longer referenced.
3239         (Output_section_incremental_inputs::write_info_blocks): Mark
3240         linker-defined symbols.
3241         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3242         * output.cc (Output_section::allocate): New function.
3243         * output.h (Output_section::allocate): New function.
3244         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3245         linker-defined symbols.
3246         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3247         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3248         (Symbol::init_base_output_data): Likewise.
3249         (Symbol::init_base_output_segment): Likewise.
3250         (Symbol::init_base_constant): Likewise.
3251         (Sized_symbol::init_output_data): Likewise.
3252         (Sized_symbol::init_output_segment): Likewise.
3253         (Sized_symbol::init_constant): Likewise.
3254         (Symbol_table::do_define_in_output_data): Likewise.
3255         (Symbol_table::do_define_in_output_segment): Likewise.
3256         (Symbol_table::do_define_as_constant): Likewise.
3257         * symtab.h (Symbol::is_predefined): New function.
3258         (Symbol::init_base_output_data): Add is_predefined parameter.
3259         (Symbol::init_base_output_segment): Likewise.
3260         (Symbol::init_base_constant): Likewise.
3261         (Symbol::is_predefined_): New data member.
3262         (Sized_symbol::init_output_data): Add is_predefined parameter.
3263         (Sized_symbol::init_output_segment): Likewise.
3264         (Sized_symbol::init_constant): Likewise.
3265         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3266
3267 2011-06-07  Cary Coutant  <ccoutant@google.com>
3268
3269         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3270         instead of emit_copy_reloc.
3271         (Copy_relocs::emit_copy_reloc): Refactor.
3272         (Copy_relocs::make_copy_reloc): New function.
3273         (Copy_relocs::add_copy_reloc): Remove.
3274         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3275         section.
3276         (Copy_relocs::make_copy_reloc): New function.
3277         (Copy_relocs::add_copy_reloc): Remove.
3278         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3279         unchanged input files.
3280         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3281         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3282         Reserve BSS space for COPY relocations.
3283         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3284         (Output_section_incremental_inputs::write_info_blocks): Record
3285         whether a symbol is copied from a shared object.
3286         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3287         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3288         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3289         (Incremental_input_entry_reader::get_output_symbol_index): Add
3290         is_copy parameter.
3291         (Incremental_binary::emit_copy_relocs): New function.
3292         (Incremental_binary::do_emit_copy_relocs): New function.
3293         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3294         new data member.
3295         (Sized_incremental_binary::add_copy_reloc): New function.
3296         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3297         (Sized_incremental_binary::Copy_reloc): New struct.
3298         (Sized_incremental_binary::Copy_relocs): New typedef.
3299         (Sized_incremental_binary::copy_relocs_): New data member.
3300         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3301         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3302         * target.h (Sized_target::emit_copy_reloc): New function.
3303         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3304
3305 2011-06-02  Cary Coutant  <ccoutant@google.com>
3306
3307         PR gold/12163
3308         * gold/archive.cc (Archive::Archive): Initialize new data member.
3309         (Archive::include_all_members): Return if archive has already been
3310         included.
3311         * gold/archive.h (Archive::include_all_members_): New data member.
3312
3313 2011-06-02  Nick Clifton  <nickc@redhat.com>
3314
3315         * dynobj.h: Fix spelling mistake in comment.
3316         * output.cc: Likewise.
3317
3318 2011-05-31  Doug Kwan  <dougkwan@google.com>
3319             Asier Llano
3320
3321         PR gold/12826
3322         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3323         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3324         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3325         redundant arm_exidx_test.so.
3326         * testsuite/Makefile.in: Regenerate.
3327         (check_SCRIPTS): Add pr12826.sh
3328         (check_DATA): Add pr12826.stdout
3329         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3330         * testsuite/pr12826.sh: New file.
3331         * testsuite/pr12826_1.s: Ditto.
3332         * testsuite/pr12826_1.s: Ditto.
3333
3334 2011-05-30  Ian Lance Taylor  <iant@google.com>
3335
3336         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3337         sections.
3338
3339 2011-05-29  Ian Lance Taylor  <iant@google.com>
3340
3341         PR gold/12804
3342         * testsuite/Makefile.am: Use different file name for two_file_test
3343         temporary file for each incremental test.
3344         * testsuite/Makefile.in: Rebuild.
3345
3346 2011-05-29  Ian Lance Taylor  <iant@google.com>
3347
3348         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3349         binary input file is empty.
3350
3351 2011-05-27  Ian Lance Taylor  <iant@google.com>
3352
3353         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3354         (ver_test_9.so): Likewise.
3355         * testsuite/Makefile.in: Rebuild.
3356
3357 2011-05-26 Cary Coutant  <ccoutant@google.com>
3358
3359         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3360         * incremental.cc (Incremental_inputs::report_input_section): Fix
3361         comment, indentation.
3362         (Incremental_inputs::report_comdat_group): New function.
3363         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3364         of data for incremental input file entry.
3365         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3366         group count, COMDAT group signatures.
3367         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3368         an unchanged input file.
3369         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3370         Initialize new data member.
3371         (Incremental_object_entry::add_comdat_group): New function.
3372         (Incremental_object_entry::get_comdat_group_count): New function.
3373         (Incremental_object_entry::get_comdat_signature_key): New function.
3374         (Incremental_object_entry::groups_): New data member.
3375         (Incremental_inputs::report_comdat_group): New function.
3376         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3377         data for incremental input file entry.
3378         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3379         (Incremental_input_entry_reader::get_input_section): Adjust size of
3380         data for incremental input file entry.
3381         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3382         (Incremental_input_entry_reader::get_comdat_group_signature): New
3383         function.
3384         * object.cc (Sized_relobj::include_section_group): Report kept
3385         COMDAT groups for incremental links.
3386
3387 2011-05-24  David Meyer  <pdox@google.com>
3388
3389         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3390         with name parameter.  Add found_name parameter.
3391         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3392         * dirsearch.h (class Dirsearch): Update declaration.
3393
3394 2011-05-24  Ian Lance Taylor  <iant@google.com>
3395
3396         * archive.cc (Library_base::should_include_member): Pull in object
3397         from archive if it defines the entry symbol.
3398         * parameters.cc (Parameters::entry): New function.
3399         * parameters.h (class Parameters): Declare entry.
3400         * output.h (class Output_file_header): Remove entry_ field.
3401         * output.cc (Output_file_header::Output_file_header): Remove entry
3402         parameter.  Change all callers.
3403         (Output_file_header::entry): Use parameters->entry.
3404         * gold.cc (queue_middle_tasks): Likewise.
3405         * plugin.cc (Plugin_hook::run): Likewise.
3406
3407 2011-05-24 Cary Coutant  <ccoutant@google.com>
3408
3409         * gold.cc (queue_initial_tasks): Pass incremental base filename
3410         to Output_file::open_base_file; don't print error message.
3411         * incremental-dump.cc (main): Adjust call to
3412         Output_file::open_for_modification.
3413         * incremental-dump.cc (main): Likewise.
3414         * incremental.cc (Incremental_inputs::report_command_line):
3415         Ignore --incremental-base option when comparing command lines.
3416         Ignore parameter when given as separate argument.
3417         * options.h (class General_options): Add --incremental-base.
3418         * output.cc (Output_file::Output_file):
3419         (Output_file::open_base_file): Add base_name and writable parameters;
3420         read base file into new file; print error message here.
3421         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3422         callers.
3423         * output.h (Output_file::open_for_modification): Rename to...
3424         (Output_file::open_base_file): ...this; add base_name and
3425         writable parameters; adjust all callers.
3426         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3427         callers.
3428         * testsuite/Makefile.am (incremental_test_4): Test
3429         --incremental-base.
3430         * testsuite/Makefile.in: Regenerate.
3431
3432 2011-05-24 Cary Coutant  <ccoutant@google.com>
3433
3434         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3435         incremental_test_4.
3436         * testsuite/Makefile.in: Regenerate.
3437         * testsuite/two_file_test_1_v1.cc: New test source file.
3438         * testsuite/two_file_test_1b_v1.cc: New test source file.
3439         * testsuite/two_file_test_2_v1.cc: New test source file.
3440
3441 2011-05-24 Cary Coutant  <ccoutant@google.com>
3442
3443         * dynobj.h (Dynobj::do_dynobj): New function.
3444         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3445         flag and soname for shared objects.
3446         * incremental.cc (Incremental_inputs::report_object): Make
3447         either Incremental_object_entry or Incremental_dynobj_entry; add
3448         soname to string table.
3449         (Incremental_inputs::report_input_section): Add assertion.
3450         (Output_section_incremental_inputs::set_final_data_size): Adjust
3451         type of input file entry for shared libraries; adjust size of
3452         shared library info entry.
3453         (Output_section_incremental_inputs::write_input_files): Write
3454         as_needed flag for shared libraries.
3455         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3456         of input file entry for shared libraries; write soname.
3457         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3458         soname from incremental info.
3459         * incremental.h (enum Incremental_input_flags): Add
3460         INCREMENTAL_INPUT_AS_NEEDED.
3461         (Incremental_input_entry::Incremental_input_entry): Initialize new
3462         data member.
3463         (Incremental_input_entry::set_as_needed): New function.
3464         (Incremental_input_entry::as_needed): New function.
3465         (Incremental_input_entry::do_dynobj_entry): New function.
3466         (Incremental_input_entry::as_needed_): New data member.
3467         (Incremental_object_entry::Incremental_object_entry): Don't check
3468         for shared library.
3469         (Incremental_object_entry::do_type): Likewise.
3470         (class Incremental_dynobj_entry): New class.
3471         (Incremental_input_entry_reader::as_needed): New function.
3472         (Incremental_input_entry_reader::get_soname): New function.
3473         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3474         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3475         size of shared library info entry.
3476         * layout.cc (Layout::finish_dynamic_section): Don't test for
3477         incremental link when adding DT_NEEDED entries.
3478         * object.h (Object::Object): Initialize new data member.
3479         (Object::dynobj): New function.
3480         (Object::set_as_needed): New function.
3481         (Object::as_needed): New function.
3482         (Object::do_dynobj): New function.
3483         (Object::as_needed_): New data member.
3484
3485 2011-05-24 Cary Coutant  <ccoutant@google.com>
3486
3487         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3488         info; adjust display of GOT entries.
3489         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3490         vector of input objects; remove file_status_.
3491         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3492         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3493         got_plt reader; call target hooks to reserve GOT entries.
3494         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3495         of input file info header and GOT info entry.
3496         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3497         relocation info.
3498         (Got_plt_view_info::got_descriptor): Remove.
3499         (Got_plt_view_info::sym_index): New data member.
3500         (Got_plt_view_info::input_index): New data member.
3501         (Local_got_offset_visitor::visit): Write input file index.
3502         (Global_got_offset_visitor::visit): Write 0 for input file index.
3503         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3504         with sym_index and input_index.
3505         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3506         incremental info GOT entry; replace got_descriptor with input_index.
3507         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3508         map from input file index to object.
3509         (Sized_relobj_incr::do_layout): Replace direct data member reference
3510         with accessor function.
3511         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3512         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3513         Adjust size of input file info header.
3514         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3515         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3516         (Incremental_input_entry_reader::get_input_section): Adjust size of
3517         input file info header.
3518         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3519         of incremental info GOT entry.
3520         (Incremental_got_plt_reader::get_got_desc): Remove.
3521         (Incremental_got_plt_reader::get_got_symndx): New function.
3522         (Incremental_got_plt_reader::get_got_input_index): New function.
3523         (Sized_incremental_binary::Sized_incremental_binary): Remove
3524         file_status_; add input_objects_.
3525         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3526         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3527         (Sized_incremental_binary::file_is_unchanged): Remove.
3528         (Sized_incremental_binary::set_input_object): New function.
3529         (Sized_incremental_binary::input_object): New function.
3530         (Sized_incremental_binary::file_status_): Remove.
3531         (Sized_incremental_binary::input_objects_): New data member.
3532         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3533         references.
3534         (Sized_relobj_incr::invalid_address): Move to base class.
3535         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3536         class.
3537         (Sized_relobj_incr::do_output_section_offset): Likewise.
3538         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3539         (Sized_relobj_incr::section_offsets_): Likewise.
3540         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3541         function.
3542         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3543         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3544         with accessor function.
3545         (Sized_relobj_file::do_layout): Likewise.
3546         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3547         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3548         (Sized_relobj_file::compute_final_local_value): Replace refs to
3549         section_offsets_ with accessor function.
3550         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3551         * object.h (Relobj::Relobj): Initialize new data members.
3552         (Relobj::add_dyn_reloc): New function.
3553         (Relobj::first_dyn_reloc): New function.
3554         (Relobj::dyn_reloc_count): New function.
3555         (Relobj::first_dyn_reloc_): New data member.
3556         (Relobj::dyn_reloc_count_): New data member.
3557         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3558         references.
3559         (Sized_relobj::Address): New typedef.
3560         (Sized_relobj::invalid_address): Move here from child class.
3561         (Sized_relobj::Sized_relobj): Initialize new data members.
3562         (Sized_relobj::sized_relobj): New function.
3563         (Sized_relobj::is_output_section_offset_invalid): Move here from
3564         child class.
3565         (Sized_relobj::get_output_section_offset): Likewise.
3566         (Sized_relobj::local_has_got_offset): Likewise.
3567         (Sized_relobj::local_got_offset): Likewise.
3568         (Sized_relobj::set_local_got_offset): Likewise.
3569         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3570         (Sized_relobj::clear_got_offsets): New function.
3571         (Sized_relobj::section_offsets): Move here from child class.
3572         (Sized_relobj::do_output_section_offset): Likewise.
3573         (Sized_relobj::do_set_section_offset): Likewise.
3574         (Sized_relobj::Local_got_offsets): Likewise.
3575         (Sized_relobj::local_got_offsets_): Likewise.
3576         (Sized_relobj::section_offsets_): Likewise.
3577         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3578         references.
3579         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3580         class.
3581         (Sized_relobj_file::sized_relobj): New function
3582         (Sized_relobj_file::local_has_got_offset): Move to base class.
3583         (Sized_relobj_file::local_got_offset): Likewise.
3584         (Sized_relobj_file::set_local_got_offset): Likewise.
3585         (Sized_relobj_file::get_output_section_offset): Likewise.
3586         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3587         (Sized_relobj_file::do_output_section_offset): Likewise.
3588         (Sized_relobj_file::do_set_section_offset): Likewise.
3589         (Sized_relobj_file::Local_got_offsets): Likewise.
3590         (Sized_relobj_file::local_got_offsets_): Likewise.
3591         (Sized_relobj_file::section_offsets_): Likewise.
3592         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3593         (all constructors).
3594         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3595         (Output_reloc::get_symbol_index): Likewise.
3596         (Output_reloc::local_section_offset): Likewise.
3597         (Output_reloc::get_address): Likewise.
3598         (Output_reloc::symbol_value): Likewise.
3599         (Output_data_got::reserve_slot): Move to class definition.
3600         (Output_data_got::reserve_local): New function.
3601         (Output_data_got::reserve_slot_for_global): Remove.
3602         (Output_data_got::reserve_global): New function.
3603         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3604         (all constructors, two instantiations).
3605         (Output_reloc::get_relobj): New function (two instantiations).
3606         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3607         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3608         (Output_data_reloc::add_global): Adjust type of relobj.
3609         (Output_data_reloc::add_global_relative): Likewise.
3610         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3611         (Output_data_reloc::add_local): Likewise.
3612         (Output_data_reloc::add_local_relative): Likewise.
3613         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3614         (Output_data_reloc::add_local_section): Likewise.
3615         (Output_data_reloc::add_output_section): Likewise.
3616         (Output_data_reloc::add_absolute): Likewise.
3617         (Output_data_reloc::add_target_specific): Likewise.
3618         (Output_data_got::reserve_slot): Move definition here.
3619         (Output_data_got::reserve_local): New function.
3620         (Output_data_got::reserve_global): New function.
3621         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3622         section_offsets_ with accessor function.
3623         (Sized_relobj_file::write_sections): Likewise.
3624         (Sized_relobj_file::do_relocate_sections): Likewise.
3625         * target.h (Sized_target::reserve_local_got_entry): New function.
3626         (Sized_target::reserve_global_got_entry): New function.
3627         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3628         (Target_x86_64::reserve_global_got_entry): New function.
3629         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3630
3631 2011-05-23 Cary Coutant  <ccoutant@google.com>
3632
3633         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3634         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3635         bit when checking got_type.
3636         * incremental.cc (Sized_incremental_binary::setup_readers):
3637         Store symbol table and string table locations; initialize bit vector
3638         of file status flags.
3639         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3640         unchanged files.
3641         (Sized_incremental_binary::do_process_got_plt): New function.
3642         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3643         (Output_section_incremental_inputs::set_final_data_size): Record
3644         file index for each input file.
3645         (Output_section_incremental_inputs::write_got_plt): Store file index
3646         instead of input entry offset for each GOT entry.
3647         * incremental.h
3648         (Incremental_input_entry::Incremental_input_entry): Initialize new
3649         data member.
3650         (Incremental_input_entry::set_offset): Store file index.
3651         (Incremental_input_entry::get_file_index): New function.
3652         (Incremental_input_entry::file_index_): New data member.
3653         (Incremental_binary::process_got_plt): New function.
3654         (Incremental_binary::do_process_got_plt): New function.
3655         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3656         data members.
3657         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3658         (Sized_incremental_binary::set_file_is_unchanged): New function.
3659         (Sized_incremental_binary::file_is_unchanged): New function.
3660         (Sized_incremental_binary::do_process_got_plt): New function.
3661         (Sized_incremental_binary::file_status_): New data member.
3662         (Sized_incremental_binary::main_symtab_loc_): New data member.
3663         (Sized_incremental_binary::main_strtab_loc_): New data member.
3664         * output.cc (Output_data_got::Got_entry::write): Add case
3665         RESERVED_CODE.
3666         (Output_data_got::add_global): Call add_got_entry.
3667         (Output_data_got::add_global_plt): Likewise.
3668         (Output_data_got::add_global_with_rel): Likewise.
3669         (Output_data_got::add_global_with_rela): Likewise.
3670         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3671         (Output_data_got::add_global_pair_with_rela): Likewise.
3672         (Output_data_got::add_local): Call add_got_entry.
3673         (Output_data_got::add_local_plt): Likewise.
3674         (Output_data_got::add_local_with_rel): Likewise.
3675         (Output_data_got::add_local_with_rela): Likewise.
3676         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3677         (Output_data_got::add_local_pair_with_rela): Likewise.
3678         (Output_data_got::reserve_slot): New function.
3679         (Output_data_got::reserve_slot_for_global): New function.
3680         (Output_data_got::add_got_entry): New function.
3681         (Output_data_got::add_got_entry_pair): New function.
3682         (Output_section::add_output_section_data): Edit FIXME.
3683         * output.h
3684         (Output_section_data_build::Output_section_data_build): New
3685         constructor with size parameter.
3686         (Output_data_space::Output_data_space): Likewise.
3687         (Output_data_got::Output_data_got): Initialize new data member; new
3688         constructor with size parameter.
3689         (Output_data_got::add_constant): Call add_got_entry.
3690         (Output_data_got::reserve_slot): New function.
3691         (Output_data_got::reserve_slot_for_global): New function.
3692         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3693         (Output_data_got::add_got_entry): New function.
3694         (Output_data_got::add_got_entry_pair): New function.
3695         (Output_data_got::free_list_): New data member.
3696         * target.h (Sized_target::init_got_plt_for_update): New function.
3697         (Sized_target::register_global_plt_entry): New function.
3698         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3699         Initialize new data member; call init; add constructor with PLT count.
3700         (Output_data_plt_x86_64::init): New function.
3701         (Output_data_plt_x86_64::add_relocation): New function.
3702         (Output_data_plt_x86_64::reserve_slot): New function.
3703         (Output_data_plt_x86_64::free_list_): New data member.
3704         (Target_x86_64::init_got_plt_for_update): New function.
3705         (Target_x86_64::register_global_plt_entry): New function.
3706         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3707         incremental updates.
3708         (Output_data_plt_x86_64::add_relocation): New function.
3709         * testsuite/object_unittest.cc (Object_test): Set default options.
3710
3711 2011-05-16  Ian Lance Taylor  <iant@google.com>
3712
3713         * options.h (class General_options): Make -i a synonym for -r.
3714
3715 2011-05-16  Ian Lance Taylor  <iant@google.com>
3716
3717         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3718
3719 2011-05-10 Cary Coutant  <ccoutant@google.com>
3720
3721         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3722         strip_all (-s).
3723
3724 2011-05-06  Ian Lance Taylor  <iant@google.com>
3725
3726         * layout.cc (Layout::layout): If the output section flags change,
3727         update the ordering.
3728
3729 2011-04-25 Cary Coutant  <ccoutant@google.com>
3730
3731         * incremental-dump.cc (dump_incremental_inputs): Print local
3732         symbol info for each input file.
3733         * incremental.cc
3734         (Output_section_incremental_inputs::set_final_data_size): Add local
3735         symbol info to input file entries in incremental info.
3736         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3737         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3738         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3739         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3740         implementation.
3741         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3742         (Sized_incr_relobj::do_relocate): Write the local symbols.
3743         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3744         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3745         Adjust size of input file header.
3746         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3747         (Incremental_inputs_reader::get_local_symbol_count): New function.
3748         (Incremental_inputs_reader::get_input_section): Adjust size of input
3749         file header.
3750         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3751         (Sized_incr_relobj::This): New typedef.
3752         (Sized_incr_relobj::sym_size): New const data member.
3753         (Sized_incr_relobj::Local_symbol): New struct.
3754         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3755         (Sized_incr_relobj::do_local_symbol_offset): New function.
3756         (Sized_incr_relobj::local_symbol_count_): New data member.
3757         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3758         (Sized_incr_relobj::local_symbol_index_): New data member.
3759         (Sized_incr_relobj::local_symbol_offset_): New data member.
3760         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3761         (Sized_incr_relobj::local_symbols_): New data member.
3762         * object.h (Relobj::output_local_symbol_count): New function.
3763         (Relobj::local_symbol_offset): New function.
3764         (Relobj::do_output_local_symbol_count): New function.
3765         (Relobj::do_local_symbol_offset): New function.
3766         (Sized_relobj::do_output_local_symbol_count): New function.
3767         (Sized_relobj::do_local_symbol_offset): New function.
3768
3769 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3770
3771         * descriptors.cc (set_close_on_exec): New function.
3772         (Descriptors::open): Use set_close_on_exec.
3773         * output.cc (S_ISLNK): Define if not defined.
3774
3775 2011-04-22 Cary Coutant  <ccoutant@google.com>
3776
3777         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3778         global symbol map.
3779         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3780         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3781         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3782         relocations.
3783         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3784         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3785         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3786         * incremental.h
3787         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3788         function.
3789         (Incremental_binary::apply_incremental_relocs): New function.
3790         (Incremental_binary::do_apply_incremental_relocs): New function.
3791         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3792         data member.
3793         (Sized_incremental_binary::add_global_symbol): New function.
3794         (Sized_incremental_binary::global_symbol): New function.
3795         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3796         (Sized_incremental_binary::symbol_map_): New data member.
3797         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3798         * target.h (Sized_target::apply_relocation): New function.
3799         * target-reloc.h (apply_relocation): New function.
3800         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3801
3802 2011-04-22  Doug Kwan  <dougkwan@google.com>
3803
3804         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3805         flag of a SHT_ARM_EXIDX section.
3806         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3807         * testsuite/Makefile.in: Regenerate.
3808         * testsuite/arm_exidx_test.s: New file.
3809         * testsuite/arm_exidx_test.sh: Same.
3810
3811 2011-04-20 Cary Coutant  <ccoutant@google.com>
3812
3813         PR gold/12689
3814         * archive.h (Incremental_archive_entry::Archive_member):
3815         Initialize arg_serial_ (second constructor).
3816
3817 2011-04-17  Ian Lance Taylor  <iant@google.com>
3818
3819         * object.cc (Relocate_info::location): Simplify location string.
3820         * errors.cc (Errors::error_at_location): Don't print program
3821         name.
3822         (Errors::warning_at_location): Likewise.
3823         (Errors::undefined_symbol): Likewise.
3824         * testsuite/debug_msg.sh: Update accordingly.
3825
3826 2011-04-14 Cary Coutant  <ccoutant@google.com>
3827
3828         * gold/layout.cc (Layout::symtab_section_offset): New function.
3829         * gold/layout.h (Layout::symtab_section_offset): New function.
3830         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3831
3832 2011-04-12  Ian Lance Taylor  <iant@google.com>
3833
3834         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3835         with MREMAP_MAYMOVE.
3836         * output.h (class Output_file): Add map_is_allocated_ field.
3837         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3838         not available, provide stubs.  If mremap is not available, #define
3839         it to gold_mremap.
3840         (MREMAP_MAYMOVE): Define if not defined.
3841         (Output_file::Output_file): Initialize map_is_allocated_.
3842         (Output_file::resize): Check map_is_allocated_.
3843         (Output_file::map_anonymous): If mmap fails, use malloc.
3844         (Output_file::unmap): Don't do anything for an anonymous map.
3845         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3846         is not available, provide stubs.
3847         (File_read::View::~View): Use free rather than delete[].
3848         (File_read::make_view): Use malloc rather than new[].  If mmap
3849         fails, use malloc.
3850         (File_read::find_or_make_view): Use malloc rather than new[].
3851         * gold.h: Remove HAVE_REMAP code.
3852         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3853         exists.  Rename mremap to gold_mremap.  If mmap is not available
3854         don't do anything.
3855         * configure, config.in: Rebuild.
3856
3857 2011-04-11  Ian Lance Taylor  <iant@google.com>
3858
3859         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3860         initialize local variable v.
3861
3862 2011-04-11  Cary Coutant  <ccoutant@google.com>
3863
3864         * archive.cc (Archive::include_member): Adjust call to
3865         report_object.
3866         (Add_archive_symbols::run): Track argument serial numbers.
3867         (Lib_group::include_member): Likewise.
3868         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3869         * archive.h (Incremental_archive_entry::Archive_member):
3870         Initialize arg_serial_.
3871         (Archive_member::arg_serial_): New data member.
3872         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3873         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3874         incremental link.
3875         (Sized_dynobj::do_for_all_local_got_entries): New function.
3876         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3877         function.
3878         * fileread.cc (get_mtime): New function.
3879         * fileread.h (get_mtime): New function.
3880         * gold.cc (queue_initial_tasks): Check for incremental update.
3881         (process_incremental_input): New function.
3882         (queue_middle_tasks): Don't force valid target for incremental
3883         update.
3884         * incremental-dump.cc (find_input_containing_global): Adjust
3885         size of symbol info entry.
3886         (dump_incremental_inputs): Dump argument serial number and
3887         in_system_directory flag; bias shndx by 1; print symbol names
3888         when dumping per-file symbol lists; use new symbol info readers.
3889         * incremental.cc
3890         (Output_section_incremental_inputs:update_data_size): New function.
3891         (Sized_incremental_binary::setup_readers): Setup input readers
3892         for each input file; build maps for files added from libraries
3893         and scripts.
3894         (Sized_incremental_binary::check_input_args): New function.
3895         (Sized_incremental_binary::do_check_inputs): Build map of argument
3896         serial numbers to input arguments.
3897         (Sized_incremental_binary::do_file_has_changed): Rename
3898         do_file_is_unchanged to this; compare file modification times.
3899         (Sized_incremental_binary::do_init_layout): New function.
3900         (Sized_incremental_binary::do_reserve_layout): New function.
3901         (Sized_incremental_binary::do_get_input_reader): Remove.
3902         (Sized_incremental_binary::get_symtab_view): New function.
3903         (Incremental_checker::can_incrementally_link_output_file): Remove.
3904         (Incremental_inputs::report_command_line): Exclude --debug options.
3905         (Incremental_inputs::report_archive_begin): Add parameter; track
3906         argument serial numbers; don't put input file entry for archive
3907         before archive members.
3908         (Incremental_inputs::report_archive_end): Put input file entry
3909         for archive after archive members.
3910         (Incremental_inputs::report_object): Add parameter; track argument
3911         serial numbers and in_system_directory flag.
3912         (Incremental_inputs::report_script): Add parameter; track argument
3913         serial numbers.
3914         (Output_section_incremental_inputs::set_final_data_size): Adjust
3915         size of symbol info entry; check for forwarding symbols.
3916         (Output_section_incremental_inputs::write_input_files): Write
3917         in_system_directory flag and argument serial number.
3918         (Output_section_incremental_inputs::write_info_blocks): Map section
3919         indices between incremental info and original input file; store
3920         input section index for each symbol.
3921         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3922         change operator() to visit().
3923         (class Global_got_offset_visitor): Likewise.
3924         (class Global_symbol_visitor_got_plt):
3925         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3926         classes.
3927         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3928         (Sized_incr_relobj::do_read_symbols): New function.
3929         (Sized_incr_relobj::do_layout): New function.
3930         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3931         (Sized_incr_relobj::do_add_symbols): New function.
3932         (Sized_incr_relobj::do_should_include_member): New function.
3933         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3934         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3935         (Sized_incr_relobj::do_section_size): New function.
3936         (Sized_incr_relobj::do_section_name): New function.
3937         (Sized_incr_relobj::do_section_contents): New function.
3938         (Sized_incr_relobj::do_section_flags): New function.
3939         (Sized_incr_relobj::do_section_entsize): New function.
3940         (Sized_incr_relobj::do_section_address): New function.
3941         (Sized_incr_relobj::do_section_type): New function.
3942         (Sized_incr_relobj::do_section_link): New function.
3943         (Sized_incr_relobj::do_section_info): New function.
3944         (Sized_incr_relobj::do_section_addralign): New function.
3945         (Sized_incr_relobj::do_initialize_xindex): New function.
3946         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3947         (Sized_incr_relobj::do_read_relocs): New function.
3948         (Sized_incr_relobj::do_gc_process_relocs): New function.
3949         (Sized_incr_relobj::do_scan_relocs): New function.
3950         (Sized_incr_relobj::do_count_local_symbols): New function.
3951         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3952         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3953         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3954         (Sized_incr_relobj::do_relocate): New function.
3955         (Sized_incr_relobj::do_set_section_offset): New function.
3956         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3957         (Sized_incr_dynobj::do_read_symbols): New function.
3958         (Sized_incr_dynobj::do_layout): New function.
3959         (Sized_incr_dynobj::do_add_symbols): New function.
3960         (Sized_incr_dynobj::do_should_include_member): New function.
3961         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3962         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3963         (Sized_incr_dynobj::do_section_size): New function.
3964         (Sized_incr_dynobj::do_section_name): New function.
3965         (Sized_incr_dynobj::do_section_contents): New function.
3966         (Sized_incr_dynobj::do_section_flags): New function.
3967         (Sized_incr_dynobj::do_section_entsize): New function.
3968         (Sized_incr_dynobj::do_section_address): New function.
3969         (Sized_incr_dynobj::do_section_type): New function.
3970         (Sized_incr_dynobj::do_section_link): New function.
3971         (Sized_incr_dynobj::do_section_info): New function.
3972         (Sized_incr_dynobj::do_section_addralign): New function.
3973         (Sized_incr_dynobj::do_initialize_xindex): New function.
3974         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3975         (make_sized_incremental_object): New function.
3976         (Incremental_library::copy_unused_symbols): New function.
3977         (Incremental_library::do_for_all_unused_symbols): New function.
3978         * incremental.h (enum Incremental_input_flags): New type.
3979         (class Incremental_checker): Remove.
3980         (Incremental_input_entry::Incremental_input_entry): Add argument
3981         serial number.
3982         (Incremental_input_entry::arg_serial): New function.
3983         (Incremental_input_entry::set_is_in_system_directory): New function.
3984         (Incremental_input_entry::is_in_system_directory): New function.
3985         (Incremental_input_entry::arg_serial_): New data member.
3986         (Incremental_input_entry::is_in_system_directory_): New data member.
3987         (class Script_info): Move here from script.h.
3988         (Script_info::Script_info): Add filename parameter.
3989         (Script_info::filename): New function.
3990         (Script_info::filename_): New data member.
3991         (Incremental_script_entry::Incremental_script_entry): Add argument
3992         serial number.
3993         (Incremental_object_entry::Incremental_object_entry): Likewise.
3994         (Incremental_object_entry::add_input_section): Build list of input
3995         sections with map to original shndx.
3996         (Incremental_object_entry::get_input_section_index): New function.
3997         (Incremental_object_entry::shndx_): New data member.
3998         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3999         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4000         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4001         serial number.
4002         (Incremental_inputs::report_archive_begin): Likewise.
4003         (Incremental_inputs::report_object): Likewise.
4004         (Incremental_inputs::report_script): Likewise.
4005         (class Incremental_global_symbol_reader): New class.
4006         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4007         and store flags and input file type.
4008         (Incremental_input_entry_reader::arg_serial): New function.
4009         (Incremental_input_entry_reader::type): Extract type from flags.
4010         (Incremental_input_entry_reader::is_in_system_directory): New function.
4011         (Incremental_input_entry_reader::get_input_section_count): Call
4012         accessor function for type.
4013         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4014         function for type; adjust size of global symbol entry.
4015         (Incremental_input_entry_reader::get_global_symbol_count): Call
4016         accessor function for type.
4017         (Incremental_input_entry_reader::get_object_count): Likewise.
4018         (Incremental_input_entry_reader::get_object_offset): Likewise.
4019         (Incremental_input_entry_reader::get_member_count): Likewise.
4020         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4021         (Incremental_input_entry_reader::get_member_offset): Likewise.
4022         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4023         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4024         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4025         (Incremental_input_entry_reader::get_global_symbol_reader): New
4026         function.
4027         (Incremental_input_entry_reader::get_output_symbol_index): New
4028         function.
4029         (Incremental_input_entry_reader::type_): Remove.
4030         (Incremental_input_entry_reader::flags_): New data member.
4031         (Incremental_inputs_reader::input_file_offset): New function.
4032         (Incremental_inputs_reader::input_file_index): New function.
4033         (Incremental_inputs_reader::input_file): Call input_file_offset.
4034         (Incremental_inputs_reader::input_file_at_offset): New function.
4035         (Incremental_relocs_reader::get_r_type): Reformat.
4036         (Incremental_relocs_reader::get_r_shndx): Reformat.
4037         (Incremental_relocs_reader::get_r_offset): Reformat.
4038         (Incremental_relocs_reader::data): New function.
4039         (Incremental_binary::Incremental_binary): Initialize new data members.
4040         (Incremental_binary::check_inputs): Add cmdline parameter.
4041         (Incremental_binary::file_is_unchanged): Remove.
4042         (Input_reader::arg_serial): New function.
4043         (Input_reader::get_unused_symbol_count): New function.
4044         (Input_reader::get_unused_symbol): New function.
4045         (Input_reader::do_arg_serial): New function.
4046         (Input_reader::do_get_unused_symbol_count): New function.
4047         (Input_reader::do_get_unused_symbol): New function.
4048         (Incremental_binary::input_file_count): New function.
4049         (Incremental_binary::get_input_reader): Change signature to use
4050         index instead of filename.
4051         (Incremental_binary::file_has_changed): New function.
4052         (Incremental_binary::get_input_argument): New function.
4053         (Incremental_binary::get_library): New function.
4054         (Incremental_binary::get_script_info): New function.
4055         (Incremental_binary::init_layout): New function.
4056         (Incremental_binary::reserve_layout): New function.
4057         (Incremental_binary::output_file): New function.
4058         (Incremental_binary::do_check_inputs): New function.
4059         (Incremental_binary::do_file_is_unchanged): Remove.
4060         (Incremental_binary::do_file_has_changed): New function.
4061         (Incremental_binary::do_init_layout): New function.
4062         (Incremental_binary::do_reserve_layout): New function.
4063         (Incremental_binary::do_input_file_count): New function.
4064         (Incremental_binary::do_get_input_reader): Change signature.
4065         (Incremental_binary::input_args_map_): New data member.
4066         (Incremental_binary::library_map_): New data member.
4067         (Incremental_binary::script_map_): New data member.
4068         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4069         new data members.
4070         (Sized_incremental_binary::output_section): New function.
4071         (Sized_incremental_binary::inputs_reader): Add const.
4072         (Sized_incremental_binary::symtab_reader): Add const.
4073         (Sized_incremental_binary::relocs_reader): Add const.
4074         (Sized_incremental_binary::got_plt_reader): Add const.
4075         (Sized_incremental_binary::get_symtab_view): New function.
4076         (Sized_incremental_binary::Inputs_reader): New typedef.
4077         (Sized_incremental_binary::Input_entry_reader): New typedef.
4078         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4079         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4080         (Sized_incremental_binary::do_file_has_changed): New function.
4081         (Sized_incremental_binary::do_init_layout): New function.
4082         (Sized_incremental_binary::do_reserve_layout): New function.
4083         (Sized_input_reader::Inputs_reader): Remove.
4084         (Sized_input_reader::Input_entry_reader): Remove.
4085         (Sized_input_reader::do_arg_serial): New function.
4086         (Sized_input_reader::do_get_unused_symbol_count): New function.
4087         (Sized_input_reader::do_get_unused_symbol): New function.
4088         (Sized_incremental_binary::do_input_file_count): New function.
4089         (Sized_incremental_binary::do_get_input_reader): Change signature;
4090         use index instead of filename.
4091         (Sized_incremental_binary::section_map_): New data member.
4092         (Sized_incremental_binary::input_entry_readers_): New data member.
4093         (class Sized_incr_relobj): New class.
4094         (class Sized_incr_dynobj): New class.
4095         (make_sized_incremental_object): New function.
4096         (class Incremental_library): New class.
4097         * layout.cc (Free_list::num_lists): New static data member.
4098         (Free_list::num_nodes): New static data member.
4099         (Free_list::num_removes): New static data member.
4100         (Free_list::num_remove_visits): New static data member.
4101         (Free_list::num_allocates): New static data member.
4102         (Free_list::num_allocate_visits): New static data member.
4103         (Free_list::init): New function.
4104         (Free_list::remove): New function.
4105         (Free_list::allocate): New function.
4106         (Free_list::dump): New function.
4107         (Free_list::print_stats): New function.
4108         (Layout_task_runner::run): Resize output file for incremental updates.
4109         (Layout::Layout): Initialize new data members.
4110         (Layout::set_incremental_base): New function.
4111         (Layout::init_fixed_output_section): New function.
4112         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4113         incremental updates.
4114         (Layout::create_gold_note): Do not create gold note section for
4115         incremental updates.
4116         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4117         for incremental updates.
4118         (Layout::set_section_offsets): For incremental updates, allocate space
4119         from free list.
4120         (Layout::create_symtab_sections): Layout with offsets relative to
4121         start of section; for incremental updates, allocate space from free
4122         list.
4123         (Layout::create_shdrs): For incremental updates, allocate space from
4124         free list.
4125         (Layout::finish_dynamic_section): For incremental updates, do not
4126         check --as-needed (fixed in subsequent patch).
4127         * layout.h (class Free_list): New class.
4128         (Layout::set_incremental_base): New function.
4129         (Layout::incremental_base): New function.
4130         (Layout::init_fixed_output_section): New function.
4131         (Layout::allocate): New function.
4132         (Layout::incremental_base_): New data member.
4133         (Layout::free_list_): New data member.
4134         * main.cc (main): Print Free_list statistics.
4135         * object.cc (Relobj::finalize_incremental_relocs): Add
4136         clear_counts parameter; clear counts only when clear_counts is set.
4137         (Sized_relobj::Sized_relobj): Initialize new base class.
4138         (Sized_relobj::do_layout): Don't report special sections.
4139         (Sized_relobj::do_for_all_local_got_entries): New function.
4140         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4141         symtab_off to all symbol table offsets.
4142         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4143         * object.h (class Got_offset_list): Move to top of file.
4144         (Object::Object): Allow case where input_file == NULL.
4145         (Object::~Object): Likewise.
4146         (Object::input_file): Assert that input_file != NULL.
4147         (Object::lock): Allow case where input_file == NULL.
4148         (Object::unlock): Likewise.
4149         (Object::is_locked): Likewise.
4150         (Object::token): Likewise.
4151         (Object::release): Likewise.
4152         (Object::is_incremental): New function.
4153         (Object::get_mtime): New function.
4154         (Object::for_all_local_got_entries): New function.
4155         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4156         (Object::set_is_in_system_directory): New function.
4157         (Object::is_in_system_directory): New function.
4158         (Object::do_is_incremental): New function.
4159         (Object::do_get_mtime): New function.
4160         (Object::do_for_all_local_got_entries): New function.
4161         (Object::is_in_system_directory_): New data member.
4162         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4163         (class Sized_relobj_base): New class.
4164         (class Sized_relobj): Derive from Sized_relobj_base.
4165         (class Sized_relobj::Symbols): Redeclare from base class.
4166         (class Sized_relobj::local_got_offset_list): Remove.
4167         (class Sized_relobj::Output_sections): Redeclare from base class.
4168         (class Sized_relobj::do_for_all_local_got_entries): New function.
4169         (class Sized_relobj::write_local_symbols): Add offset parameter.
4170         (class Sized_relobj::local_symbol_offset_): Update comment.
4171         (class Sized_relobj::local_dynsym_offset_): Update comment.
4172         * options.cc (Input_arguments::add_file): Remove const.
4173         * options.h (Input_file_argument::Input_file_argument):
4174         Initialize arg_serial_ (all constructors).
4175         (Input_file_argument::set_arg_serial): New function.
4176         (Input_file_argument::arg_serial): New function.
4177         (Input_file_argument::arg_serial_): New data member.
4178         (Input_arguments::Input_arguments): Initialize file_count_.
4179         (Input_arguments::add_file): Remove const.
4180         (Input_arguments::number_of_input_files): New function.
4181         (Input_arguments::file_count_): New data member.
4182         (Command_line::number_of_input_files): Call
4183         Input_arguments::number_of_input_files.
4184         * output.cc (Output_segment_headers::Output_segment_headers):
4185         Set current size.
4186         (Output_section::Input_section::current_data_size): New function.
4187         (Output_section::Output_section): Initialize new data members.
4188         (Output_section::add_input_section): Don't do merge sections for
4189         an incremental link; allocate space from free list for an
4190         incremental update.
4191         (Output_section::add_output_section_data): Allocate space from
4192         free list for an incremental update.
4193         (Output_section::update_data_size): New function.
4194         (Output_section::set_fixed_layout): New function.
4195         (Output_section::reserve): New function.
4196         (Output_segment::set_section_addresses): Remove const.
4197         (Output_segment::set_section_list_addresses): Remove const; allocate
4198         space from free list for an incremental update.
4199         (Output_segment::set_offset): Adjust size of RELRO segment for an
4200         incremental update.
4201         * output.h (Output_data::current_data_size): Move here from
4202         child classes.
4203         (Output_data::pre_finalize_data_size): New function.
4204         (Output_data::update_data_size): New function.
4205         (Output_section_headers::update_data_size): new function.
4206         (Output_section_data_build::current_data_size): Move to Output_data.
4207         (Output_data_strtab::update_data_size): New function.
4208         (Output_section::current_data_size): Move to Output_data.
4209         (Output_section::set_fixed_layout): New function.
4210         (Output_section::has_fixed_layout): New function.
4211         (Output_section::reserve): New function.
4212         (Output_section::update_data_size): New function.
4213         (Output_section::has_fixed_layout_): New data member.
4214         (Output_section::free_list_): New data member.
4215         (Output_segment::set_section_addresses): Remove const.
4216         (Output_segment::set_section_list_addresses): Remove const.
4217         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4218         New function.
4219         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4220         New function.
4221         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4222         parameter when calling Add_symbols constructor; store argument
4223         serial number for members of a lib group.
4224         (Add_symbols::locks): Allow case where token == NULL.
4225         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4226         (Read_member::~Read_member): New function.
4227         (Read_member::is_runnable): New function.
4228         (Read_member::locks): New function.
4229         (Read_member::run): New function.
4230         (Check_script::~Check_script): New function.
4231         (Check_script::is_runnable): New function.
4232         (Check_script::locks): New function.
4233         (Check_script::run): New function.
4234         (Check_library::~Check_library): New function.
4235         (Check_library::is_runnable): New function.
4236         (Check_library::locks): New function.
4237         (Check_library::run): New function.
4238         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4239         (Add_symbols::library_): New data member.
4240         (class Read_member): New class.
4241         (class Check_script): New class.
4242         (class Check_library): New class.
4243         * reloc.cc (Read_relocs::is_runnable): Allow case where
4244         token == NULL.
4245         (Read_relocs::locks): Likewise.
4246         (Scan_relocs::locks): Likewise.
4247         (Relocate_task::locks): Likewise.
4248         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4249         to clear counters.
4250         (Sized_relobj::incremental_relocs_scan): Fix comment.
4251         (Sized_relobj::do_relocate): Pass output file offset to
4252         write_local_symbols.
4253         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4254         from class declaration.
4255         * script.cc (read_input_script): Allocate Script_info; pass
4256         argument serial number to report_script.
4257         * script.h (class Script_info): Move to incremental.h.
4258         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4259         * symtab.h (Symbol_table::add_from_incrobj): New function.
4260         (Symbol_table::set_file_offset): New function.
4261
4262 2011-04-05  Cary Coutant  <ccoutant@google.com>
4263
4264         * incremental-dump.cc (dump_incremental_inputs): Change signature
4265         to take a Sized_incremental_binary; change caller.  Use readers
4266         in Sized_incremental_binary.
4267         * incremental.cc
4268         (Sized_incremental_binary::find_incremental_inputs_sections):
4269         Rename do_find_incremental_inputs_sections to this.
4270         (Sized_incremental_binary::setup_readers): New function.
4271         (Sized_incremental_binary::do_check_inputs): Check
4272         has_incremental_info_ flag; move setup code to setup_readers;
4273         use input readers.
4274         (Sized_incremental_binary::do_file_is_unchanged): New function.
4275         (Sized_incremental_binary::do_get_input_reader): New function.
4276         * incremental.h (class Incremental_binary): Move to end of file.
4277         (Incremental_binary::file_is_unchanged): New function.
4278         (Incremental_binary::do_file_is_unchanged): New function.
4279         (Incremental_binary::Input_reader): New class.
4280         (Incremental_binary::get_input_reader): New function.
4281         (class Sized_incremental_binary): Move to end of file.
4282         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4283         input section reader classes.
4284         (Sized_incremental_binary::has_incremental_info): New function.
4285         (Sized_incremental_binary::inputs_reader): New function.
4286         (Sized_incremental_binary::symtab_reader): New function.
4287         (Sized_incremental_binary::relocs_reader): New function.
4288         (Sized_incremental_binary::got_plt_reader): New function.
4289         (Sized_incremental_binary::do_file_is_unchanged): New function.
4290         (Sized_incremental_binary::Sized_input_reader): New class.
4291         (Sized_incremental_binary::get_input_reader): New function.
4292         (Sized_incremental_binary::find_incremental_inputs_sections):
4293         Rename do_find_incremental_inputs_sections to this.
4294         (Sized_incremental_binary::setup_readers): New function.
4295         (Sized_incremental_binary::has_incremental_info_): New data member.
4296         (Sized_incremental_binary::inputs_reader_): New data member.
4297         (Sized_incremental_binary::symtab_reader_): New data member.
4298         (Sized_incremental_binary::relocs_reader_): New data member.
4299         (Sized_incremental_binary::got_plt_reader_): New data member.
4300         (Sized_incremental_binary::current_input_file_): New data member.
4301
4302 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4303
4304         PR gold/12640
4305         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4306         violation.
4307
4308 2011-03-30  Cary Coutant  <ccoutant@google.com>
4309
4310         * archive.cc (Archive::include_member): Adjust call to report_object.
4311         (Add_archive_symbols::run): Add script_info to call to
4312         report_archive_begin.
4313         (Lib_group::include_member): Adjust call to report_object.
4314         (Add_lib_group_symbols::run): Adjust call to report_object.
4315         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4316         blocks.  Add object count for script input files.
4317         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4318         script_info parameter; change all callers.
4319         (Incremental_inputs::report_object): Add script_info parameter;
4320         change all callers.
4321         (Incremental_inputs::report_script): Store backpointer to
4322         incremental info entry.
4323         (Output_section_incremental_inputs::set_final_data_size): Record
4324         additional information for scripts.
4325         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4326         * incremental.h (Incremental_script_entry::add_object): New function.
4327         (Incremental_script_entry::get_object_count): New function.
4328         (Incremental_script_entry::get_object): New function.
4329         (Incremental_script_entry::objects_): New data member; adjust
4330         constructor.
4331         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4332         (Incremental_inputs::report_object): Add script_info parameter.
4333         (Incremental_inputs_reader::get_object_count): New function.
4334         (Incremental_inputs_reader::get_object_offset): New function.
4335         * options.cc (Input_arguments::add_file): Return reference to
4336         new input argument.
4337         * options.h (Input_argument::set_script_info): New function.
4338         (Input_argument::script_info): New function.
4339         (Input_argument::script_info_): New data member; adjust all
4340         constructors.
4341         (Input_file_group::add_file): Return reference to new input argument.
4342         (Input_file_lib::add_file): Likewise.
4343         (Input_arguments::add_file): Likewise.
4344         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4345         * script.cc (Parser_closure::Parser_closure): Add script_info
4346         parameter; adjust all callers.
4347         (Parser_closure::script_info): New function.
4348         (Parser_closure::script_info_): New data member.
4349         (read_input_script): Report scripts earlier to incremental info.
4350         (script_add_file): Set script_info in Input_argument.
4351         (script_add_library): Likewise.
4352         * script.h (Script_options::Script_info): Rewrite class.
4353
4354 2011-03-29  Cary Coutant  <ccoutant@google.com>
4355
4356         * archive.cc (Library_base::should_include_member): Move
4357         method here from class Archive.
4358         (Archive::Archive): Initialize base class.
4359         (Archive::should_include_member): Move to base class.
4360         (Archive::do_for_all_unused_symbols): New function.
4361         (Add_archive_symbols::run): Remove redundant access to
4362         incremental_inputs.
4363         (Lib_group::Lib_group): Initialize base class.
4364         (Lib_group::do_filename): New function.
4365         (Lib_group::include_member): Pass pointer to Lib_group to
4366         report_object.
4367         (Lib_group::do_for_all_unused_symbols): New function.
4368         (Add_lib_group_symbols::run): Report archive information for
4369         incremental links.
4370         * archive.h (class Library_base): New base class.
4371         (class Archive): Derive from Library_base.
4372         (Archive::filename): Move to base class.
4373         (Archive::set_incremental_info): Likewise.
4374         (Archive::incremental_info): Likewise.
4375         (Archive::Should_include): Likewise.
4376         (Archive::should_include_member): Likewise.
4377         (Archive::Armap_entry): Remove.
4378         (Archive::Unused_symbol_iterator): Remove.
4379         (Archive::unused_symbols_begin): Remove.
4380         (Archive::unused_symbols_end): Remove.
4381         (Archive::do_filename): New function.
4382         (Archive::do_get_mtime): New function.
4383         (Archive::do_for_all_unused_symbols): New function.
4384         (Archive::task_): Move to base class.
4385         (Archive::incremental_info_): Likewise.
4386         (class Lib_group): Derive from Library_base.
4387         (Lib_group::do_filename): New function.
4388         (Lib_group::do_get_mtime): New function.
4389         (Lib_group::do_for_all_unused_symbols): New function.
4390         (Lib_group::task_): Move to base class.
4391         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4392         function.
4393         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4394         function.
4395         * incremental.cc (Incremental_inputs::report_archive_begin):
4396         Use Library_base; call library's get_mtime; add incremental inputs
4397         entry before members.
4398         (class Unused_symbol_visitor): New class.
4399         (Incremental_inputs::report_archive_end): Use Library_base; use
4400         visitor class to record unused symbols; don't add incremental inputs
4401         entry after members.
4402         (Incremental_inputs::report_object): Use Library_base.
4403         * incremental.h
4404         (Incremental_archive_entry::Incremental_archive_entry): Remove
4405         unused Archive parameter.
4406         (Incremental_inputs::report_archive_begin): Use Library_base.
4407         (Incremental_inputs::report_archive_end): Likewise.
4408         (Incremental_inputs::report_object): Likewise.
4409         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4410         function.
4411         * object.h (Object::for_all_global_symbols): New function.
4412         (Object::do_for_all_global_symbols): New function.
4413         (Sized_relobj::do_for_all_global_symbols): New function.
4414         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4415         function.
4416         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4417         function.
4418
4419 2011-03-27  Ian Lance Taylor  <iant@google.com>
4420
4421         * archive.cc (Archive::interpret_header): Return -1 if something
4422         goes wrong.  Change callers accordingly.
4423
4424 2011-03-25  Cary Coutant  <ccoutant@google.com>
4425
4426         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4427         * testsuite/Makefile.in: Regenerate.
4428
4429 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4430
4431         * plugin.cc (get_view): New.
4432         (Plugin::load): Pass get_view to the plugin.
4433         (Plugin_manager::get_view): New.
4434
4435 2011-03-21  Ian Lance Taylor  <iant@google.com>
4436
4437         * testsuite/final_layout.sh: Rewrite to not use dc.
4438         * testsuite/relro_test.sh: Fail if dc is not present.
4439
4440 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4441
4442         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4443         Change == to -eq.
4444         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4445         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4446         Change == to -eq.
4447         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4448         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4449
4450 2011-03-14  Ian Lance Taylor  <iant@google.com>
4451
4452         * script-sections.cc (Sort_output_sections::script_compare):
4453         Rename from is_before, change return type.
4454         (Sort_output_sections::operator()): Adjust accordingly.
4455
4456 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4457
4458         PR gold/12572
4459         * testsuite/odr_violation2.cc: Add comment to make all error line
4460         numbers double digits.
4461         * testsuite/debug_msg.sh: Adjust expected errors.
4462
4463 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4464
4465         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4466         but mark earlier ones as non-canonical
4467         (offset_to_iterator): Update search target and example
4468         (do_addr2line): Return extra lines in a vector*
4469         (format_file_lineno): Extract from do_addr2line
4470         (one_addr2line): Add vector* out-param
4471         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4472         when a lineno entry appeared last for its instruction
4473         (Dwarf_line_info): Add vector* out-param
4474         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4475         * symtab.cc (Odr_violation_compare): Include the lineno in the
4476         comparison again.
4477         (linenos_from_loc): New. Combine the canonical line for an
4478         address with its other lines.
4479         (True_if_intersect): New. Helper functor to make
4480         std::set_intersection a query.
4481         (detect_odr_violations): Compare sets of lines instead of just
4482         one line for each function. This became less deterministic, but
4483         has fewer false positives.
4484         * symtab.h: Declarations.
4485         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4486         mix an optimized and non-optimized object in the same binary
4487         (odr_violation2.so): Same.
4488         * testsuite/Makefile.in: Regenerate from Makefile.am.
4489         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4490         * testsuite/debug_msg.sh: Update line numbers and add
4491         assertions.
4492         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4493         non-optimized context.
4494         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4495         isn't inlined, and use OdrDerived in an optimized context.
4496         * testsuite/odr_header1.h: Defines OdrDerived, where
4497         optimization will change the
4498         first-instruction-in-the-destructor's file and line number.
4499         * testsuite/odr_header2.h: Defines OdrBase.
4500
4501 2011-03-09  Ian Lance Taylor  <iant@google.com>
4502
4503         * fileread.cc (File_read::clear_views): Don't delete the whole
4504         file view.
4505
4506 2011-03-08  Ian Lance Taylor  <iant@google.com>
4507
4508         PR gold/12525
4509         * fileread.cc: #include <climits>.
4510         (GOLD_IOV_MAX): Define.
4511         (File_read::read_multiple): Limit number of entries by iov_max.
4512         * fileread.h (class File_read): Always set max_readv_entries to
4513         128.
4514
4515 2011-03-07  Ian Lance Taylor  <iant@google.com>
4516
4517         PR gold/12525
4518         * options.h (class General_options): Add -dy and -dn.
4519
4520 2011-03-02  Cary Coutant  <ccoutant@google.com>
4521
4522         * testsuite/script_test_9.t: Add TLS segment.
4523
4524 2011-03-02  Simon Baldwin  <simonb@google.com>
4525
4526         * configure.ac: Add check for gnu_indirect_function support in
4527         the toolchain building binutils.
4528         * configure: Rebuild.
4529
4530 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4531
4532         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4533         plugin only symbols.
4534         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4535         in plugin files as not needed in the symbol table.
4536
4537 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4538
4539         * output.cc (Output_section::add_input_section): Delay fill
4540         generation for section ordering.
4541
4542 2011-02-09  Ian Lance Taylor  <iant@google.com>
4543
4544         PR gold/12316
4545         * object.h (class Sized_relobj): Remove clear_local_symbols.
4546         * reloc.cc (Sized_relobj::do_relocate): Don't call
4547         clear_local_symbols.
4548
4549 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4550
4551         * plugin.cc (is_visible_from_outside): Return true for symbols
4552         in the -u option.
4553
4554 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4555
4556         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4557         filename.
4558
4559 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4560
4561         * icf.h (is_section_foldable_candidate): Change type of parameter
4562         to std::string.
4563         * icf.cc (Icf::find_identical_sections): Change type of local variable
4564         section_name to be std::string.
4565         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4566
4567 2011-01-25  Ian Lance Taylor  <iant@google.com>
4568
4569         * script.cc (script_add_extern): Rewrite to use
4570         add_symbol_reference.
4571
4572 2011-01-25  Doug Kwan  <dougkwan@google.com>
4573
4574         * icf.cc (get_section_contents): Always lock section's object.
4575
4576 2011-01-24  Ian Lance Taylor  <iant@google.com>
4577
4578         * options.h (class General_options): Accept
4579         --no-detect-odr-violations.
4580
4581 2011-01-24  Ian Lance Taylor  <iant@google.com>
4582
4583         * version.cc (version_string): Bump to 1.11.
4584
4585 2011-01-24  Ian Lance Taylor  <iant@google.com>
4586
4587         * plugin.cc (class Plugin_rescan): Define new class.
4588         (Plugin_manager::claim_file): Set any_claimed_.
4589         (Plugin_manager::save_archive): New function.
4590         (Plugin_manager::save_input_group): New function.
4591         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4592         necessary.
4593         (Plugin_manager::new_undefined_symbol): New function.
4594         (Plugin_manager::rescan): New function.
4595         (Plugin_manager::rescannable_defines): New function.
4596         (Plugin_manager::add_input_file): Set any_added_.
4597         * plugin.h (class Plugin_manager): define new fields rescannable_,
4598         undefined_symbols_, any_claimed_, and any_added_.  Declare
4599         Plugin_rescan as friend.  Declare new functions.
4600         (Plugin_manager::Rescannable): Define type.
4601         (Plugin_manager::Rescannable_list): Define type.
4602         (Plugin_manager::Undefined_symbol_list): Define type.
4603         (Plugin_manager::Plugin_manager): Initialize new fields.
4604         * archive.cc (Archive::defines_symbol): New function.
4605         (Add_archive_symbols::run): Pass archive to plugins if any.
4606         * archive.h (class Archive): Declare defines_symbol.
4607         * readsyms.cc (Input_group::~Input_group): New function.
4608         (Finish_group::run): Pass input_group to plugins if any.
4609         * readsyms.h (class Input_group): Declare destructor.
4610         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4611         any.
4612
4613 2011-01-10  Ian Lance Taylor  <iant@google.com>
4614
4615         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4616         section as relro.
4617         (Layout::set_segment_offsets): Reset increase_relro before calling
4618         set_section_addresses a second time.
4619
4620 2011-01-04  Cary Coutant  <ccoutant@google.com>
4621
4622         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4623         sections before NOBITS sections.
4624
4625 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4626
4627         * version.cc (print_version): Update copyright to 2011.
4628
4629 2010-12-23  Cary Coutant  <ccoutant@google.com>
4630
4631         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4632         of OS to this->add.  Add OD parameter to second form of the function.
4633
4634 2010-12-20  Ian Lance Taylor  <iant@google.com>
4635
4636         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4637         second of two consecutive entries with same offset.
4638
4639 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4640
4641         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4642         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4643         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4644         to avoid unneeded links against $(LDADD).
4645         * testsuite/Makefile.in: Regenerate.
4646
4647 2010-12-15  Ian Lance Taylor  <iant@google.com>
4648
4649         PR gold/12324
4650         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4651         for R_X86_64_32 and R_X86_64_PC32.
4652         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4653         ver_matching_def_pic.o.
4654         (ver_matching_def_pic.o): New target.
4655
4656 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4657
4658         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4659         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4660         Move definition before File_read::View member definitions.
4661         (File_read::View::~View): Initialize and hold lock before
4662         updating current_mapped_bytes.
4663
4664 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4665
4666         * dwarf_reader.cc: Remove outdated comment.
4667         * gold-threads.cc: Fix typo in error message.
4668         * archive.cc: Fix typos in comments.
4669         * archive.h: Likewise.
4670         * arm-reloc-property.cc: Likewise.
4671         * arm-reloc-property.h: Likewise.
4672         * arm-reloc.def: Likewise.
4673         * arm.cc: Likewise.
4674         * attributes.h: Likewise.
4675         * cref.cc: Likewise.
4676         * ehframe.cc: Likewise.
4677         * fileread.h: Likewise.
4678         * gold.h: Likewise.
4679         * i386.cc: Likewise.
4680         * icf.cc: Likewise.
4681         * incremental.h: Likewise.
4682         * int_encoding.cc: Likewise.
4683         * layout.h: Likewise.
4684         * main.cc: Likewise.
4685         * merge.h: Likewise.
4686         * object.cc: Likewise.
4687         * object.h: Likewise.
4688         * options.cc: Likewise.
4689         * readsyms.cc: Likewise.
4690         * reduced_debug_output.cc: Likewise.
4691         * reloc.cc: Likewise.
4692         * script-sections.cc: Likewise.
4693         * sparc.cc: Likewise.
4694         * symtab.h: Likewise.
4695         * target-reloc.h: Likewise.
4696         * target.cc: Likewise.
4697         * target.h: Likewise.
4698         * timer.cc: Likewise.
4699         * timer.h: Likewise.
4700         * x86_64.cc: Likewise.
4701
4702 2010-12-09  Cary Coutant  <ccoutant@google.com>
4703
4704         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4705         stack.
4706         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4707         parameter; change all callers.
4708         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4709         * options.h (warn_execstack): New option.
4710
4711 2010-12-07  Doug Kwan  <dougkwan@google.com>
4712
4713         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4714         like function call relocations.
4715
4716 2010-12-07  Ian Lance Taylor  <iant@google.com>
4717
4718         * archive.cc (Archive::get_elf_object_for_member): Permit
4719         punconfigured to be NULL.
4720         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4721         (Archive::include_member): Pass NULL to get_elf_object_for_member
4722         if we searched for the archive and this is the first included
4723         object.
4724
4725 2010-12-01  Ian Lance Taylor  <iant@google.com>
4726
4727         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4728         track_relocs_type_ field.
4729         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4730         Set track_relocs_type_.
4731         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4732         contents when using RELA relocs.
4733         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4734         reloc_map_.
4735         * reloc.cc (Track_relocs::next_addend): New function.
4736         * reloc.h (class Track_relocs): Declare next_addend.
4737
4738 2010-12-01  Ian Lance Taylor  <iant@google.com>
4739
4740         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4741         virtual destructor.
4742
4743 2010-12-01  Ian Lance Taylor  <iant@google.com>
4744
4745         * README: Update compilers known to work and fail.
4746
4747 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4748
4749         * configure.in: For --enable-gold, handle value `default' instead of
4750         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4751         not the default.
4752         * configure: Regenerate.
4753
4754 2010-11-18  Doug Kwan  <dougkwan@google.com>
4755
4756         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4757         and right_alignment to be zero.  Store result alignment only if it is
4758         greater than existing alignment.
4759
4760 2010-11-16  Cary Coutant  <ccoutant@google.com>
4761
4762         PR gold/12220
4763         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4764         Check for ".zdebug_line".
4765
4766 2010-11-16  Doug Kwan  <dougkwan@google.com>
4767             Cary Coutant  <ccoutant@google.com>
4768
4769         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4770         by reference; adjust all callers.
4771         * output.cc (Output_segment::set_section_addresses): Adjust references
4772         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4773         list is empty.
4774         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4775         end at page boundary.
4776
4777 2010-11-16  Cary Coutant  <ccoutant@google.com>
4778
4779         PR gold/12220
4780         * layout.cc (Layout::choose_output_section): Transform names of
4781         compressed sections even when using a script with a SECTIONS clause.
4782         (Layout::output_section_name): Remove code to transform
4783         compressed debug section names.
4784         * output.cc (Output_section::add_input_section): Use uncompressed
4785         section size when tracking input sections.
4786
4787 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4788
4789         * symtab.h (Symbol::NON_PIC_REF): Remove.
4790         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4791         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4792         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4793         (Symbol::use_plt_offset): Take a flags argument and pass it
4794         directly to needs_dynamic_reloc.  Restrict check for undefined
4795         weak symbols to function calls.
4796         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4797         (Target_arm::Scan::global): Use it.
4798         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4799         (Target_arm::Relocate::relocate): Likewise.
4800         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4801         parameter with an r_type parameter.  Use get_reference_flags
4802         to get the flags.
4803         (Target_arm::Relocate::relocate): Update accordingly.
4804         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4805         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4806         (Target_i386::Scan::global): Likewise.
4807         (Target_i386::Relocate::relocate): Likewise.
4808         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4809         parameter with an r_type parameter.  Use get_reference_flags
4810         to get the flags.
4811         (Target_i386::Relocate::relocate): Update accordingly.
4812         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4813         (Target_powerpc::Scan::global): Use it.
4814         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4815         (Target_powerpc::Relocate::relocate): Likewise.
4816         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4817         (Target_sparc::Scan::global): Use it.
4818         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4819         (Target_sparc::Relocate::relocate): Likewise.
4820         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4821         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4822         (Target_x86_64::Scan::global): Likewise.
4823         (Target_x86_64::Relocate::relocate): Likewise.
4824
4825 2010-11-08  Doug Kwan  <dougkwan@google.com>
4826             Cary Coutant  <ccoutant@google.com>
4827
4828         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4829         (Arm_exidx_merge_section::section_contents_): New data member.
4830         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4831         (Arm_input_section::~Arm_input_section): De-allocate memory.
4832         (Arm_input_section::original_contents_): New data member.
4833         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4834         in parameters instead of calling Object::section_contents without
4835         locking.
4836         (Arm_output_section::group_section): New parameter TASK.  Pass it
4837         to callees that need locking objects.
4838         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4839         to lock EXIDX input sections.  Fix a formatting issue.  Call
4840         Arm_exidx_merged_section::build_contents to create merged section
4841         contents.
4842         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4843         to lock object of stub table owner.
4844         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4845         TEXT_SIZE to initialize data member TEXT_SIZE_.
4846         (Arm_exidx_input_section::addralign): Fix typo in comment.
4847         (Arm_exidx_input_section::text_size): New method.
4848         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4849         that require locking objects.  Lock objects before scanning for stubs
4850         and updating local symbols.
4851         (Arm_input_section<big_endian>::init): Copy contents of original
4852         input section.
4853         (Arm_input_section<big_endian>::do_write): Use saved contents of
4854         original input section instead of calling Object::section_contents
4855         without locking.
4856         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4857         size without calling Object::section_size().
4858         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4859         for size.  Allocate a buffer for merged EXIDX entries.
4860         (Arm_exidx_merged_section::build_contents): New method.
4861         (Arm_exidx_merged_section::do_write): Move merge section contents
4862         building code to Arm_exidx_merged_section::build_contetns.  Write
4863         out contetns in buffer instead of building it on the fly.
4864         (Arm_relobj::make_exidx_input_section): Also pass text section size
4865         to Arm_exidx_input_section constructor.
4866         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4867         (Arm_dynobj::do_read_symbols): Fix memory leak.
4868         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4869         * target.h: (class Task): Add forward declaration.
4870         (Target::relax): Add new parameter TASK and pass it to
4871         Target::do_relax().
4872         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4873
4874 2010-11-05  Cary Coutant  <ccoutant@google.com>
4875
4876         PR gold/10708
4877         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4878         object when reading from the file.
4879         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4880         second layout pass.
4881         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4882         when reading section contents.
4883         (get_section_contents): Likewise.
4884         (icf::find_identical_sections): Likewise.
4885         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4886         object when reading from the file.
4887         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4888         the object when doing deferred section layout.
4889
4890 2010-11-03  Nick Clifton  <nickc@redhat.com>
4891
4892         PR gold/12001
4893         * script.h (class Symbol_assignment: name): New member.  Returns
4894         the name of the symbol.
4895         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4896         Returns true if the given symbol name is on the list of
4897         assignments wating to be processed.
4898         * archive.cc (should_incldue_member): If the symbol is undefined,
4899         check to see if it is on the list of symbols pending assignment.
4900
4901 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4902
4903         * script-sections.cc (Script_sections::find_memory_region): Check
4904         for a NULL output section pointer.
4905
4906 2010-10-29  Doug Kwan  <dougkwan@google.com>
4907
4908         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4909         Output_section::add_relaxed_input_section.
4910         * output.cc (Output_section::add_relaxed_input_section): Add new
4911         arguments LAYOUT and NAME.  Set section order index.
4912         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4913         Copy section order index.
4914         * output.h (Output_section::add_relaxed_input_section): Add new
4915         arguments LAYOUT and NAME.
4916
4917 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4918
4919         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4920         NATIVE_OR_CROSS_LINKER.
4921         * testsuite/Makefile.in: Regenerate.
4922
4923 2010-10-20  Doug Kwan  <dougkwan@google.com>
4924
4925         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4926         without SHF_LINK_ORDER flags.
4927         * layout.cc (Layout::choose_output_section): Do not filter
4928         SHF_LINK_ORDER flag in a relocatable link.
4929
4930 2010-10-17  Cary Coutant  <ccoutant@google.com>
4931
4932         * output.h (Output_segment::set_section_addresses): Change function
4933         signature.  Update all callers.
4934         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4935         sections.
4936         (Output_segment::set_section_addresses): Align after last TLS
4937         section.  Add padding before last relro section instead of after.
4938
4939 2010-10-17  Doug Kwan  <dougkwan@google.com>
4940
4941         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4942         GOT output section to be writable.
4943
4944 2010-10-14  Cary Coutant  <ccoutant@google.com>
4945
4946         * debug.h (DEBUG_INCREMENTAL): New flag.
4947         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4948         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4949         mode.
4950         * incremental.cc (report_command_line): Ignore all forms of
4951         --incremental.
4952         * layout.cc (Layout::Layout): Check parameters for incremental link
4953         mode.
4954         * options.cc (General_options::parse_incremental): New function.
4955         (General_options::parse_no_incremental): New function.
4956         (General_options::parse_incremental_full): New function.
4957         (General_options::parse_incremental_update): New function.
4958         (General_options::incremental_mode_): New data member.
4959         (General_options::finalize): Check incremental_mode_.
4960         * options.h (General_options): Update help text for --incremental.
4961         Add --no-incremental, --incremental-full, --incremental-update.
4962         (General_options::Incremental_mode): New enum type.
4963         (General_options::incremental_mode): New function.
4964         (General_options::incremental_mode_): New data member.
4965         * parameters.cc (Parameters::incremental_mode_): New data member.
4966         (Parameters::set_options): Set incremental_mode_.
4967         (Parameters::set_incremental_full): New function.
4968         (Parameters::incremental): New function.
4969         (Parameters::incremental_update): New function.
4970         (set_parameters_incremental_full): New function.
4971         * parameters.h (Parameters::set_incremental_full): New function.
4972         (Parameters::incremental): New function.
4973         (Parameters::incremental_update): New function.
4974         (Parameters::incremental_mode_): New data member.
4975         (set_parameters_incremental_full): New function.
4976         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4977         incremental link mode.
4978         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4979         (Sized_relobj::do_relocate_sections): Likewise.
4980         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4981         option.
4982         * testsuite/Makefile.in: Regenerate.
4983         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4984
4985 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4986
4987         * script-sections.h (class Script_sections): Make
4988         Sections_elements typedef public.
4989         * script-sections.cc (class Sort_output_sections): Add elements_
4990         field.  Add constructor which sets it; change all callers.
4991         (Sort_output_sections::is_before): New function.
4992         (Sort_output_sections::operator()): Call is_before.
4993         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4994         conditional.
4995         * testsuite/script_test_10.sh: New test. Test script section
4996         order.
4997         * testsuite/script_test_10.t: Likewise.
4998         * testsuite/script_test_10.s: Likewise.
4999         * testsuite/Makefile.am: Wrap the cross linker tests and the
5000         common tests into NATIVE_OR_CROSS_LINKER.
5001         (check_SCRIPTS): Add script_test_10.sh.
5002         (check_DATA): Add script_test_10.stdout.
5003         (script_test_10.o, script_test_10): New targets.
5004         (script_test_10.stdout): New target.
5005         * configure, testsuite/Makefile.in: Regenerate.
5006
5007 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5008
5009         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5010         error for the deprecated relocations.
5011         (Target_arm::Scan::global): Likewise.
5012         (Target_arm::Relocate::relocate): Likewise.
5013
5014 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5015
5016         * fileread.cc (Input_file::find_file): Initialize *found_name
5017         and *namep when using the fallback search for case 4.
5018
5019 2010-10-11  Cary Coutant  <ccoutant@google.com>
5020
5021         * options.h (class General_options): Redefine -z lazy as an alias for
5022         the negation of -z now.
5023
5024 2010-10-11  Ian Lance Taylor  <iant@google.com>
5025
5026         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5027         binding.
5028
5029 2010-10-06  Nick Clifton  <nickc@redhat.com>
5030
5031         * script-sections.cc(class Memory_region): Remove
5032         current_lma_offset_ field.  Rename current_vma_offset_ to
5033         current_offset_.  Add last_section_ field.
5034         (Memory_region::get_current_vma_address): Rename to
5035         get_current_address.
5036         (Memory_region::get_current_lma_address): Delete.
5037         (Memory_region::increment_vma_offset): Rename to
5038         increment_offset.
5039         (Memory_region::increment_lma_offset): Delete.
5040         (Memory_region::attributes_compatible): New method.  Returns
5041         true if the provided section is compatible with the region.
5042         (Memory_region::get_last_section): New method.  Returns the last
5043         section to use the region.
5044         (Memory_region::set_last_section): New method.  Stores the last
5045         section to use the region.
5046         (Script_sections::block_in_region): New method.  Returns true if
5047         a block of memory is contained within a region.
5048         (Script_sections::find_memory_region): New method.  Locates a
5049         memory region to be used to set a VMA or LMA address.
5050         (Output_section_definition::set_section_addresses): Add code to
5051         check for addresses set by memory regions.
5052         (Output_segment::set_section_addresses): Remove memory region
5053         walking code.
5054         (Script_sections::create_segment): Add a warning if a header
5055         segment is created outside of any region.
5056         * script-sections.h (class Script_sections): Add prototypes for
5057         find_memory_region and block_in_region methods.
5058         * testsuite/memory_test.s: Use .long instead of .word.
5059         * testsuite/memory_test.t: Add some more output sections.
5060         * testsuite/memory_test.sh: Update expected output.
5061
5062 2010-10-02  Doug Kwan  <dougkwan@google.com>
5063
5064         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5065         defintion to symtab.h
5066         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5067         declaration to defintion.
5068
5069 2010-10-01  Nick Clifton  <nickc@redhat.com>
5070
5071         * expression.cc (eval): Replace dummy argument with NULL.
5072         (eval_maybe_dot): Check for a NULL result section pointer.
5073         (Symbol_expression::value): Likewise.
5074         (Dot_expression::value): Likewise.
5075         (BINARY_EXPRESSION): Likewise.
5076         (Max_expression::value): Likewise.
5077         (Min_expression::value): Likewise.
5078         (Absolute_expression::value): Likewise.
5079         (Addr_expression::value_from_output_section): Likewise.
5080         (Loaddddr_expression::value_from_output_section): Likewise.
5081         (Segment_start_expression::value): Likewise.
5082         * script-sections.cc
5083         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5084         argument with NULL.
5085         (Sections_elememt_dot_assignment::set_section_addresses):
5086         Likewise.
5087         (Output_data_expression::do_write_to_buffer): Likewise.
5088         (Output_section_definition::finalize_symbols): Likewise.
5089         (Output_section_definition::set_section_addresses): Likewise.
5090
5091 2010-09-30  Doug Kwan  <dougkwan@google.com>
5092
5093         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5094
5095 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5096
5097         * target.h (Target::can_icf_inline_merge_sections): New virtual
5098         function.
5099         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5100         virtual function.
5101         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5102         virtual function.
5103         * icf.cc (get_section_contents): Inline merge sections only when
5104         target allows it.
5105
5106 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5107
5108         * configure: Regenerate.
5109
5110 2010-09-17  Ian Lance Taylor  <iant@google.com>
5111
5112         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5113         * testsuite/Makefile.am (memory_test.o): New target.
5114         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5115         memory_test.t.
5116         * testsuite/Makefile.in: Rebuild.
5117
5118 2010-09-17  Doug Kwan  <dougkwan@google.com>
5119
5120         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5121         defintion if relocation uses GOT entries of the symbol.
5122         * testsuite/icf_safe_test.sh: Fix test.
5123         * testsuite/icf_safe_so_test.sh: Fix test.
5124
5125 2010-09-16  Cary Coutant  <ccoutant@google.com>
5126
5127         * script_sections.cc (class Memory_region): Remove "NULL" from
5128         vector initializations.
5129
5130 2010-09-15  Cary Coutant  <ccoutant@google.com>
5131
5132         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5133         Resolve forwarding symbols.
5134
5135 2010-09-15  Doug Kwan  <dougkwan@google.com>
5136
5137         * gold/testsuite/script_test_3.t: Add ARM special sections.
5138         * gold/testsuite/script_test_4.t: Same.
5139         * gold/testsuite/script_test_5.t: Same.
5140         * gold/testsuite/script_test_6.t: Same.
5141         * gold/testsuite/script_test_7.t: Same.
5142         * gold/testsuite/script_test_7.t: Same.
5143         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5144
5145 2010-09-14  Cary Coutant  <ccoutant@google.com>
5146
5147         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5148         (Target_x86_64::Relocate::relocate_tls): Replace check for
5149         saw_tls_block_reloc_ with test for executable section.
5150
5151 2010-09-12  Cary Coutant  <ccoutant@google.com>
5152
5153         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5154         position-independent executables to shared libraries need dynamic
5155         relocations.
5156         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5157         position-independent executables.
5158         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5159         * testsuite/Makefile.in: Regenerate.
5160
5161 2010-09-10  Nick Clifton  <nickc@redhat.com>
5162
5163         PR gold/11997
5164         * testsuite/memory_test.t: Discard any sections that are not
5165         needed.
5166
5167 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5168
5169         PR gold/11996
5170         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5171         "This::" to work around a bug in gcc 4.2.
5172
5173         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5174
5175 2010-09-09  Rafael Espindola  <espindola@google.com>
5176
5177         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5178         sections with different PF_X flags in the same segment.
5179         (Layout::find_first_load_seg): Search all segments to find the first
5180         one.
5181         * options.h (rosegment): New.
5182
5183 2010-09-08  Rafael Espindola  <espindola@google.com>
5184
5185         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5186
5187 2010-09-08  Doug Kwan  <dougkwan@google.com>
5188
5189         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5190         (Arm_relobj::do_relocate_sections): Add new parameter for output
5191         file to match the parent.
5192         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5193         of local symbols instead of input values.  Update code to track
5194         changes in gold::relocate_section.
5195         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5196         (Sized_relobj::compute_final_local_value_internal): New methods.
5197         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5198         body into private version of Sized_relobj::compute_final_local_value.
5199         Call the inline method.
5200         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5201         merged symbol value if there is one.
5202         (Symbol_value::has_output_value): New method defintiion.
5203         (Sized_relobj::Compute_final_local_value_status): New enum type.
5204         (Sized_relobj::compute_final_local_value): New methods.
5205         (Sized_relobj::compute_final_local_value_internal): New methods.
5206         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5207         and arm_cortex_a8.sh.
5208         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5209         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5210         New tests.
5211         * Makefile.in: Regenerate.
5212         * testsuite/arm_bl_out_of_range.s: Update test.
5213         * testsuite/thumb_bl_out_of_range.s: Ditto.
5214         * testsuite/thumb_blx_out_of_range.s: Ditto.
5215         * testsuite/arm_branch_out_of_range.sh: New file.
5216         * testsuite/arm_cortex_a8.sh: Ditto.
5217         * testsuite/arm_cortex_a8_b.s: Ditto.
5218         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5219         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5220         * testsuite/arm_cortex_a8_bl.s: Ditto.
5221         * testsuite/arm_cortex_a8_blx.s: Ditto.
5222         * testsuite/arm_cortex_a8_local.s: Ditto.
5223         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5224         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5225
5226 2010-09-08  Rafael Espindola  <espindola@google.com>
5227
5228         * Makefile.am (memory_test.stdout): Run readelf with -W.
5229         * Makefile.in: Regenerate.
5230         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5231         64 bit output.
5232
5233 2010-09-08  Rafael Espindola  <espindola@google.com>
5234
5235         * script-sections.cc (Script_sections::add_memory_region): Convert
5236         field precision to int.
5237         * script.cc (script_set_section_region, script_set_section_region):
5238         Convert field precision to int.
5239
5240 2010-09-08  Rafael Espindola  <espindola@google.com>
5241
5242         * arm.cc (do_finalize_sections): Create the __exidx_start and
5243         __exdix_end symbols even when the section is missing.
5244
5245 2010-09-08  Nick Clifton  <nickc@redhat.com>
5246
5247         * README: Remove claim that MEMORY is not supported.
5248         * expression.cc (script_exp_function_origin)
5249         (script_exp_function_length): Move from here to ...
5250         * script.cc: ... here.
5251         (script_set_section_region, script_add_memory)
5252         (script_parse_memory_attr, script_include_directive): New
5253         functions.
5254         * script-sections.cc
5255         (class Memory_region): New class.
5256         (class Output_section_definition): Add set_memory_region,
5257         set_section_vma, set_section_lma and get_section_name methods.
5258         (class Script_Sections): Add add_memory_region,
5259         find_memory_region, find_memory_region_origin,
5260         find_memory_region_length and set_memory_region methods.
5261         Have set_section_addresses method walk the list of set memory
5262         regions.
5263         Extend the print methos to display memory regions.
5264         * script-sections.h: Add prototypes for new methods.
5265         Add enum for MEMORY region attributes.
5266         * yyscript.y: Add support for parsing MEMORY regions.
5267         * script-c.h: Add prototypes for new functions.
5268         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5269         * testsuite/Makefile.in: Regenerate.
5270         * testsuite/memory_test.sh: New script.
5271         * testsuite/memory_test.s: New assembler source file.
5272         * testsuite/memory_test.t: New linker script.
5273
5274 2010-08-27  Doug Kwan  <dougkwan@google.com>
5275
5276         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5277         reference override an existing dynamic weak reference.
5278         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5279         * testsuite/Makefile.in: Regenerate.
5280         * testsuite/dyn_weak_ref.sh: New file.
5281         * testsuite/dyn_weak_ref_1.c: Ditto.
5282         * testsuite/dyn_weak_ref_2.c: Ditto.
5283
5284 2010-08-27  Ian Lance Taylor  <iant@google.com>
5285
5286         * incremental.h (class Incremental_input_entry): Add virtual
5287         destructor.
5288
5289 2010-08-27  Ian Lance Taylor  <iant@google.com>
5290
5291         * testsuite/start_lib_test_3.c: Mark t3 as used.
5292
5293 2010-08-27  Nick Clifton  <nickc@redhat.com>
5294
5295         * options.cc (version_script): Fix small typo in previous
5296         whitespace tidyup.
5297
5298 2010-08-25  Nick Clifton  <nickc@redhat.com>
5299
5300         * archive.cc: Formatting fixes: Remove whitespace between
5301         typename and following asterisk.  Remove whitespace between
5302         function name and opening parenthesis.
5303         * archive.h: Likewise.
5304         * arm.cc: Likewise.
5305         * attributes.cc: Likewise.
5306         * attributes.h: Likewise.
5307         * common.cc: Likewise.
5308         * copy-relocs.cc: Likewise.
5309         * dirsearch.h: Likewise.
5310         * dynobj.cc: Likewise.
5311         * ehframe.cc: Likewise.
5312         * ehframe.h: Likewise.
5313         * expression.cc: Likewise.
5314         * fileread.cc: Likewise.
5315         * fileread.h: Likewise.
5316         * gc.h: Likewise.
5317         * gold-threads.cc: Likewise.
5318         * gold.cc: Likewise.
5319         * i386.cc: Likewise.
5320         * icf.h: Likewise.
5321         * incremental-dump.cc: Likewise.
5322         * incremental.cc: Likewise.
5323         * layout.cc: Likewise.
5324         * layout.h: Likewise.
5325         * main.cc: Likewise.
5326         * merge.cc: Likewise.
5327         * merge.h: Likewise.
5328         * object.cc: Likewise.
5329         * object.h: Likewise.
5330         * options.cc: Likewise.
5331         * options.h: Likewise.
5332         * output.cc: Likewise.
5333         * output.h: Likewise.
5334         * plugin.cc: Likewise.
5335         * plugin.h: Likewise.
5336         * powerpc.cc: Likewise.
5337         * reloc.cc: Likewise.
5338         * script-c.h: Likewise.
5339         * script-sections.cc: Likewise.
5340         * script.cc: Likewise.
5341         * stringpool.cc: Likewise.
5342         * symtab.cc: Likewise.
5343         * symtab.h: Likewise.
5344         * target.cc: Likewise.
5345         * timer.cc: Likewise.
5346         * timer.h: Likewise.
5347         * version.cc: Likewise.
5348         * x86_64.cc: Likewise.
5349
5350 2010-08-24  Nick Clifton  <nickc@redhat.com>
5351
5352         PR 11899
5353         * layout.cc (segment_precedes): Sort segments by their physical
5354         addresses, if they have been set.
5355
5356 2010-08-23  Cary Coutant  <ccoutant@google.com>
5357
5358         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5359         symbols data.
5360         (Lib_group::include_member): Unlock object after deleting its
5361         symbols data.
5362         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5363         the bug fixed here.
5364
5365 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5366             Cary Coutant  <ccoutant@google.com>
5367
5368         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5369         constructor, and set_blocker.
5370         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5371         readsyms_blocker_.
5372         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5373         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5374         * testsuite/Makefile.am (start_lib_test): New test case.
5375         * testsuite/Makefile.in: Regenerate.
5376         * testsuite/start_lib_test_main.c: New file.
5377         * testsuite/start_lib_test_1.c: New file.
5378         * testsuite/start_lib_test_2.c: New file.
5379         * testsuite/start_lib_test_3.c: New file.
5380
5381 2010-08-19  Ian Lance Taylor  <iant@google.com>
5382
5383         * Makefile.in: Rebuild with automake 1.11.1.
5384         * aclocal.m4: Likewise.
5385         * testsuite/Makefile.in: Likewise.
5386
5387 2010-08-19  Ian Lance Taylor  <iant@google.com>
5388
5389         PR 10893
5390         * i386.cc (class Output_data_plt_i386): Update declarations.
5391         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5392         local_ifuncs_ fields.
5393         (Target_i386::do_plt_section_for_global): New function.
5394         (Target_i386::do_plt_section_for_local): New function.
5395         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5396         parameter; change all callers.  Initialize global_ifuncs_ and
5397         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5398         __rel_iplt_end.
5399         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5400         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5401         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5402         symbols.
5403         (Target_i386::make_plt_section): New function, broken out of
5404         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5405         (Target_i386::make_plt_entry): Call make_plt_section.
5406         (Target_i386::make_local_ifunc_plt_entry): New function.
5407         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5408         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5409         R_386_IRELATIVE to switch.
5410         (Target_i386::Scan::global): Likewise.
5411         (Target_i386::Relocate::relocate): Likewise.
5412         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5413         switch.
5414         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5415         (Target_x86_64::do_plt_section_for_global): New function.
5416         (Target_x86_64::do_plt_section_for_local): New function.
5417         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5418         parameter; change all callers.  If doing a static link define
5419         __rela_iplt_start and __rela_iplt_end.
5420         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5421         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5422         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5423         to point to .plt.
5424         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5425         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5426         switch.
5427         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5428         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5429         R_X86_64_IRELATIVE to switch.
5430         (Target_x86_64::Scan::global): Likewise.
5431         (Target_x86_64::Relocate::relocate): Likewise.
5432         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5433         switch.
5434         * target.h (class Target): Add plt_section_for_global and
5435         plt_section_for_local functions.  Add do_plt_section_for_global
5436         and do_plt_section_for_local virtual functions.
5437         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5438         clarifying comments.
5439         (Symbol::use_plt_offset): Handle IFUNC symbol.
5440         * object.cc (Sized_relobj::Sized_relobj): Initialize
5441         local_plt_offsets_.
5442         (Sized_relobj::local_has_plt_offset): New function.
5443         (Sized_relobj::local_plt_offset): New function.
5444         (Sized_relobj::set_local_plt_offset): New function.
5445         (Sized_relobj::do_count): Handle IFUNC symbol.
5446         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5447         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5448         is_ifunc_symbol functions.
5449         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5450         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5451         local_plt_offsets_ field.
5452         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5453         * output.h (class Output_section_data): Add non-const
5454         output_section function.
5455         (class Output_data_got): Update declarations.
5456         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5457         Add use_plt_offset parameter to global and local constructors.
5458         Change all callers.  Change local_sym_index_ field to 31 bits.
5459         Change GSYM_CODE and CONSTANT_CODE accordingly.
5460         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5461         doing a static link don't set sh_link field.
5462         (Output_data_got::Got_entry::write): Use PLT offset if
5463         appropriate.
5464         (Output_data_got::add_global_plt): New function.
5465         (Output_data_got::add_local_plt): New function.
5466         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5467         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5468         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5469         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5470         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5471         IFUNC conditional.
5472         * testsuite/ifunc-sel.h: New file.
5473         * testsuite/ifuncmain1.c: New file.
5474         * testsuite/ifuncmain1vis.c: New file.
5475         * testsuite/ifuncmod1.c: New file.
5476         * testsuite/ifuncdep2.c: New file.
5477         * testsuite/ifuncmain2.c: New file.
5478         * testsuite/ifuncmain3.c: New file.
5479         * testsuite/ifuncmod3.c: New file.
5480         * testsuite/ifuncmain4.c: New file.
5481         * testsuite/ifuncmain5.c: New file.
5482         * testsuite/ifuncmod5.c: New file.
5483         * testsuite/ifuncmain6pie.c: New file.
5484         * testsuite/ifuncmod6.c: New file.
5485         * testsuite/ifuncmain7.c: New file.
5486         * configure, testsuite/Makefile.in: Rebuild.
5487
5488 2010-08-18  Ian Lance Taylor  <iant@google.com>
5489
5490         * incremental.cc
5491         (Output_section_incremental_inputs::write_input_files): Add cast
5492         to avoid signed/unsigned comparison warning.
5493         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5494
5495 2010-08-12  Cary Coutant  <ccoutant@google.com>
5496
5497         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5498
5499 2010-08-13  Ian Lance Taylor  <iant@google.com>
5500
5501         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5502
5503 2010-08-12  Cary Coutant  <ccoutant@google.com>
5504             Doug Kwan  <dougkwan@google.com>
5505
5506         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5507         defintion overrides non-weak undef, remember that the original undef
5508         is not weak.
5509         * symtab.cc (Symbol_table::sized_write_global): For undef without
5510         an original weak binding, set binding to global in output.
5511         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5512         * testsuite/Makefile.in: Regenerate.
5513         * testsuite/strong_ref_weak_def.sh: New file.
5514         * testsuite/strong_ref_weak_def_1.c: Ditto.
5515         * testsuite/strong_ref_weak_def_2.c: Ditto.
5516
5517 2010-08-12  Cary Coutant  <ccoutant@google.com>
5518
5519         * testsuite/incremental_test.sh: Rewrite.
5520         * testsuite/incremental_test_1.c: Rewrite.
5521         * testsuite/incremental_test_2.c: Rewrite.
5522
5523 2010-08-12  Cary Coutant  <ccoutant@google.com>
5524
5525         * arm.cc (Target_arm::got_size): Add const.
5526         (Target_arm::got_entry_count): New function.
5527         (Target_arm::plt_entry_count): New function.
5528         (Target_arm::first_plt_entry_offset): New function.
5529         (Target_arm::plt_entry_size): New function.
5530         (Output_data_plt_arm::entry_count): New function.
5531         (Output_data_plt_arm::first_plt_entry_offset): New function.
5532         (Output_data_plt_arm::get_plt_entry_size): New function.
5533         * i386.cc (Target_i386::got_size): Add const.
5534         (Target_i386::got_entry_count): New function.
5535         (Target_i386::plt_entry_count): New function.
5536         (Target_i386::first_plt_entry_offset): New function.
5537         (Target_i386::plt_entry_size): New function.
5538         (Output_data_plt_i386::entry_count): New function.
5539         (Output_data_plt_i386::first_plt_entry_offset): New function.
5540         (Output_data_plt_i386::get_plt_entry_size): New function.
5541         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5542         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5543         * incremental.cc: Include target.h.
5544         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5545         parameter.  Adjust all callers.  Find incremental_got_plt section.
5546         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5547         section.
5548         (Output_section_incremental_inputs::set_final_data_size): Calculate
5549         size of incremental_got_plt section.
5550         (Output_section_incremental_inputs::do_write): Write the
5551         incremental_got_plt section.
5552         (Got_plt_view_info): New struct.
5553         (Local_got_offset_visitor): New class.
5554         (Global_got_offset_visitor): New class.
5555         (Global_symbol_visitor_got_plt): New class.
5556         (Output_section_incremental_inputs::write_got_plt): New function.
5557         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5558         Add parameter.  Adjust all callers.
5559         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5560         (Incremental_inputs::got_plt_section): New function.
5561         (Incremental_inputs::got_plt_section_): New data member.
5562         (Incremental_got_plt_reader): New class.
5563         * layout.cc (Layout::create_incremental_info_sections): Add the
5564         incremental_got_plt section.
5565         * object.h (Got_offset_list::get_list): New function.
5566         (Got offset_list::for_all_got_offsets): New function.
5567         (Sized_relobj::local_got_offset_list): New function.
5568         * powerpc.cc (Target_powerpc::got_size): Add const.
5569         (Target_powerpc::got_entry_count): New function.
5570         (Target_powerpc::plt_entry_count): New function.
5571         (Target_powerpc::first_plt_entry_offset): New function.
5572         (Target_powerpc::plt_entry_size): New function.
5573         (Output_data_plt_powerpc::entry_count): New function.
5574         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5575         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5576         * sparc.cc (Target_sparc::got_size): Add const.
5577         (Target_sparc::got_entry_count): New function.
5578         (Target_sparc::plt_entry_count): New function.
5579         (Target_sparc::first_plt_entry_offset): New function.
5580         (Target_sparc::plt_entry_size): New function.
5581         (Output_data_plt_sparc::entry_count): New function.
5582         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5583         (Output_data_plt_sparc::get_plt_entry_size): New function.
5584         * symtab.h (Symbol::got_offset_list): New function.
5585         (Symbol_table::for_all_symbols): New function.
5586         * target.h (Sized_target::got_entry_count): New function.
5587         (Sized_target::plt_entry_count): New function.
5588         (Sized_target::plt_entry_size): New function.
5589         * x86_64.cc (Target_x86_64::got_size): Add const.
5590         (Target_x86_64::got_entry_count): New function.
5591         (Target_x86_64::plt_entry_count): New function.
5592         (Target_x86_64::first_plt_entry_offset): New function.
5593         (Target_x86_64::plt_entry_size): New function.
5594         (Output_data_plt_x86_64::entry_count): New function.
5595         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5596         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5597
5598 2010-08-12  Cary Coutant  <ccoutant@google.com>
5599
5600         * archive.cc: Include incremental.h.
5601         (Archive::Archive): Initialize incremental_info_.
5602         (Archive::include_member): Record archive members in incremental info.
5603         (Add_archive_symbols::run): Record begin and end of an archive in
5604         incremental info.
5605         (Lib_group::include_member): Record objects in incremental info.
5606         * archive.h (Incremental_archive_entry): Forward declaration.
5607         (Archive::set_incremental_info): New member function.
5608         (Archive::incremental_info): New member function.
5609         (Archive::Unused_symbol_iterator): New class.
5610         (Archive::unused_symbols_begin): New member function.
5611         (Archive::unused_symbols_end): New member function.
5612         (Archive::incremental_info_): New data member.
5613         * incremental-dump.cc (find_input_containing_global): New function.
5614         (dump_incremental_inputs): Dump new incremental info sections.
5615         * incremental.cc: Include symtab.h.
5616         (Output_section_incremental_inputs): New class.
5617         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5618         new incremental info sections.
5619         (Sized_incremental_binary::do_check_inputs): Likewise.
5620         (Incremental_inputs::report_archive): Remove.
5621         (Incremental_inputs::report_archive_begin): New function.
5622         (Incremental_inputs::report_archive_end): New function.
5623         (Incremental_inputs::report_object): New function.
5624         (Incremental_inputs::finalize_inputs): Remove.
5625         (Incremental_inputs::report_input_section): New function.
5626         (Incremental_inputs::report_script): Rewrite.
5627         (Incremental_inputs::finalize): Do nothing but finalize string table.
5628         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5629         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5630         (Incremental_inputs::create_data_sections): New function.
5631         (Incremental_inputs::relocs_entsize): New function.
5632         (Output_section_incremental_inputs::set_final_data_size): New function.
5633         (Output_section_incremental_inputs::do_write): New function.
5634         (Output_section_incremental_inputs::write_header): New function.
5635         (Output_section_incremental_inputs::write_input_files): New function.
5636         (Output_section_incremental_inputs::write_info_blocks): New function.
5637         (Output_section_incremental_inputs::write_symtab): New function.
5638         * incremental.h (Incremental_script_entry): Forward declaration.
5639         (Incremental_object_entry): Forward declaration.
5640         (Incremental_archive_entry): Forward declaration.
5641         (Incremental_inputs): Forward declaration.
5642         (Incremental_inputs_header_data): Remove.
5643         (Incremental_inputs_header): Remove.
5644         (Incremental_inputs_header_write): Remove.
5645         (Incremental_inputs_entry_data): Remove.
5646         (Incremental_inputs_entry): Remove.
5647         (Incremental_inputs_entry_write): Remove.
5648         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5649         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5650         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5651         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5652         Likewise.
5653         (Incremental_input_entry): New class.
5654         (Incremental_script_entry): New class.
5655         (Incremental_object_entry): New class.
5656         (Incremental_archive_entry): New class.
5657         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5658         (Incremental_inputs::report_inputs): Remove.
5659         (Incremental_inputs::report_archive): Remove.
5660         (Incremental_inputs::report_archive_begin): New function.
5661         (Incremental_inputs::report_archive_end): New function.
5662         (Incremental_inputs::report_object): Change prototype.
5663         (Incremental_inputs::report_input_section): New function.
5664         (Incremental_inputs::report_script): Change prototype.
5665         (Incremental_inputs::get_reloc_count): New function.
5666         (Incremental_inputs::set_reloc_count): New function.
5667         (Incremental_inputs::create_data_sections): New function.
5668         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5669         (Incremental_inputs::inputs_section): New function.
5670         (Incremental_inputs::symtab_section): New function.
5671         (Incremental_inputs::relocs_section): New function.
5672         (Incremental_inputs::get_stringpool): Add const.
5673         (Incremental_inputs::command_line): Add const.
5674         (Incremental_inputs::inputs): Remove.
5675         (Incremental_inputs::command_line_key): New function.
5676         (Incremental_inputs::input_file_count): New function.
5677         (Incremental_inputs::input_files): New function.
5678         (Incremental_inputs::relocs_entsize): New function.
5679         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5680         (Incremental_inputs::finalize_inputs): Remove.
5681         (Incremental_inputs::Input_info): Remove.
5682         (Incremental_inputs::lock_): Remove.
5683         (Incremental_inputs::inputs_): Change type.
5684         (Incremental_inputs::inputs_map_): Remove.
5685         (Incremental_inputs::current_object_entry_): New data member.
5686         (Incremental_inputs::inputs_section_): New data member.
5687         (Incremental_inputs::symtab_section_): New data member.
5688         (Incremental_inputs::relocs_section_): New data member.
5689         (Incremental_inputs::reloc_count_): New data member.
5690         (Incremental_inputs_reader): New class.
5691         (Incremental_symtab_reader): New class.
5692         (Incremental_relocs_reader): New class.
5693         * layout.cc (Layout::finalize): Move finalization of incremental info
5694         and creation of incremental info sections to follow finalization of
5695         symbol table.  Set offsets for postprocessing sections.
5696         (Layout::create_incremental_info_sections): Call
5697         Incremental_inputs::create_data_sections.  Add incremental symtab
5698         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5699         sections to layout after input sections.
5700         * layout.h (struct Timespec): Forward declaration.
5701         (Layout::incremental_inputs): Add const.
5702         (Layout::create_incremental_info_sections): Add parameter.
5703         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5704         * object.cc: Include incremental.h.
5705         (Relobj::finalize_incremental_relocs): New function.
5706         (Sized_relobj::do_layout): Record input sections in incremental info.
5707         * object.h (Object::output_section): New function.
5708         (Object::output_section_offset): Moved from Relobj.
5709         (Object::get_incremental_reloc_base): New function.
5710         (Object::get_incremental_reloc_count): New function.
5711         (Object::do_output_section): New function.
5712         (Object::do_output_section_offset): Moved from Relobj.
5713         (Object::do_get_incremental_reloc_base): New function.
5714         (Object::do_get_incremental_reloc_count): New function.
5715         (Object::Object): Initialize new data members.
5716         (Relobj::output_section): Renamed do_output_section and moved to
5717         protected.
5718         (Relobj::output_section_offset): Moved to Object.
5719         (Relobj::do_get_incremental_reloc_base): New function.
5720         (Relobj::do_get_incremental_reloc_count): New function.
5721         (Relobj::allocate_incremental_reloc_counts): New function.
5722         (Relobj::count_incremental_reloc): New function.
5723         (Relobj::finalize_incremental_relocs): New function.
5724         (Relobj::next_incremental_reloc_index): New function.
5725         (Relobj::reloc_counts_): New data member.
5726         (Relobj::reloc_bases_): New data member.
5727         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5728         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5729         (Sized_relobj::incremental_relocs_scan): New function.
5730         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5731         (Sized_relobj::incremental_relocs_write): New function.
5732         (Sized_relobj::incremental_relocs_write_reltype): New function.
5733         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5734         incremental link.
5735         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5736         archives and object files elsewhere.
5737         (Add_symbols::run): Report object files here.
5738         (Finish_group::run): Report end of archive at end of group.
5739         * reloc.cc: Include layout.h, incremental.h.
5740         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5741         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5742         (Sized_relobj::incremental_relocs_scan): New function.
5743         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5744         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5745         (Sized_relobj::incremental_relocs_write): New function.
5746         (Sized_relobj::incremental_relocs_write_reltype): New function.
5747         * script.cc (read_input_script): Rewrite test for incremental link.
5748         Change call to Incremental_inputs::report_script.
5749         * symtab.h (Symbol_table::first_global_index): New function.
5750         (Symbol_table::output_count): New function.
5751
5752 2010-08-12  Doug Kwan  <dougkwan@google.com>
5753
5754         * arm.cc (Target_arm::merge_object_attributes): Check command line
5755         options --no-wchar-size-warning and --no-enum-size-warning.
5756         * options.h (General_options): Add ld-compatible options
5757         --no-enum-size-warning and --no-wchar-size-warning.
5758
5759 2010-08-04  Ian Lance Taylor  <iant@google.com>
5760
5761         * x86_64.cc (Target_x86_64::Scan::local): Use
5762         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5763         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5764         (Target_x86_64::Scan::global): Likewise.
5765         (Target_x86_64::Relocate::relocate): Likewise.
5766         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5767         Likewise.
5768
5769 2010-08-03  Cary Coutant  <ccoutant@google.com>
5770
5771         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5772         to reserve space in merged_strings vector. Keep total input size
5773         for stats.
5774         (Output_merge_string::do_print_merge_stats): Print total input size.
5775         * merge.h (Output_merge_string): Add input_size_ field.
5776         * stringpool.cc (Stringpool_template::string_length): Move
5777         implementations out of Stringpool_template class and place in
5778         stringpool.h.
5779         * stringpool.h (string_length): Move out of Stringpool_template.
5780
5781 2010-08-03  Ian Lance Taylor  <iant@google.com>
5782
5783         PR 11712
5784         * layout.cc (relaxation_loop_body): If address of load segment is
5785         set, adjust address to include headers if possible.
5786
5787 2010-08-03  Ian Lance Taylor  <iant@google.com>
5788
5789         * version.cc (version_string): Bump to 1.10.
5790
5791 2010-08-03  Ian Lance Taylor  <iant@google.com>
5792
5793         PR 11805
5794         * layout.h (enum Output_section_order): Define.
5795         (class Layout): Update declarations.
5796         * layout.cc (Layout::get_output_section): Add order parameter.
5797         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5798         is_first_non_relro parameters.  Change all callers.
5799         (Layout::choose_output_section): Likewise.
5800         (Layout::add_output_section_data): Likewise.
5801         (Layout::make_output_section): Likewise.  Set order.
5802         (Layout::default_section_order): New function.
5803         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5804         * output.cc (Output_section::Output_section): Initialize order_.
5805         Don't initialize deleted fields.
5806         (Output_segment::Output_segment): Don't initialize deleted
5807         fields.
5808         (Output_segment::add_output_section_to_load): New function
5809         replacing add_output_section.  Change all callers to call this or
5810         add_output_section_to_nonload.
5811         (Output_segment::add_output_section_to_nonload): New function.
5812         (Output_segment::remove_output_section): Rewrite.
5813         (Output_segment::add_initial_output_data): Likewise.
5814         (Output_segment::has_any_data_sections): Likewise.
5815         (Output_segment::is_first_section_relro): Likewise.
5816         (Output_segment::maximum_alignment): Likewise.
5817         (Output_segment::has_dynamic_reloc): New function replacing
5818         dynamic_reloc_count.  Change all callers.
5819         (Output_segment::has_dynamic_reloc_list): New function replacing
5820         dynamic_reloc_count_list.  Change all callers.
5821         (Output_segment::set_section_addresses): Rewrite.
5822         (Output_segment::set_offset): Rewrite.
5823         (Output_segment::find_first_and_last_list): Remove.
5824         (Output_segment::set_tls_offsets): Rewrite.
5825         (Output_segment::first_section_load_address): Likewise.
5826         (Output_segment::output_section_count): Likewise.
5827         (Output_segment::section_with_lowest_load_address): Likewise.
5828         (Output_segment::write_section_headers): Likewise.
5829         (Output_segment::print_sections_to_map): Likewise.
5830         * output.h (class Output_data): Remove dynamic_reloc_count_
5831         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5832         (Output_data::add_dynamic_reloc): Rewrite.
5833         (Output_data::has_dynamic_reloc): New function.
5834         (Output_data::dynamic_reloc_count): Remove.
5835         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5836         is_last_relro_, is_first_non_relro_, is_interp_,
5837         is_dynamic_linker_section_ fields.  Add order and set_order
5838         functions.  Remove is_relro_local, set_is_relro_local,
5839         is_last_relro, set_is_last_relro, is_first_non_relro,
5840         set_is_first_non_relro functions, is_interp, set_is_interp,
5841         is_dynamic_linker_section, and set_is_dynamic_linker_section
5842         functions.
5843         (class Output_segment): Change Output_data_list from std::list to
5844         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5845         output_bss_ fields.  Update declarations.
5846
5847 2010-08-02  Ian Lance Taylor  <iant@google.com>
5848
5849         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5850         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5851         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5852
5853 2010-08-02  Ian Lance Taylor  <iant@google.com>
5854
5855         PR 11855
5856         * script.cc (Script_options::Script_options): Initialize
5857         symbol_definitions_ and symbol_references_.
5858         (Script_options::add_symbol_assignment): Update
5859         symbol_definitions_ and symbol_references_.
5860         (Script_options::add_symbol_reference): New function.
5861         (script_symbol): New function.
5862         * script.h (class Script_options): Add symbol_definitions_ and
5863         symbol_references_ fields.
5864         (Script_options::referenced_const_iterator): New type.
5865         (Script_options::referenced_begin): New function.
5866         (Script_options::referenced_end): New function.
5867         (Script_options::is_referenced): New function.
5868         (Script_options::any_unreferenced): New function.
5869         * script-c.h (script_symbol): Declare.
5870         * yyscript.y (exp): Call script_symbol.
5871         * symtab.cc: Include "script.h".
5872         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5873         Change all callers.  Check symbols referenced by scripts.
5874         (Symbol_table::add_undefined_symbols_from_command_line): Add
5875         layout parameter.  Change all callers.
5876         (Symbol_table::do_add_undefined_symbols_from_command_line):
5877         Likewise.  Break out loop body.  Check symbols referenced by
5878         scripts.
5879         (Symbol_table::add_undefined_symbol_from_command_line): New
5880         function broken out of
5881         do_add_undefined_symbols_from_command_line.
5882         * symtab.h (class Symbol_table): Update declarations.
5883         * archive.cc: Include "layout.h".
5884         (Archive::should_include_member): Add layout parameter.  Change
5885         all callers.  Check for symbol mentioned in expression.
5886         * archive.h (class Archive): Update declaration.
5887         * object.cc (Sized_relobj::do_should_include_member): Add layout
5888         parameter.
5889         * object.h (Object::should_include_member): Add layout parameter.
5890         Change all callers.
5891         (Object::do_should_include_member): Add layout parameter.
5892         (class Sized_relobj): Update declaration.
5893         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5894         parameter.
5895         * dynobj.h (class Sized_dynobj): Update declaration.
5896         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5897         layout parameter.
5898         * plugin.h (class Sized_pluginobj): Update declaration.
5899
5900 2010-08-02  Ian Lance Taylor  <iant@google.com>
5901
5902         PR 11866
5903         * output.cc (Output_segment::set_offset): Search for the first and
5904         last sections rather than assuming that the list is in order.
5905         (Output_segment::find_first_and_last_list): New function.
5906         * output.h (class Output_segment): Update declarations.
5907         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5908         (relro_strip_test_SOURCES): New variable.
5909         (relro_strip_test_DEPENDENCIES): New variable.
5910         (relro_strip_test_LDFLAGS): New variable.
5911         (relro_strip_test_LDADD): New variable.
5912         (relro_strip_test.so): New target.
5913
5914 2010-08-02  Ian Lance Taylor  <iant@google.com>
5915
5916         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5917         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5918         (Target_i386::got_tlsdesc_section): New function.
5919         (Target_i386::got_section): Create space for GOT entries for
5920         TLSDESC relocations.
5921         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5922         R_386_TLS_GOTDESC.
5923         (Target_i386::Scan::global): Likewise.
5924         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5925         using TLSDESC GOT.
5926         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5927         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5928         (Target_x86_64::got_tlsdesc_section): New function.
5929         (Target_x86_64::got_section): Create space for GOT entries for
5930         TLSDESC relocations.
5931         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5932         R_386_TLS_GOTDESC.
5933         (Target_x86_64::Scan::global): Likewise.
5934         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5935         using TLSDESC GOT.
5936
5937 2010-08-02  Ian Lance Taylor  <iant@google.com>
5938
5939         * testsuite/final_layout.sh: Use dc to convert from hex to
5940         decimal.
5941
5942 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5943
5944         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5945         paramter to the call to gold::gc_process_relocs.
5946         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5947         paramter to the call to gold::gc_process_relocs.
5948         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5949         parameter to the call to gold::gc_process_relocs.
5950         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5951         template parameter to the call to gold::gc_process_relocs.
5952         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5953         paramter to the call to gold::gc_process_relocs.
5954         * gc.h (get_embedded_addend_size): New function.
5955         (gc_process_relocs): Save the size of the reloc for use by ICF.
5956         * icf.cc (get_section_contents): Get the addend from the text section
5957         for SHT_REL relocation sections.
5958         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5959         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5960         * int_encoding.h (read_from_pointer): New overloaded function.
5961         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5962         * testsuite/icf_sht_rel_addend_test.sh: New file.
5963         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5964         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5965
5966 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5967
5968         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5969         * Makefile.in: Regenerate.
5970         * testsuite/Makefile.in: Regenerate.
5971
5972 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5973
5974         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5975         * gold/testsuite/debug_msg.cc: Likewise.
5976         * gold/testsuite/odr_violation1.cc
5977         * gold/testsuite/odr_violation2.cc
5978
5979 2010-07-21  Cary Coutant  <ccoutant@google.com>
5980
5981         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5982         string, and length fields.
5983         (Output_merge_string::Merged_strings_list): New type.
5984         (Output_merge_string::Merged_strings_lists): New typedef.
5985         (Output_merge_string): Replace merged_strings_ with
5986         merged_strings_lists_.
5987         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5988         Merged_strings_list per input object and section.  Don't store pointer
5989         to the string.  Don't store length with each merged string entry.
5990         (Output_merge_string::finalize_merged_data): Loop over list of merged
5991         strings lists.  Recompute length of each merged string.
5992
5993 2010-07-15  Cary Coutant  <ccoutant@google.com>
5994
5995         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5996         here.
5997
5998 2010-07-14  Ian Lance Taylor  <iant@google.com>
5999
6000         * descriptors.cc (Descriptors::open): Report correct name in error
6001         message.
6002
6003 2010-07-13  Doug Kwan  <dougkwan@google.com>
6004
6005         * arm.cc (Arm_input_section::Arm_input_section): For a
6006         SHT_ARM_EXIDX section, always keeps the input sections.
6007         (Arm_input_section::set_exidx_section_link): New method.
6008         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6009         has_errors_ to false.
6010         (Arm_exidx_input_section::has_errors,
6011         Arm_exidx_input_section::set_has_errors): New methods.
6012         (Arm_exidx_input_section::has_errors_): New data member.
6013         (Arm_relobj::get_exidx_shndx_list): New method.
6014         (Arm_output_section::append_text_sections_to_list): Do not skip
6015         section without SHF_EXECINSTR.
6016         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6017         errors.
6018         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6019         section header.  Make error messages more verbose.  Check for
6020         a non-executable section linked to an EXIDX section.
6021         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6022         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6023         check that there is no deferred EXIDX section if we exit early.
6024         Instead of not making an EXIDX section in case of an error, make one
6025         and set the has_errors flag of it.
6026         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6027         in a relocatable link.
6028         (Target_arm::do_relax): Look for the EXIDX output section instead of
6029         assuming that it is called .ARM.exidx.
6030         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6031         section list.  Do not check for SHF_EXECINSTR section flags but
6032         skip any input section with errors.
6033         * output.cc (Output_section::Output_section): Initialize
6034         always_keeps_input_sections_ to false.
6035         (Output_section::add_input_section): Check for
6036         always_keeps_input_sections_.
6037         *  output.h (Output_section::always_keeps_input_sections,
6038         Output_section::set_always_keeps_input_sections): New methods.
6039         (Output_section::always_keeps_input_sections): New data member.
6040
6041 2010-07-13  Rafael Espindola  <espindola@google.com>
6042
6043         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6044         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6045
6046 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6047             Ian Lance Taylor  <iant@google.com>
6048
6049         * output.h (Output_section_lookup_maps::add_merge_section):
6050         Correct check of whether value was inserted.
6051         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6052         (Output_section_lookup_maps::add_relaxed_input_section):
6053         Likewise.
6054         * arm.cc (Target_arm::got_section): Remove used local os.
6055         * i386.cc (Target_i386::got_section): Likewise.
6056         * x86_64.cc (Target_x86_64::got_section): Likewise.
6057         * sparc.cc (Target_sparc::got_section): Likewise.
6058         (Target_sparc::relocate): Remove unused local have_got_offset.
6059         * powerpc.cc (Target_powerpc::relocate): Likewise.
6060
6061 2010-07-13  Ian Lance Taylor  <iant@google.com>
6062
6063         * compressed_output.cc (zlib_decompress): Fix signature in
6064         !HAVE_ZLIB_H case.
6065
6066         * archive.cc (Archive::include_member): Unlock an external member
6067         of a thin archive.  Don't bother to delete an object we know is
6068         NULL.
6069
6070 2010-07-12  Cary Coutant  <ccoutant@google.com>
6071
6072         * compressed_output.cc (zlib_decompress): New function.
6073         (get_uncompressed_size): New function.
6074         (decompress_input_section): New function.
6075         * compressed_output.h (get_uncompressed_size): New function.
6076         (decompress_input_section): New function.
6077         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6078         Handle compressed debug sections.
6079         * layout.cc (is_compressed_debug_section): New function.
6080         (Layout::output_section_name): Map compressed section names to
6081         canonical names.
6082         * layout.h (is_compressed_debug_section): New function.
6083         (is_debug_info_section): Recognize compressed debug sections.
6084         * merge.cc: Include compressed_output.h.
6085         (Output_merge_data::do_add_input_section): Handle compressed
6086         debug sections.
6087         (Output_merge_string::do_add_input_section): Handle compressed
6088         debug sections.
6089         * object.cc: Include compressed_output.h.
6090         (Sized_relobj::Sized_relobj): Initialize new data members.
6091         (build_compressed_section_map): New function.
6092         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6093         * object.h (Object::section_is_compressed): New method.
6094         (Object::do_section_is_compressed): New method.
6095         (Sized_relobj::Compressed_section_map): New type.
6096         (Sized_relobj::do_section_is_compressed): New method.
6097         (Sized_relobj::compressed_sections_): New data member.
6098         * output.cc (Output_section::add_input_section): Handle compressed
6099         debug sections.
6100         * reloc.cc: Include compressed_output.h.
6101         (Sized_relobj::write_sections): Handle compressed debug sections.
6102
6103 2010-07-08  Cary Coutant  <ccoutant@google.com>
6104
6105         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6106         weak when resolving to a dynamic def.
6107         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6108         for weak undef/dynamic def cases. Adjust callers.
6109         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6110         undef_binding_weak_.
6111         (Symbol_table::sized_write_globals): Adjust symbol binding.
6112         (Symbol_table::sized_write_symbol): Add binding parameter.
6113         * symtab.h (Symbol::set_undef_binding): New method.
6114         (Symbol::is_undef_binding_weak): New method.
6115         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6116         (Symbol_table::should_override): Add new parameter.
6117         (Symbol_table::sized_write_symbol): Add new parameter.
6118
6119         * testsuite/weak_undef_file1.cc: Add new test case.
6120         * testsuite/weak_undef_file2.cc: Fix header comment.
6121         * testsuite/weak_undef_test.cc: Add new test case.
6122
6123 2010-06-29  Doug Kwan  <dougkwan@google.com>
6124
6125         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6126         Initialize USE_SYMBOL_.
6127         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6128         definition.
6129         (Arm_reloc_property::uses_symbol_): New data member declaration.
6130         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6131         uses symbol value and symbol is undefined but not weakly undefined.
6132
6133 2010-06-28  Rafael Espindola  <espindola@google.com>
6134
6135         * plugin.cc (Plugin::load): Use dlerror.
6136
6137 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6138
6139         * symtab.cc (detect_odr_violations): When reporting an ODR
6140         violation, report an object where the symbol is defined.
6141
6142 2010-06-25  Doug Kwan  <dougkwan@google.com>
6143
6144         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6145         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6146         definition.
6147         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6148         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6149         target hook to detect function points.
6150         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6151         * icf.h (Icf::check_section_for_function_pointers): Change type of
6152         parameter SECTION_NAME to const reference to std::string.  Use
6153         target hook to determine if section may have unsafe pointers.
6154         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6155         method definition.
6156
6157 2010-06-21  Rafael Espindola  <espindola@google.com>
6158
6159         * fileread.cc (Input_file::find_fie): New
6160         (Input_file::open): Use Input_file::find_fie.
6161         * fileread.h (Input_file::find_fie): New
6162         * plugin.cc (set_extra_library_path): New.
6163         (Plugin::load): Add set_extra_library_path to the transfer vector.
6164         (Plugin_manager::set_extra_library_path): New.
6165         (Plugin_manager::add_input_file): Use the extra search path if set.
6166         (set_extra_library_path(): New.
6167         * plugin.h (Plugin_manager): Add set_extra_library_path and
6168         extra_search_path_.
6169
6170 2010-06-19  Cary Coutant  <ccoutant@google.com>
6171
6172         * layout.cc (gdb_sections): Add .debug_types.
6173         (lines_only_debug_sections): Likewise.
6174
6175 2010-06-18  Rafael Espindola  <espindola@google.com>
6176
6177         * plugin.cc (add_input_file,add_input_library)
6178         (Plugin_manager::add_input_file): Make filename arguments const.
6179         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6180         const.
6181
6182 2010-06-16  Doug Kwan  <dougkwan@google.com>
6183
6184         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6185         .ARM.attributes section if we have not merged any input
6186         attributes sections.
6187
6188 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6189
6190         * arm.cc: Allow combining objects with no EABI version
6191         information.
6192
6193 2010-06-15  Rafael Espindola  <espindola@google.com>
6194
6195         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6196
6197 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6198
6199         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6200         (struct iovec): Correct !HAVE_READV definition.
6201
6202 2010-06-10  Cary Coutant  <ccoutant@google.com>
6203
6204         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6205         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6206         reloc sections.
6207         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6208
6209         PR 11683
6210         * symtab.h (Symbol::is_placeholder): New member function.
6211         * target-reloc.h (relocate_section): Check for placeholder symbols.
6212
6213         * testsuite/Makefile.am (plugin_test_8): New test.
6214         (plugin_test_9): New test.
6215         * testsuite/Makefile.in: Regenerate.
6216
6217 2010-06-09  Nick Clifton  <nickc@redhat.com>
6218
6219         * yyscript.y (input_list_element): Allow strings prefixed with
6220         the '-' character.  Treat these as libraries.
6221         * script.cc (script_add_library): New function.  Adds a library
6222         specified by "-l<name>" found in an input script.
6223         * script-c.h: Add prototype for script_add_library.
6224
6225 2010-06-07  Doug Kwan  <dougkwan@google.com>
6226
6227         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6228         Restrict stub-group size to be within long conditional branch
6229         range when working around cortex-A8 erratum.
6230
6231 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6232
6233         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6234         #ifdef typo.
6235
6236 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6237
6238         PR gold/11658
6239         * output.cc
6240         (Output_section::Input_section_sort_entry::compare_section_ordering):
6241         Change to return non-zero correctly.
6242         (Output_section::Input_section_sort_section_order_index_compare
6243         ::operator()): Change to fix ambiguity in comparisons.
6244
6245 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6246
6247         * gold.h (is_wildcard_string): New function.
6248         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6249         (Layout::layout_eh_frame): Ditto.
6250         (Layout::find_section_order_index): New method.
6251         (Layout::read_layout_from_file): New method.
6252         * layout.h (Layout::find_section_order_index): New method.
6253         (Layout::read_layout_from_file): New method.
6254         (Layout::input_section_position_): New private member.
6255         (Layout::input_section_glob_): New private member.
6256         * main.cc (main): Call read_layout_from_file here.
6257         * options.h (--section-ordering-file): New option.
6258         * output.cc (Output_section::input_section_order_specified_): New
6259         member.
6260         (Output_section::Output_section): Initialize new member.
6261         (Output_section::add_input_section): Add new parameter.
6262         Keep input sections when --section-ordering-file is used.
6263         (Output_section::set_final_data_size): Sort input sections when
6264         section ordering file is specified.
6265         (Output_section::Input_section_sort_entry): Add new parameter.
6266         Check sorting type.
6267         (Output_section::Input_section_sort_entry::compare_section_ordering):
6268         New method.
6269         (Output_section::Input_section_sort_compare::operator()): Change to
6270         consider section_order_index.
6271         (Output_section::Input_section_sort_init_fini_compare::operator()):
6272         Change to consider section_order_index.
6273         (Output_section::Input_section_sort_section_order_index_compare
6274         ::operator()): New method.
6275         (Output_section::sort_attached_input_sections): Change to sort
6276         according to section order when specified.
6277         (Output_section::add_input_section<32, true>): Add new parameter.
6278         (Output_section::add_input_section<64, true>): Add new parameter.
6279         (Output_section::add_input_section<32, false>): Add new parameter.
6280         (Output_section::add_input_section<64, false>): Add new parameter.
6281         * output.h (Output_section::add_input_section): Add new parameter.
6282         (Output_section::input_section_order_specified): New
6283         method.
6284         (Output_section::set_input_section_order_specified): New method.
6285         (Input_section::Input_section): Initialize section_order_index_.
6286         (Input_section::section_order_index): New method.
6287         (Input_section::set_section_order_index): New method.
6288         (Input_section::section_order_index_): New member.
6289         (Input_section::Input_section_sort_section_order_index_compare): New
6290         struct.
6291         (Output_section::input_section_order_specified_): New member.
6292         * script-sections.cc (is_wildcard_string): Delete and move modified
6293         method to gold.h.
6294         (Output_section_element_input::Output_section_element_input): Modify
6295         call to is_wildcard_string.
6296         (Output_section_element_input::Input_section_pattern
6297         ::Input_section_pattern): Ditto.
6298         (Output_section_element_input::Output_section_element_input): Ditto.
6299         * testsuite/Makefile.am (final_layout): New test case.
6300         * testsuite/Makefile.in: Regenerate.
6301         * testsuite/final_layout.cc: New file.
6302         * testsuite/final_layout.sh: New file.
6303
6304 2010-06-01  Rafael Espindola  <espindola@google.com>
6305
6306         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6307
6308 2010-06-01  Rafael Espindola  <espindola@google.com>
6309
6310         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6311         visibility of symbols.
6312
6313 2010-05-27  Doug Kwan  <dougkwan@google.com>
6314
6315         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6316         from start of output section instead of address for a local symbol
6317         in a merged or relaxed section when doing a relocatable link.
6318
6319 2010-05-26  Rafael Espindola  <espindola@google.com>
6320
6321         PR 11604
6322         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6323         adding sections the garbage collector removed.
6324         * gold/testsuite/Makefile.am: Add test.
6325         * gold/testsuite/Makefile.in: Regenerate.
6326         * gold/testsuite/plugin_test_7.sh: New.
6327         * gold/testsuite/plugin_test_7_1.c: New.
6328         * gold/testsuite/plugin_test_7_2.c: New.
6329
6330 2010-05-26  Rafael Espindola  <espindola@google.com>
6331
6332         * script-sections.cc (Output_section_definition::set_section_addresses):
6333         Check for --section-start.
6334
6335 2010-05-26  Doug Kwan  <dougkwan@google.com>
6336
6337         * arm.cc (Arm_scan_relocatable_relocs): New class.
6338         (Target_arm::relocate_special_relocatable): New method.
6339         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6340         (Arm_relocate_functions::thumb_branch_common): Same.
6341         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6342         instead of Default_scan_relocatable_relocs.
6343         * target-reloc.h (relocate_for_relocatable): Let target handle
6344         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6345         * target.h (Sized_target::relocate_special_relocatable): New method.
6346
6347 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6348
6349         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6350
6351 2010-05-23  Doug Kwan  <dougkwan@google.com>
6352
6353         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6354         instead of a cast.
6355         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6356         with a direct branch, not a conditional branch, to a stub.
6357         * merge.cc (Output_merge_base::record_input_section): New method
6358         defintion.
6359         (Output_merge_data::do_add_input_section): Record input section if
6360         keeps-input-sections flag is set.
6361         (Output_merge_string::do_add_input_section): Ditto.
6362         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6363         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6364         INPUT_SECTIONS_.
6365         (Output_merge_base::keeps_input_sections,
6366         Output_merge_base::set_keeps_input_sections,
6367         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6368         method definitions.
6369         (Output_merge_base::Input_sections): New type declaration.
6370         (Output_merge_base::input_sections_begin,
6371         Output_merge_base::input_sections_end,
6372         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6373         (Output_merge_base::bool keeps_input_sections_,
6374         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6375         Output_merge_base::input_sections_): New data members.
6376         (Output_merge_data::do_set_keeps_input_sections): New method
6377         defintion.
6378         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6379         * output.cc (Output_section::Input_section::relobj): Move method
6380         defintion from class declaration to here and handle merge sections.
6381         (Output_section::Input_section::shndx): Ditto.
6382         (Output_section::Output_section): Remove initializations of removed
6383         data members and initialize new data member LOOKUP_MAPS_.
6384         (Output_section::add_input_section): Set keeps-input-sections flag
6385         for a newly created merge output section as appropriate.  Adjust code
6386         to use Output_section_lookup_maps class.
6387         (Output_section::add_relaxed_input_section): Adjst code for lookup
6388         maps code refactoring.
6389         (Output_section::add_merge_input_section): Add a new parameter
6390         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6391         class.  If adding input section to a newly created merge output
6392         section fails, remove the new merge section.
6393         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6394         Adjust code for use of the Output_section_lookup_maps class.
6395         (Output_section::find_merge_section): Ditto.
6396         (Output_section::build_lookup_maps): New method defintion.
6397         (Output_section::find_relaxed_input_section): Adjust code to use
6398         Output_section_lookup_maps class.
6399         (Output_section::get_input_sections): Export merge sections.  Adjust
6400         code to use Output_section_lookup_maps class.
6401         (Output_section:::add_script_input_section): Adjust code to use
6402         Output_section_lookup_maps class.  Update lookup maps for merge
6403         sections also.
6404         (Output_section::discard_states): Use Output_section_lookup_maps.
6405         (Output_section::restore_states): Same.
6406         * output.h (Merge_section_properties): Move class defintion out of
6407         Output_section.
6408         (Output_section_lookup_maps): New class.
6409         (Output_section::Input_section::is_merge_section): New method
6410         defintion.
6411         (Output_section::Input_section::relobj): Move defintion out of class
6412         defintion.  Declare method only.
6413         (Output_section::Input_section::shndx): Ditto.
6414         (Output_section::Input_section::output_merge_base): New method defintion.
6415         (Output_section::Input_section::u2_.pomb): New union field.
6416         (Output_section::Merge_section_by_properties_map,
6417         Output_section::Output_section_data_by_input_section_map,
6418         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6419         Remove types.
6420         (Output_section::add_merge_input_section): Add new parameter
6421         KEEPS_INPUT_SECTIONS.
6422         (Output_section::build_lookup_maps): New method declaration.
6423         (Output_section::merge_section_map_,
6424         Output_section::merge_section_by_properties_map_,
6425         Output_section::relaxed_input_section_map_,
6426         Output_section::is_relaxed_input_section_map_valid_): Remove data
6427         members.
6428         (Output_section::lookup_maps_): New data member.
6429
6430 2010-05-21  Doug Kwan  <dougkwan@google.com>
6431
6432         PR gold/11619
6433         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6434         avoid a compilation error.
6435
6436 2010-05-19  Rafael Espindola  <espindola@google.com>
6437
6438         * script-sections.cc (Output_section_definition::allocate_to_segment):
6439         Update the phdrs_list even when the output section is NULL.
6440         * testsuite/Makefile.am: Add test.
6441         * testsuite/Makefile.in: Regenerate.
6442         * testsuite/script_test_9.cc: New.
6443         * testsuite/script_test_9.sh: New.
6444         * testsuite/script_test_9.t: New.
6445
6446 2010-05-19  Doug Kwan  <dougkwan@google.com>
6447
6448         * arm.cc (Arm_input_section::original_size): New method.
6449         (Arm_input_section::do_addralign): Add a cast.
6450         (Arm_input_section::do_output_offset): Remove static cast.
6451         (Arm_input_section::original_addralign,
6452          Arm_input_section::original_size_): Change type to uint32_t.
6453         (Arm_input_section::init): Add safe casts for section alignment
6454         and size.
6455         (Arm_input_section::set_final_data_size): Do not set address and
6456         offset of stub table.
6457         (Arm_output_section::fix_exidx_coverage): Change use of of
6458         Output_section::Simple_input_section to that of
6459         Output_section::Input_section.
6460         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6461         except for the first pass.
6462         * output.cc (Output_section::get_input_sections): Change type of
6463         input_sections to std::list<Input_section>.
6464         (Output_section::add_script_input_section): Rename from
6465         Output_section::add_simple_input_section.  Change type of SIS
6466         parameter from Simple_input_section to Input_section.
6467         * output.h (Output_section::Simple_input_section): Remove class.
6468         (Output_section::Input_section): Change class visibility to public.
6469         (Output_section::Input_section::addralign): Use stored alignments
6470         for special input sections if set.
6471         (Output_section::Input_section::set_addralign): New method.
6472         (Output_section::get_input_sections): Change parameter type from
6473         list of Simple_input_section to list of Input_section.
6474         (Output_section::add_script_input_section): Rename from
6475         Output_section::add_simple_input_section. Change first parameter's
6476         type from Simple_input_section to Input_section and remove the
6477         second and third parameters.
6478         * script-sections.cc (Input_section::Input_section_list): Change
6479         type to list of Output_section::Input_section/
6480         (Input_section_info::Input_section_info): Change parameter type of
6481         INPUT_SECTION to Output_section::Input_section.
6482         (Input_section_info::input_section): Change return type.
6483         (Input_section_info::input_section_): Change type to
6484         Output_section::Input_section.
6485         (Output_section_element_input::set_section_addresses): Adjust code
6486         to use Output_section::Input_section instead of
6487         Output_section::Simple_input_section.  Adjust code for renaming
6488         of Output_section::add_simple_input_section.
6489         (Orphan_output_section::set_section_addresses): Ditto.
6490
6491 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6492
6493         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6494         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6495
6496 2010-05-18  Rafael Espindola  <espindola@google.com>
6497
6498         * options.cc (General_options::finalize): Handle -nostdlib.
6499         * options.h (nostdlib): New option.
6500         * script.cc (script_add_search_dir): Handle -nostdlib.
6501
6502 2010-05-12  Doug Kwan  <dougkwan@google.com>
6503
6504         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6505         attributes section only if there no attributes section after merging.
6506         (Target_arm::merge_object_attributes): Move value of
6507         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6508         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6509         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6510         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6511         and arm_attr_merge_7.stdout.
6512         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6513         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6514         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6515         arm_attr_merge_7b.o): New rules.
6516         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6517         arm_attr_merge_7
6518         * testsuite/Makefile.in: Regenerate.
6519         * testsuite/arm_attr_merge.sh: New file.
6520         * testsuite/arm_attr_merge_[67][ab].s: Same.
6521
6522 2010-05-05  Nick Clifton  <nickc@redhat.com>
6523
6524         * po/es.po: Updated Spanish translation.
6525
6526 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6527
6528         * Makefile.am (install-exec-local): Properly install gold as
6529         default cross linker.
6530         * Makefile.in: Regenerated.
6531
6532 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6533             Nick Clifton  <nickc@redhat.com>
6534
6535         * configure.ac (install_as_default): Define and set to false
6536         unless --enable-gold or --enable-gold=both/gold has been
6537         specified.
6538         * configure: Regenerate.
6539
6540         * Makefile.am (install-exec-local): Install the executable as
6541         'ld.gold'.  If install_as_default is true then also install it as
6542         'ld'.
6543         * Makefile.in: Regenerated.
6544
6545 2010-04-24  Ian Lance Taylor  <iant@google.com>
6546
6547         * layout.cc (Layout::layout_reloc): In relocatable link don't
6548         combine reloc sections for grouped sections.
6549
6550 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6551
6552         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6553         sections that are not ordinary to icf.
6554         * icf.cc (get_section_contents): Handle relocation pointing to section
6555         with no object or shndx information.
6556         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6557         * testsuite/Makefile.in: Regenerate.
6558         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6559         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6560
6561 2010-04-22  Ian Lance Taylor  <iant@google.com>
6562
6563         * expression.cc (Expression::Expression_eval_info): Add
6564         result_alignment_pointer field.
6565         (Expression::eval_with_dot): Add result_alignment_pointer
6566         parameter.  Change all callers.
6567         (Expression::eval_maybe_dot): Likewise.
6568         (class Binary_expression): Add alignment_pointer parameter to
6569         left_value and right_value.  Change all callers.
6570         (BINARY_EXPRESSION): Set result alignment.
6571         (class Trinary_expression): Add alignment_pointer parameter to
6572         arg2_value and arg3_value.  Change all callers.
6573         (Trinary_cond::value): Set result alignment.
6574         (Max_expression::value, Min_expression::value): Likewise.
6575         (Align_expression::value): Likewise.
6576         * script-sections.cc (class Sections_element): Add dot_alignment
6577         parameter to set_section_addresses virtual function.  Update
6578         instantiations.
6579         (class Output_section_element): Likewise.
6580         (Script_sections::create_segments): Add dot_alignment parameter.
6581         Change all callers.
6582         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6583         (Script_sections::set_phdrs_clause_addresses): Likewise.
6584         * script-sections.h: Update declarations.
6585         * script.h: Update declarations.
6586         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6587         min_p_align.
6588         * testsuite/script_test_3.t: Set large alignment.
6589         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6590         segment has expected alignment.
6591
6592 2010-04-22  Nick Clifton  <nickc@redhat.com>
6593
6594         * po/gold.pot: Updated by the Translation project.
6595         * po/vi.po: Updated Vietnamese translation.
6596
6597 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6598
6599         * testsuite/Makefile.am (check_PROGRAMS): Add
6600         icf_virtual_function_folding_test.
6601         * testsuite/Makefile.in: Regenerated.
6602
6603 2010-04-15  Andrew Haley  <aph@redhat.com>
6604
6605         * options.h (merge_exidx_entries): New option.
6606         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6607         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6608         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6609         (Target_arm::merge_exidx_entries): New function.
6610         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6611         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6612         to Arm_exidx_fixup constructor.
6613         Add new arg, merge_exidx_entries.
6614         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6615         Arm_output_section::fix_exidx_coverage.
6616
6617 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6618
6619         * icf.cc (get_section_contents): Check for preemptible functions.
6620         Ignore addend when appropriate.
6621         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6622         section folded.
6623         (add_from_relobj): Check for section folded.
6624         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6625         * symtab.h (should_add_dynsym_entry): Add new parameter.
6626         * target-reloc.h (scan_relocs): Check for section folded.
6627         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6628         Check reloc types for function pointers in shared objects.
6629         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6630         case.
6631         (icf_preemptible_functions_test): New test case.
6632         (icf_string_merge_test): New test case.
6633         * testsuite.Makefile.in: Regenerate.
6634         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6635         bar_glob.  Refactor code.
6636         * testsuite/icf_preemptible_functions_test.cc: New file.
6637         * testsuite/icf_preemptible_functions_test.sh: New file.
6638         * testsuite/icf_string_merge_test.cc: New file.
6639         * testsuite/icf_string_merge_test.sh: New file.
6640         * testsuite/icf_virtual_function_folding_test.cc: New file.
6641         * testsuite/icf_virtual_function_folding_test.sh: New file.
6642
6643 2010-04-14  Doug Kwan  <dougkwan@google.com>
6644
6645         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6646         for local symbol recounting if we remove a section due to ICF.
6647         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6648         there are no regular objects in input.
6649
6650 2010-04-13  Doug Kwan  <dougkwan@google.com>
6651
6652         * arm.cc (Arm_input_section::set_final_data_size): Compute
6653         accurate final data size instead of using current data size.
6654
6655 2010-04-09  Doug Kwan  <dougkwan@google.com>
6656
6657         * layout.cc (Layout::choose_output_section): Handle script section
6658         types.
6659         (Layout::make_output_section_for_script): Add section type parameter.
6660         Handle script section types.
6661         * layout.h (Layout::make_output_section_for_script): Add section
6662         type parameter.
6663         * output.cc (Output_section::Output_section): Initialize data member
6664         is_noload_.
6665         (Output_section::do_reset_address_and_file_offset): Do not set address
6666         to 0 if section is a NOLOAD section.
6667         * output.h (Output_section::is_noload): New method.
6668         (Output_section::set_is_noload): Ditto.
6669         (Output_section::is_noload_): New data member.
6670         * script-c.h (Script_section_type): New enum type.
6671         (struct Parser_output_section_header): Add new file section_type.
6672         * script-sections.cc (Sections_element::output_section_name): Add
6673         parameter for returning script section type.
6674         (Output_section_definition::output_section_name): Ditto.
6675         (Output_section_definition::section_type)P; New method.
6676         (Output_section_definiton::script_section_type_name): Ditto.
6677         (Output_section_definition::script_section_type_): New data member.
6678         (Output_section_definition::Output_section_definition): Initialize
6679         data member Output_section_definition::script_section_type_.
6680         (Output_section_definition::create_sections): Pass script section type
6681         to Layout::make_output_section_for_script.
6682         (Output_section_definition::output_section_name): Return script
6683         section type to caller.
6684         (Output_section_definition::set_section_address): Do not advance
6685         dot value and load address if section type is NOLOAD.  Set address
6686         of NOLOAD sections regardless of section flags.
6687         (Output_section_definition::print): Print section type if it is
6688         not SCRIPT_SECTION_TYPE_NONE.
6689         (Output_section_definition::section_type): New method.
6690         (Output_section_definition::script_section_type_name): Ditto.
6691         (Script_sections::output_section_name): Add new parameter
6692         PSECTION_TYPE for returning script section type.  Pass it to
6693         section elements.  Handle discard sections.
6694         (Sort_output_sections::operator()): Handle NOLOAD sections.
6695         * script-sections.h (Script_sections::Section_type): New enum type.
6696         (Script_sections::output_section_name): Add a new parameter for
6697         returning script section type.
6698         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6699         INFO and NOLOAD.
6700         * yyscript.y (union): Add new field SECTION_TYPE.
6701         (COPY, DSECT, INFO, NOLOAD): New tokens.
6702         (opt_address_and_section_type): Change type to output_section_header.
6703         (section_type): New non-terminal
6704         (section_header): Handle section type.
6705         (opt_address_and_section_type): Return section type value.
6706
6707 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6708
6709         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6710         * testsuite/plugin_common_test_2.c (foo): Likewise.
6711
6712 2010-04-08  Doug Kwan  <dougkwan@google.com>
6713
6714         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6715         Output_merge_data.
6716         * output.cc (Output_section::add_merge_input_section): Simplify
6717         code and return status of Output_merge_base::add_input_section.
6718         Update merge section map only if Output_merge_base::add_input_section
6719         returns true.
6720
6721 2010-04-07  Doug Kwan  <dougkwan@google.com>
6722
6723         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6724         if section is marked as containing instructions but has no mapping
6725         symbols.
6726         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6727         correct section index.
6728         (Arm_relobj::find_linked_text_section): Ditto.
6729
6730 2010-04-07  Cary Coutant  <ccoutant@google.com>
6731
6732         * archive.cc (include_member): Destroy Read_symbols_data object before
6733         releasing file.
6734         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6735         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6736         (Read_symbols_data::~Read_symbols_data) New destructor.
6737         (Section_relocs::Section_relocs) New constructor.
6738         (Section_relocs::~Section_relocs) New destructor.
6739         (Read_relocs_data::Read_relocs_data) New constructor.
6740         (Read_relocs_data::~Read_relocs_data) New destructor.
6741         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6742         pointers to NULL after deleting.
6743
6744 2010-04-07  Doug Kwan  <dougkwan@google.com>
6745
6746         * arm.cc: Replace "endianity" with "endianness" in comments.
6747         (Arm_exidx_cantunwind): Ditto.
6748         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6749         (Arm_relobj::merge_flags_and_attributes): New method.
6750         (Arm_relobj::merge_flags_and_attributes_): New data member.
6751         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6752         (Arm_relobj::scan_sections_for_stubs): Ditto.
6753         (Arm_relobj::do_read_symbols): Check to see if we really want to
6754         merge processor-specific flags and attributes.  Exit early if
6755         an object is empty except for section names and the undefined symbol.
6756         (Target_arm::do_finalize_sections): Move check for ELF format to
6757         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6758         attributes from a regular object only when we have determined that
6759         it is aapropriate.  Do not create an .ARM.attributes section in
6760         output if there is no regular input object.
6761         (Target_arm::merge_processor_specific_flags): Check
6762         --warn-mismatch before printing any error.
6763         (Target_arm::merge_object_attributes): Ditto.
6764         * gold.cc (queue_middle_tasks): Handle the case in which there is
6765         no regular object in input.
6766         * options.cc (General_options::parse_EB): New method.
6767         (General_options::parse_EL): Same.
6768         (General_options::General_options): Initialize endianness_.
6769         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6770         New options.
6771         (General_options::Endianness): New enum.
6772         (General_options::endianness): New method.
6773         (General_options::endianness_): New data member.
6774         * parameters.cc (Parameters::set_options): Check target endianness.
6775         (Parameters::set_target_once): Ditto.
6776         (Parameters::check_target_endianness): New method.
6777         (parameters_force_valid_target): If either -EL or -EB is specified,
6778         use it to define endianness of default target.
6779         * parameters.h (Parameters::check_target_endianness): New method
6780         declaration.
6781         * target.h (class Target): Change "endianity" to "endianness"
6782         in comments.
6783
6784 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6785
6786         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6787         * configure: Regenerate.
6788         * Makefile.in: Regenerate.
6789         * testsuite/Makefile.in: Regenerate.
6790
6791 2010-04-06  Cary Coutant  <ccoutant@google.com>
6792
6793         gcc PR lto/42757
6794         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6795         prevailing definitions of common symbols.
6796         * testsuite/plugin_test_6.sh: New test case.
6797         * testsuite/plugin_common_test_1.c: New test case.
6798         * testsuite/plugin_common_test_2.c: New test case.
6799         * testsuite/Makefile.am (plugin_test_6): New test case.
6800         * testsuite/Makefile.in: Regenerate.
6801
6802 2010-04-06  Nick Clifton  <nickc@redhat.com>
6803
6804         * po/vi.po: New Vietnamese translation.
6805
6806 2010-03-30  Doug Kwan  <dougkwan@google.com>
6807
6808         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6809
6810 2010-03-25  Doug Kwan  <dougkwan@google.com>
6811
6812         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6813         to avoid a conversion warning on a 32-bit host.
6814
6815 2010-03-24  Ian Lance Taylor  <iant@google.com>
6816
6817         * testsuite/script_test_3.t: Add a TLS segment.
6818         * testsuite/Makefile.am (check_PROGRAMS): Add
6819         tls_phdrs_script_test.
6820         (tls_phdrs_script_test_SOURCES): Define.
6821         (tls_phdrs_script_test_DEPENDENCIES): Define.
6822         (tls_phdrs_script_test_LDFLAGS): Define.
6823         (tls_phdrs_script_test_LDADD): Define.
6824         * testsuite/Makefile.in: Rebuild.
6825
6826 2010-03-23  Cary Coutant  <ccoutant@google.com>
6827
6828         * fileread.cc (find_or_make_view): Fix comment.
6829
6830 2010-03-23  Ian Lance Taylor  <iant@google.com>
6831
6832         * script-sections.cc (class Orphan_section_placement): Define
6833         PLACE_TLS and PLACE_TLS_BSS.
6834         (Orphan_section_placement::Orphan_section_placement): Initialize
6835         new places.
6836         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6837         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6838         (tls_script_test_SOURCES): Define.
6839         (tls_script_test_DEPENDENCIES): Define.
6840         (tls_script_test_LDFLAGS): Define.
6841         (tls_script_test_LDADD): Define.
6842         * testsuite/Makefile.in: Rebuild.
6843
6844 2010-03-22  Doug Kwan  <dougkwan@google.com>
6845
6846         * arm.cc (Arm_relocate_functions::abs8,
6847         Arm_relocate_functions::abs16): Use correct check for overflow
6848         specified in the ARM ELF specs.
6849         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6850         target of a BLX instruction specially.
6851         (Reloc_stub::stub_type_for_reloc): Ditto.
6852         (Relocate::relocate): Use symbolic names instead of numeric relocation
6853         codes to report error.
6854         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6855         workaround.
6856         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6857         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6858         thumb2_blx_out_of_range.stdout
6859         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6860         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6861         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6862         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6863         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6864         thumb2_blx_in_range, thumb2_blx_in_range.o,
6865         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6866         thumb2_blx_out_of_range.o): New rules.
6867         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6868         thumb2_blx_in_range and thumb2_blx_out_of_range.
6869         * testsuite/Makefile.in: Regenerate.
6870         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6871         * testsuite/thumb_blx_in_range.s: New file.
6872         * testsuite/thumb_blx_out_of_range.s: New file.
6873
6874 2010-03-22  Rafael Espindola  <espindola@google.com>
6875
6876         * archive.cc (Should_include): Move to archive.h.
6877         (should_include_member): Make it a member of Archive.
6878         (Lib_group): New.
6879         (Add_lib_group_symbols): New.
6880         * archive.h: Include options.h.
6881         (Archive_member): Moved from Archive.
6882         (Should_include): Moved from archive.cc.
6883         (Lib_group): New.
6884         (Add_lib_group_symbols): New.
6885         * dynobj.cc (do_should_include_member): New.
6886         * dynobj.h (do_should_include_member): New.
6887         * gold.cc (queue_initial_tasks): Update call to queue.
6888         * main.cc (main): Print lib group stats.
6889         * object.cc (do_should_include_member): New.
6890         * object.h: Include archive.h.
6891         (Object::should_include_member): New.
6892         (Object::do_should_include_member): New.
6893         (Sized_relobj::do_should_include_member): New.
6894         * options.cc (General_options::parse_start_lib): New.
6895         (General_options::parse_end_lib): New.
6896         (Input_arguments::add_file): Handle lib groups.
6897         (Input_arguments::start_group): Check we are not in a lib.
6898         (Input_arguments::start_lib): New.
6899         (Input_arguments::end_lib): New.
6900         * options.h (General_options): Add start_lib and end_lib.
6901         (Input_argument::lib_): New.
6902         (Input_argument::lib): New.
6903         (Input_argument::is_lib): New.
6904         (Input_file_lib): New.
6905         (Input_arguments::in_lib_): New.
6906         (Input_arguments::in_lib): New.
6907         (Input_arguments::start_lib): New.
6908         (Input_arguments::end_lib_): New.
6909         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6910         in unused members as preempted.
6911         (Sized_pluginobj::do_should_include_member): New.
6912         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6913         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6914         return the blocker.
6915         (Read_symbols::do_whole_lib_group): New.
6916         (Read_symbols::do_lib_group): New.
6917         (Read_symbols::do_read_symbols): Handle lib groups.
6918         (Read_symbols::get_name): Handle lib groups.
6919         * readsyms.h (Read_symbols): Add an archive member pointer.
6920         (Read_symbols::do_whole_lib_group): New.
6921         (Read_symbols::do_lib_group): New.
6922         (Read_symbols::member_): New.
6923         * script.cc (read_input_script): Update call to queue_soon.
6924
6925 2010-03-19  Doug Kwan  <dougkwan@google.com>
6926
6927         * arm.cc (Stub_table::Stub_table): Initialize new data members
6928         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6929         (Stub_table::add_reloc_stub): Assign stub offset and update
6930         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6931         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6932         New data members.
6933         (Stub_table::update_data_size_and_addralign): Use
6934         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6935         instead of going over all reloc stubs.
6936         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6937         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6938         Stringpool_template::offset_ to size of Stringpool_char.
6939         (Stringpool_template::new_key_offset): Remove code to initialize
6940         Stringpool_template::offset_.
6941         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6942         Stringpool_template::offset_ to zero.
6943
6944 2010-03-15  Doug Kwan  <dougkwan@google.com>
6945
6946         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6947         offset_.
6948         (Stringpool_template::new_key_offset): New method.
6949         (Stringpool_template::add_string): Assign offsets when adding new
6950         strings.
6951         (Stringpool_template::set_string_offsets): Do not set string offsets
6952         when not optimizing.
6953         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6954         member size_.
6955         (Chunked_vector::clear): Clear size_.
6956         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6957         (Chunked_vector::size): Return size_.
6958         (Chunked_vector::push_back): Use size_ to find insert position.
6959         (Chunked_vector::size_): New data member.
6960         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6961         (Stringpool_template::new_key_offset): New method declaration.
6962         (Stringpool_template::offset_): New data member.
6963
6964 2010-03-15   Rafael Espindola  <espindola@google.com>
6965
6966         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6967         Add_symbols' constructor.
6968         * readsyms.h (Add_symbols): Remove the input_group member.
6969
6970 2010-03-10  Ian Lance Taylor  <iant@google.com>
6971
6972         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6973         target to ask whether a reference to a symbol requires a stack
6974         split.
6975         * target.h (Target::is_call_to_non_split): New function.
6976         (Target::do_is_call_to_non_split): Declare virtual function.
6977         * target.cc: Include "symtab.h".
6978         (Target::do_is_call_to_non_split): New function.
6979         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6980
6981 2010-03-10  Cary Coutant  <ccoutant@google.com>
6982
6983         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6984         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6985         (File_read::open[2]): Add whole_file_view_ to list of views.
6986         (File_read::make_view): Remove test of whole_file_view_.
6987         (File_read::find_or_make_view): Create whole_file_view_ if
6988         necessary.
6989         (File_read::clear_views): Replace bool parameter with enum;
6990         adjust all callers.  Don't delete views with permanent data;
6991         do delete cached views and views from archives if
6992         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6993         if clearing the corresponding view.
6994         * fileread.h (File_read::Clear_views_mode): New enum.
6995         (File_read::View::is_permanent_view): New method.
6996         (File_read::clear_views): Replace bool parameter
6997         with enum; adjust all callers.
6998         * options.h (General_options): Change keep_files_mapped option;
6999         add map_whole_files.
7000         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7001         releasing the file.
7002         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7003         the file.
7004
7005 2010-03-10  David S. Miller  <davem@davemloft.net>
7006
7007         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7008
7009 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7010
7011         * icf.cc (get_section_contents): Add '@' marker after processing the
7012         merge reloc.
7013
7014 2010-03-08  Doug Kwan  <dougkwan@google.com>
7015
7016         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7017         due to a conversion warning.
7018         (Arm_relobj::update_output_local_symbol_count): Check for local
7019         symbol with unset output index.
7020
7021 2010-03-05  Ian Lance Taylor  <iant@google.com>
7022
7023         * options.h (class General_options): Add --spare-dynamic-tags.
7024         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7025         --spare-dynamic-tags.
7026
7027 2010-03-05  Ian Lance Taylor  <iant@google.com>
7028
7029         * incremental.cc: Include "libiberty.h".
7030
7031 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7032
7033         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7034         function, is_info_ member.
7035         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7036         (Versions::Versions): Update caller.
7037         (Versions::define_base_version): Likewise.
7038         (Versions::add_def): Likewise.
7039
7040 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7041
7042         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7043         (Scan::possible_function_pointer_reloc): New function.
7044         (Scan::local_reloc_may_be_function_pointer): Change to call
7045         possible_function_pointer_reloc.
7046         (Scan::global_reloc_may_be_function_pointer): Ditto.
7047         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7048         relocations in ".data.rel.ro._ZTV" section.
7049         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7050         * testsuite/icf_safe_so_test.cc: Ditto.
7051         * testsuite/icf_safe_test.cc: Ditto.
7052         * testsuite/icf_safe_test.sh: Ditto.
7053
7054 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7055             Ian Lance Taylor  <iant@google.com>
7056
7057         * target-reloc.h (relocate_section): Check the symbol table index
7058         for -1U before setting the local symbol index.
7059         (scan_relocatable_relocs): If copying the relocation, record that
7060         the local symbol is required.
7061         * object.h (Symbol_value::is_output_symtab_index_set): New
7062         function.
7063         (Symbol_value::may_be_discarded_from_output_symtab): New
7064         function.
7065         (Symbol_value::has_output_symtab_entry): New function.
7066         (Symbol_value::needs_output_symtab_entry): Remove.
7067         (Symbol_value::output_symtab_index): Make sure the symbol index is
7068         set.
7069         (Symbol_value::set_output_symtab_index): Make sure the symbol
7070         index is not set.  Make sure the new index is valid.
7071         (Symbol_value::set_must_have_output_symtab_entry): New function.
7072         (Symbol_value::has_output_dynsym_entry): New function.
7073         (Symbol_value::set_output_dynsym_index): Make sure the new index
7074         is valid.
7075         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7076         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7077         local symbol if permitted.
7078         (Sized_relobj::do_finalize_local_symbols): Call
7079         is_output_symtab_index_set rather than needs_output_symtab_entry.
7080         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7081         rather than needs_output_symtab_entry.  Call
7082         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7083         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7084         is_output_symtab_index_set rather than needs_output_symtab_entry.
7085         * testsuite/discard_locals_relocatable_test.c: New file.
7086         * testsuite/discard_locals_test.sh: Test -r.
7087         * testsuite/Makefile.am (check_DATA): Add
7088         discard_locals_relocatable_test1.syms,
7089         discard_local_relocatable_test2.syms.
7090         (MOSTLYCLEANFILES): Likewise.  Also add
7091         discard_locals_relocatable_test1.lout and
7092         discard_locals_relocatable_test2.out.
7093         (discard_locals_relocatable_test1.syms): New target.
7094         (discard_locals_relocatable_test.o): New target.
7095         (discard_locals_relocatable_test1.out): New target.
7096         (discard_locals_relocatable_test2.syms): New target.
7097         (discard_locals_relocatable_test2.out): New target.
7098         (various): Add missing ../ld-new dependencies.
7099         * testsuite/Makefile.in: Rebuild.
7100
7101 2010-03-03  Nick Clifton  <nickc@redhat.com>
7102
7103         * po/fi.po: New Finnish translation.
7104
7105 2010-03-01  Doug Kwan  <dougkwan@google.com>
7106
7107         * layout.cc (Layout::Layout): Force section types of .init_array*,
7108         .preinit_array* and .fini_array* sections.
7109         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7110         Fix check of return value of std::string::find.().
7111         (Output_section::Input_section_sort_compare::operator()): Remove
7112         comment about .init_array.
7113         (Output_section::Input_section_sort_init_fini_compare::operator()):
7114         New method.
7115         (Output_section::sort_attached_input_sections): Handle .init_array
7116         and .fini_array specially.
7117         * output.h (Output_section::Inut_section_sort_compare): Update
7118         comment.
7119         (Output_section::Input_section_sort_init_fini_compare): New struct.
7120
7121 2010-02-26  Doug Kwan  <dougkwan@google.com>
7122
7123         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7124         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7125         * testsuite/debug_msg.sh: Avoid matching source line number for
7126         use of global variable undef_int.
7127
7128 2010-02-26  Doug Kwan  <dougkwan@google.com>
7129
7130         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7131         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7132         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7133         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7134         * options.cc (General_options::General_options): Initialize member
7135         fix_v4bx_.
7136         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7137         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7138         and rm_no_fix_v4bx.stdout
7139         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7140         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7141         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7142         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7143         and arm_no_fix_v4bx.
7144         * Makefile.in: Regenerate.
7145         * testsuite/arm_fix_v4bx.s: New file.
7146         * testsuite/arm_fix_v4bx.sh: Ditto.
7147
7148 2010-02-24  Doug Kwan  <dougkwan@google.com>
7149
7150         * arm.cc (Target_arm::got_section): Make the .got section the first
7151         non RELRO section in the data segment.
7152         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7153         suffixes of section names.
7154
7155 2010-02-24  Doug Kwan  <dougkwan@google.com>
7156
7157         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7158         flags and attributes merging if an input file is a binary file.
7159         * fileread.cc (Input_file::open): Record format of original file.
7160         * fileread.h (Input_file::Format): New enum type.
7161         (Input_file::Input_file): Initialize data member format_.
7162         (Input_file::format): New method definition.
7163         (Input_file::format_):: New data member.
7164
7165 2010-02-24  Doug Kwan  <dougkwan@google.com>
7166
7167         * arm.cc (Arm_output_data_got): New class.
7168         (ARM_TCB_SIZE): New constant
7169         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7170         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7171         If user uses a script with a SECTIONS clause, issue only a warning
7172         for a misplaced EXIDX input section.  Otherwise, issue an error.
7173         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7174         garbage collection.
7175         (Target_arm::got_mode_index_entry): Handle static linking.
7176         (Target_arm::Scan::local): Ditto.
7177         (Target_arm::Scan::global): Ditto.
7178         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7179         all incorrectly implemented relocations.
7180         (Target_arm::fix_exidx_coverage): Pass layout to
7181         Arm_output_section::fix_exidx_coverage.
7182         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7183         from ".ARM.exidx." and ".ARM.extab.".
7184
7185 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7186
7187         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7188         section if it does not already exist.
7189         * attributes.cc (Attributes_section_data::Attributes_section_data):
7190         Don't crash if size is zero.
7191
7192 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7193             Ian Lance Taylor  <iant@google.com>
7194
7195         * gold.cc (queue_middle_tasks): If no input files were opened,
7196         exit.
7197         * workqueue.h (Task_function::Task_function): Assert that there is
7198         a blocker.
7199
7200 2010-02-22  Doug Kwan  <dougkwan@google.com>
7201
7202         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7203         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7204         types to avoid warnings due to different uint64_t implementations
7205         on different hosts.
7206
7207 2010-02-21  Doug Kwan  <dougkwan@google.com>
7208
7209         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7210         handling of the maximum backward branch offset.
7211         (Arm_relocate_functions::thumb_branch_common): Ditto.
7212         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7213         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7214         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7215         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7216         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7217         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7218         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7219         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7220         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7221         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7222         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7223         thumb2_bl_out_of_range.o): New rules.
7224         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7225         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7226         thumb2_bl_out_of_range
7227         * testsuite/Makefile.in: Regenerate.
7228         * testsuite/arm_bl_in_range.s: New file.
7229         * testsuite/arm_bl_out_of_range.s: Ditto.
7230         * testsuite/arm_branch_in_range.sh: Ditto.
7231         * testsuite/arm_branch_range.t: Ditto.
7232         * testsuite/thumb2_branch_range.t: Ditto.
7233         * testsuite/thumb_bl_in_range.s: Ditto.
7234         * testsuite/thumb_bl_out_of_range.s: Ditto.
7235         * testsuite/thumb_branch_range.t: Ditto.
7236
7237 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7238
7239         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7240         Add reloc offset information.
7241         * icf.cc (get_section_contents): Change iterators to point to the new
7242         vectors. Add reloc offset information to the contents.
7243         * icf.h (Icf::Sections_reachable_info): New typedef.
7244         (Icf::Sections_reachable_list): New typedef.
7245         (Icf::Offset_info): New typedef.
7246         (Icf::Reloc_info): New struct typedef.
7247         (Icf::Reloc_info_list): New typedef.
7248         (Icf::symbol_reloc_list): Delete method.
7249         (Icf::addend_reloc_list): Delete method.
7250         (Icf::section_reloc_list): Delete method.
7251         (Icf::reloc_info_list): New method.
7252         (Icf::reloc_info_list_): New member.
7253
7254 2010-02-19  Doug Kwan  <dougkwan@google.com>
7255
7256         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7257         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7258         * arm.cc (Arm_relocation_functions): New forward declaration.
7259         (Target_arm::Target_arm): Initialize new data members
7260         got_mod_index_offset_ and tls_base_symbol_defined_.
7261         (Target_arm::Relocate::relocate_tls): New method.
7262         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7263          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7264         New methods.
7265         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7266         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7267         (Target_arm::got_mod_index_offset_,
7268         Target_arm::tls_base_symbol_defined_): New data members.
7269         (Target_arm::Scan::local, Target::Scan::global,
7270         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7271         relocations.
7272
7273 2010-02-18  Doug Kwan  <dougkwan@google.com>
7274
7275         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7276         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7277         text section as a parameter becuase some broken tools may not set
7278         the link in section header.
7279         (Target_arm::has_got_section): New method.
7280         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7281         without any mapping symbol as data only.  Remove warning.
7282         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7283         link in its section header, try to discover the link by inspecting the
7284         REL31 relocation at the beginning of the section.
7285         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7286         in error message.
7287         (Target_arm::Scan::global): Treat any reference to the symbol
7288         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7289
7290 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7291
7292         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7293         (Scan::global_reloc_may_be_function_pointer): New function.
7294         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7295         (Scan::global_reloc_may_be_function_pointer): New function.
7296         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7297         (Scan::global_reloc_may_be_function_pointer): New function.
7298         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7299         (Scan::global_reloc_may_be_function_pointer): New function.
7300         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7301         (Scan::global_reloc_may_be_function_pointer): New function.
7302         (Scan::possible_function_pointer_reloc): New function.
7303         (Target_x86_64::can_check_for_function_pointers): New function.
7304         * gc.h (gc_process_relocs): Scan relocation types to determine if
7305         function pointers were taken for targets that support it.
7306         * icf.cc (Icf::find_identical_sections): Include functions for
7307         folding in safe ICF whose pointer is not taken.
7308         * icf.h (Secn_fptr_taken_set): New typedef.
7309         (fptr_section_id_): New member.
7310         (section_has_function_pointers): New function.
7311         (set_section_has_function_pointers): New function.
7312         (check_section_for_function_pointers): New function.
7313         * options.h: Fix comment for safe ICF option.
7314         * target.h (can_check_for_function_pointers): New function.
7315         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7316         Modify icf_safe_test for X86-64.
7317         * testsuite/Makefile.in: Regenerate.
7318         * testsuite/icf_safe_so_test.cc: New file.
7319         * testsuite/icf_safe_so_test.sh: New file.
7320         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7321         (main): Change to take pointer to function kept_func_3.
7322         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7323         folding is done correctly for X86-64.
7324
7325 2010-02-12  David S. Miller  <davem@davemloft.net>
7326
7327         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7328         is_symbolless parameter.
7329         (Output_reloc<SHT_REL>::is_symbolless): New.
7330         (Output_reloc<SHT_REL>::is_symbolless_): New.
7331         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7332         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7333         (Output_reloc<SHT_RELA>::is_symbolless): New.
7334         (Output_data_reloc::add_global): Handle is_symbolless.
7335         (Output_data_reloc::add_global_relative): Likewise.
7336         (Output_data_reloc::add_local): Likewise.
7337         (Output_data_reloc::add_local_relative): Likewise.
7338         (Output_data_reloc::add_symbolless_global_addend): New.
7339         (Output_data_reloc::add_symbolless_local_addend): New.
7340         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7341         is_symbolless.
7342         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7343         instead of ->is_relative_
7344         (Output_reloc::write): Likewise.
7345         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7346         (Output_reloc::write_rel): Simplify.
7347
7348         * sparc.cc (Target_sparc::Scan::local): Use
7349         ->add_symbolless_local_addend as needed.
7350         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7351         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7352         based upon relocation offset.
7353
7354 2010-02-11  Doug Kwan  <dougkwan@google.com>
7355
7356         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7357         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7358         beginning of function.
7359         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7360         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7361         parameter is_32bit in calls to should_apply_static_reloc.
7362         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7363         (check_DATA): Add arm_abs_global.stdout.
7364         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7365         arm_abs_global.stdout): New rules.
7366         (MOSTLLYCLEANFILES): Add arm_abs_global
7367         * Makefile.in: Regenerate.
7368         * testsuite/arm_abs_global.s: New file.
7369         * testsuite/arm_abs_global.sh: Ditto.
7370         * testsuite/arm_abs_lib.s: Ditto.
7371
7372 2010-02-11  Ian Lance Taylor  <iant@google.com>
7373
7374         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7375         Read_relocs task.
7376         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7377         Allocate_commons_task first.
7378         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7379         task, rather than symtab_lock_.
7380         (Gc_process_relocs::~Gc_process_relocs): New function.
7381         (Gc_process_relocs::is_runnable): Check this_blocker_.
7382         (Gc_process_relocs::locks): Use next_blocker_ rather than
7383         blocker_.
7384         (Scan_relocs::~Scan_relocs): New function.
7385         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7386         symtab_lock_.
7387         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7388         next_blocker_.
7389         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7390         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7391         constructor accordingly.
7392         (class Gc_process_relocs): Likewise.
7393         (class Scan_relocs): Likewise.
7394         * common.h (class Allocate_commons_task): Remove symtab_lock_
7395         field, and corresponding constructor parameter.
7396         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7397         symtab_lock_.
7398         (Allocate_commons_task::locks): Likewise.
7399
7400 2010-02-11  Ian Lance Taylor  <iant@google.com>
7401
7402         * gold-threads.h (class Once): Define.
7403         (class Initialize_lock): Rewrite as child of Once.
7404         * gold-threads.cc (class Once_initialize): Define.
7405         (once_pointer_control): New static variable.
7406         (once_pointer, once_arg): New static variables.
7407         (c_run_once): New static function.
7408         (Once::Once, Once::run_once, Once::internal_run): New functions.
7409         (class Initialize_lock_once): Remove.
7410         (initialize_lock_control): Remove.
7411         (initialize_lock_pointer): Remove.
7412         (initialize_lock_once): Remove.
7413         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7414         (Initialize_lock::initialize): Rewrite.
7415         (Initialize_lock::do_run_once): New function.
7416         * archive.cc (Archive::interpret_header): Only clear name if it is
7417         not already empty.
7418         * fileread.cc: Include "gold-threads.h"
7419         (file_counts_lock): New static variable.
7420         (file_counts_initialize_lock): Likewise.
7421         (File_read::release): Only increment counts when using --stats.
7422         Use a lock around the increment.
7423         * parameters.cc (class Set_parameters_target_once): Define.
7424         (set_parameters_target_once): New static variable.
7425         (Parameters::Parameters): Move here from parameters.h.
7426         (Parameters::set_target): Rewrite.
7427         (Parameters::set_target_once): New function.
7428         (Parameters::clear_target): Move here and rewrite.
7429         * parameters.h (class Parameters): Update declarations.  Add
7430         set_parameters_target_once_ field.
7431         (Parameters::Parameters): Move to parameters.cc.
7432         (Parameters::clear_target): Likewise.
7433         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7434         task.
7435         (Start_group::~Start_group): New function.
7436         (Start_group::is_runnable): New function.
7437         (Start_group::locks, Start_group::run): New functions.
7438         (Finish_group::run): Change saw_undefined to size_t.
7439         * readsyms.h (class Start_group): Define.
7440         (class Finish_group): Change saw_undefined_ field to size_t.
7441         (Finish_group::Finish_group): Remove saw_undefined and
7442         this_blocker parameters.  Change all callers.
7443         (Finish_group::set_saw_undefined): New function.
7444         (Finish_group::set_blocker): New function.
7445         * symtab.h (class Symbol_table): Change saw_undefined to return
7446         size_t.  Change saw_undefined_ field to size_t.
7447         * target-select.cc (Set_target_once::do_run_once): New function.
7448         (Target_selector::Target_selector): Initialize set_target_once_
7449         field.  Don't initialize lock_ and initialize_lock_ fields.
7450         (Target_selector::instantiate_target): Rewrite.
7451         (Target_selector::set_target): New function.
7452         * target-select.h (class Set_target_once): Define.
7453         (class Target_selector): Update declarations.  Make
7454         Set_target_once a friend.  Remove lock_ and initialize_lock_
7455         fields.  Add set_target_once_ field.
7456
7457 2010-02-10  Ian Lance Taylor  <iant@google.com>
7458
7459         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7460         queueing any tasks.
7461         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7462         (queue_middle_tasks): Add all blockers before queueing any tasks.
7463         (queue_final_tasks): Likewise.
7464         * token.h (Task_token::add_blockers): New function.
7465         * object.h (Input_objects::number_of_relobjs): New function.
7466
7467 2010-02-10  Ian Lance Taylor  <iant@google.com>
7468
7469         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7470         shared, not if not position independent.
7471         * x86_64.cc (Relocate::relocate_tls): Likewise.
7472         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7473         (tls_pie_pic_test): New target.
7474         * testsuite/Makefile.in: Rebuild.
7475
7476         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7477         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7478         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7479         * testsuite/Makefile.in: Rebuild.
7480
7481 2010-02-09  David S. Miller  <davem@davemloft.net>
7482
7483         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7484         R_SPARC_RELATIVE using ->add_local_relative().
7485         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7486
7487         * output.h (Output_data_dynamic::add_section_size): New method
7488         that takes two Output_data objects.
7489         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7490         entry param.  Handle it in initializers.
7491         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7492         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7493         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7494         arg.
7495         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7496         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7497         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7498         for dynrel_includes_plt.
7499         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7500         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7501         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7502         before .rela.plt
7503         (Target_sparc::do_finalize_sections): Update to pass true for
7504         dynrel_includes_plt.
7505         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7506         output before .rela.plt
7507         (Target_powerpc::do_finalize_sections): Update to pass true for
7508         dynrel_includes_plt when 32-bit.
7509
7510 2010-02-08  Doug Kwan  <dougkwan@google.com>
7511
7512         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7513         method.
7514         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7515         Arm_relobj::scan_section_for_cortex_a8_stubs,
7516         Arm_relobj::do_relocation_section): Instead of calling
7517         Output_section::output_address, use faster
7518         Arm_relobj::simple_input_section_output_address.
7519
7520 2010-02-08  David S. Miller  <davem@davemloft.net>
7521
7522         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7523         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7524         relocation helper function.
7525
7526         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7527         just like R_SPARC_GOT{10,13,22}.
7528         (Target_sparc::Scan::local): Likewise.
7529         (Target_sparc::Relocate:relocate): Likewise.
7530
7531 2010-02-06  Ian Lance Taylor  <iant@google.com>
7532
7533         * configure.ac: Rewrite targetobjs duplicate removal code to use
7534         only shell constructs.
7535         * configure: Rebuild.
7536
7537 2010-02-05  Doug Kwan  <dougkwan@google.com>
7538
7539         PR 11247
7540         * arm.cc (Arm_relobj::section_is_scannable): New method.
7541         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7542         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7543
7544 2010-02-04  Doug Kwan  <dougkwan@google.com>
7545
7546         PR 11247
7547         * arm-reloc-property.cc (cstdio): Include.
7548         * configure.ac (targetobjs): Remove duplicates.
7549         * configure: Regenerate.
7550         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7551         big and little endian version for a given address size.
7552
7553 2010-02-03  Doug Kwan  <dougkwan@google.com>
7554
7555         * arm-reloc-property.cc
7556         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7557         definition.
7558         * arm-reloc-property.h
7559         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7560         New method definition.
7561         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7562         declaration.
7563         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7564         overflow to N.
7565         (GOT_PREL): Change implemented to Y.
7566         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7567         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7568         (Arm_relocate_functions::movw_abs_nc): Remove method.
7569         (Arm_relocate_functions::movt_abs): Ditto.
7570         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7571         (Arm_relocate_functions::thm_movt_abs): Ditto.
7572         (Arm_relocate_functions::movw_rel_nc): Ditto.
7573         (Arm_relocate_functions::movw_rel): Ditto.
7574         (Arm_relocate_functions::movt_rel): Ditto.
7575         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7576         (Arm_relocate_functions:thm_movw_rel): Ditto.
7577         (Arm_relocate_functions:thm_movt_rel): Ditto.
7578         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7579         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7580         New method definitions.
7581         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7582         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7583         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7584         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7585         (Target_arm::Relocate::relocate): Check for non-static or
7586         unimplemented relocation code and exit early.  Change calls to
7587         Target_arm::reloc_uses_thumb_bit and
7588         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7589         instead.  Refactor code to handle similar relocations to increase
7590         code sharing.  Remove check for unsupported relocation code in switch
7591         statement.
7592         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7593         relocation property table to find out size.  Change error message to
7594         print out the name of a relocation code instead of the numeric value.
7595         (Target_arm::scan_reloc_for_stub): Use relocation property table
7596         instead of calling Target_arm::reloc_uses_thumb_bit().
7597
7598 2010-02-02  Doug Kwan  <dougkwan@google.com>
7599
7600         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7601         types of relaxed input section.
7602
7603 2010-02-02  Doug Kwan  <dougkwan@google.com>
7604
7605         * Makefile.am (HFILES): Add arm-reloc-property.h.
7606         (DEFFILES): New.
7607         (TARGETSOURCES): Add arm-reloc-property.cc
7608         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7609         (libgold_a_SOURCES): $(DEFFILES)
7610         * Makefile.in: Regenerate.
7611         * arm-reloc-property.cc: New file.
7612         * arm-reloc-property.h: New file.
7613         * arm-reloc.def: New file.
7614         * arm.cc: Update comments.
7615         (arm-reloc-property.h): New included header.
7616         (arm_reloc_property_table): New global variable.
7617         (Target_arm::do_select_as_default_target): New method definition.
7618         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7619         arm-reloc-property to targ_extra_obj.
7620         * parameters.cc (set_parameters_target): Call
7621         Target::select_as_default_target().
7622         * target.h (Target::select_as_default_target): New method definition.
7623         (Target::do_select_as_default_target): Same.
7624
7625 2010-02-01  Doug Kwan  <dougkwan@google.com>
7626
7627         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7628         first_output_text_section_.
7629         (Arm_exidx_fixup::first_output_text_section): New method definition.
7630         (Arm_exidx_fixup::first_output_text_section_): New data member.
7631         (Arm_exidx_fixup::process_exidx_section): Record the first text
7632         output section seen.
7633         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7634         and entsize in output section header.
7635
7636 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7637
7638         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7639         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7640         (Arm_relocate_functions::thm_alu11): New Method.
7641         (Arm_relocate_functions::thm_pc8): New Method.
7642         (Arm_relocate_functions::thm_pc12): New Method.
7643         (Target_arm::Scan::local): Handle the relocations.
7644         (Target_arm::Scan::global): Likewise.
7645         (Target_arm::Relocate::relocate): Likewise.
7646         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7647
7648 2010-01-29  Doug Kwan  <dougkwan@google.com>
7649
7650         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7651         of relocation types as ld.
7652
7653 2010-01-29  Doug Kwan  <dougkwan@google.com>
7654
7655         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7656         to public.
7657         (Arm_relocate_functions::thumb_branch_common): Ditto.
7658         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7659         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7660         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7661         Arm_relocate_functions::jump24): Remove.
7662         (Target_arm::Relocate::relocate): Adjust code to call
7663         Arm_relocation_functions::arm_branch_common and
7664         Arm_relocation_functions::thumb_branch_common instead of their removed
7665         wrappers.  Merge switch-cases together to reduce source code size.
7666
7667 2010-01-29  Doug Kwan  <dougkwan@google.com>
7668
7669         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7670         output_local_symbol_count_needs_update_.
7671         (Arm_relobj::output_local_symbol_count_needs_update,
7672          Arm_relobj::set_output_local_symbol_count_needs_update,
7673          Arm_relobj::update_output_local_symbol_count): New methods.
7674         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7675         member.
7676         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7677         of pointed function as in a R_ARM_PREL31 relocation.
7678         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7679         for output local symbol count updating.
7680         (Target_arm::do_relax): Update output local symbol counts in objects
7681         if necessary.
7682         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7683
7684 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7685
7686         * arm.cc: Added support for the ARM relocations:
7687         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7688         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7689         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7690         movw_prel_nc).
7691         (Arm_relocate_functions::movw_rel): New method.
7692         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7693         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7694         thm_movw_prel_nc).
7695         (Arm_relocate_functions::thm_movw_rel): New method.
7696         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7697         thm_movt_prel).
7698         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7699         relocations.
7700         (Target_arm::Scan::global): Likewise.
7701         (Target_arm::Relocate::relocate): Likewise.
7702         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7703         Likewise.
7704
7705 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7706
7707         * arm.cc: Added support for ARM group relocations.
7708         (Target_arm::reloc_needs_sym_origin): New method.
7709         (Arm_relocate_functions::calc_grp_kn): New method.
7710         (Arm_relocate_functions::calc_grp_residual): New method.
7711         (Arm_relocate_functions::calc_grp_gn): New method.
7712         (Arm_relocate_functions::arm_grp_alu): New Method.
7713         (Arm_relocate_functions::arm_grp_ldr): New Method.
7714         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7715         (Arm_relocate_functions::arm_grp_ldc): New Method.
7716         (Target_arm::Scan::local): Handle the ARM group relocations.
7717         (Target_arm::Scan::global): Likewise.
7718         (Target_arm::Relocate::relocate): Likewise.
7719         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7720         Likewise.
7721
7722 2010-01-26  Doug Kwan  <dougkwan@google.com>
7723
7724         * arm.cc (set): Include.
7725         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7726         pointer type.
7727         (Arm_output_section::Text_section_list): New type.
7728         (Arm_output_section::append_text_sections_to_list): New method.
7729         (Arm_output_section::fix_exidx_coverage): Ditto.
7730         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7731         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7732         Relobj::set_section_offset() instead of
7733         Sized_relobj::invalidate_section_offset().
7734         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7735         parameter for section headers. Ignore relocation sections for
7736         unallocated sections and EXIDX sections.
7737         (Target_arm::fix_exidx_coverage): New method.
7738         (Target_arm::output_section_address_less_than): New type.
7739         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7740         linked text section instead of the EXIDX section.
7741         (Arm_output_section::create_stub_group): Add an assertion to check
7742         that this is not an EXIDX output section.
7743         (Arm_output_section::append_text_sections_to_list): New method.
7744         (Arm_output_section::fix_exidx_coverage): Ditto.
7745         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7746         Arm_relobj::section_needs_reloc_stub_scanning.
7747         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7748         first pass.
7749         (Target_arm::fix_exidx_coverage): New method.
7750         * object.h (Relobj::set_output_section): New method.
7751         (Sized_relobj::invalidate_section_offset): Remove method.
7752         (Sized_relobj::do_invalidate_section_offset): Remove method.
7753         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7754
7755 2010-01-25  Doug Kwan  <dougkwan@google.com>
7756
7757         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7758         Fix warning due to signed and unsigned comparison on a 32-bit host.
7759
7760 2010-01-22  Doug Kwan  <dougkwan@google.com>
7761
7762         * arm.cc (Target_arm::do_relax): Record an output section for section
7763         offset adjustment it contains any stub table that has changed.
7764         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7765         offsets in an output section if necessary.
7766         * output.cc (Output_section::Output_section): Initialize
7767         section_offsets_need_adjustments_.
7768         (Output_section::add_input_section_for_script): Renamed to
7769         Output_section::add_simple_input_section.
7770         (Output_section::save_states): Add a comment.
7771         (Output_section::discard_states): New method defintion.
7772         (Output_section::adjust_section_offsets): Same.
7773         * output.h (Output_section::add_input_section_for_script): Renamed to
7774         Output_section::add_simple_input_section.
7775         (Output_section::discard_states): New method declaration.
7776         (Output_section::adjust_section_offsets): Same.
7777         (Output_section::section_offsets_need_adjustment,
7778         Output_section::set_section_offsets_need_adjustment): New method
7779         definitions.
7780         (Output_section::section_offsets_need_adjustment_): New data member.
7781         * script-sections.cc
7782         (Output_section_element_input::set_section_address): Adjust code for
7783         renaming of Output_section::add_input_section_for_script.
7784         (Orphan_output_section::set_section_address): Same.
7785
7786 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7787
7788         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7789         Fix_v4bx enum values .
7790         * gold/options.h (General_options): New option definitions.
7791         (General_options::fix_v4bx): New method.
7792         (General_options::Fix_v4bx): New enum.
7793         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7794         (General_options::parse_fix_v4bx_interworking): New method.
7795
7796 2010-01-22  Doug Kwan  <dougkwan@google.com>
7797
7798         * arm.cc (Arm_exidx_fixup): New class.
7799
7800 2010-01-21  Doug Kwan  <dougkwan@google.com>
7801
7802         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7803         classes.
7804         (Arm_exidx_section_offset_map): New type.
7805
7806 2010-01-21  Doug Kwan  <dougkwan@google.com>
7807
7808         * arm.cc (Arm_exidx_input_section): New class.
7809         (Arm_relobj::exidx_input_section_by_link,
7810         Arm_relobj::exidx_input_section_by_shndx,
7811         Arm_relobj::make_exidx_input_section): New methods.
7812         (read_arm_attributes_section): Remove.
7813         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7814         information about them.
7815         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7816         to here.
7817
7818 2010-01-20  Doug Kwan  <dougkwan@google.com>
7819
7820         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7821         Input_section_specifier to Section_id.
7822         (Target_arm::new_arm_input_section: Adjust code for change of key
7823         type.
7824         (Target_arm::find_arm_input_section): Ditto.
7825         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7826         (Section_id): Remove.
7827         (Garbage_collection::Section_id_hash): Remove.
7828         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7829         (Section_id): Remove.
7830         (Icf::Section_id_hash): Remove.
7831         * object.h (Section_id, Const_section_id, Section_id_hash,
7832         Const_section_id_hash): New type definitions.
7833         * output.cc (Output_section::add_relaxed_input_section): Change to
7834         use Const_section_id instead of Input_section_specifier as key type.
7835         (Output_section::add_merge_input_section): Ditto.
7836         (Output_section::build_relaxation_map): Change to use Section_id
7837         instead of Input_section_specifier as key type.
7838         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7839         Ditto.
7840         (Output_section::convert_input_sections_to_relaxed_sections): Change
7841         to use Const_section_id instead of Input_section_specifier as key type.
7842         (Output_section::find_merge_section): Ditto.
7843         (Output_section::find_relaxed_input_section): Ditto.
7844         * output.h (Input_section_specifier): Remove class.
7845         (Output_section::Output_section_data_by_input_section_map): Change
7846         key type to Const_section_id.
7847         (Output_section::Output_relaxed_input_section_by_input_section_map):
7848         Ditto.
7849         (Output_section::Relaxation_map): Change key type to Section_id.
7850
7851 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7852
7853         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7854         (class Arm_v4bx_stub): New class.
7855         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7856         (Stub_factory::make_arm_v4bx_stub): New method.
7857         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7858         (Stub_table::empty): Handle v4bx stubs.
7859         (Stub_table::add_arm_v4bx_stub): New method.
7860         (Stub_table::find_arm_v4bx_stub): New method.
7861         (Arm_relocate_functions::v4bx): New method.
7862         (Target_arm::fix_v4bx): New method.
7863         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7864         (Stub_table::relocate_stubs): Likewise.
7865         (Stub_table::do_write): Likewise.
7866         (Stub_table::update_data_size_and_addralign): Likewise.
7867         (Stub_table::finalize_stubs):  Likewise.
7868         (Target_arm::Scan::local): Likewise.
7869         (Target_arm::Scan::global): Likewise.
7870         (Target_arm::do_finalize_sections): Likewise.
7871         (Target_arm::Relocate::relocate): Likewise.
7872         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7873         Likewise.
7874         (Target_arm::scan_reloc_for_stub): Likewise.
7875         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7876
7877 2010-01-19  Ian Lance Taylor  <iant@google.com>
7878
7879         * output.cc (Output_section_headers::do_sized_write): Write large
7880         segment count to sh_info field.
7881         (Output_file_header::do_sized_write): For large segment count,
7882         write PN_XNUM to e_phnum field.
7883
7884 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7885
7886         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7887         (Arm_relocate_functions::thm_jump8): New function.
7888         (Arm_relocate_functions::thm_jump11): New function.
7889         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7890         R_ARM_THM_JUMP11.
7891         (Target_arm::Scan::global): Likewise.
7892         (Target_arm::Relocate::relocate): Likewise.
7893         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7894         Likewise.
7895
7896 2010-01-14  Doug Kwan  <dougkwan@google.com>
7897
7898         * arm.cc (map, utility): Include headers.
7899         (Target_arm::apply_cortex_a8_workaround): New method.
7900         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7901         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7902         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7903         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7904         the --[no-]fix-cortex-a8 command line options.
7905         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7906         (Target_arm::relocate_stub): Use addend in instruction template.
7907         * options.h (DEFINE_bool): Set the user-set flag.
7908         (General_options): Add --[no-]-fix-cortex options.
7909         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7910         : Update fast look-up map after conversion.
7911
7912 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7913
7914         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7915         in the first pass of do_layout.
7916
7917 2010-01-13  Doug Kwan  <dougkwan@google.com>
7918
7919         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7920         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7921         apparent compiler problem of not folding static constant integral
7922         data members of elfcpp::Elf_sizes<32>.
7923
7924 2010-01-13  Doug Kwan  <dougkwan@google.com>
7925
7926         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7927         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7928         Arm_relobj::scan_section_for_cortex_a8_erratum,
7929         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7930         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7931         sections to scan for relocation stubs into a new method
7932         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7933         relocation and Cortex-A8 stub scanning.
7934         (Target_arm::do_relax): Force stubs to be after stubbed sections
7935         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7936         the beginning of a new relaxation pass.  Update a comment.
7937         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7938
7939 2010-01-12  Ian Lance Taylor  <iant@google.com>
7940
7941         * target-reloc.h (visibility_error): New inline function.
7942         (relocate_section): Call visibility_error.
7943         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7944         (MOSTLYCLEANFILES): Likewise.
7945         (protected_4_pic.o, protected_3.err): New targets.
7946         * testsuite/protected_4.cc: New file.
7947
7948 2010-01-12  Doug Kwan  <dougkwan@google.com>
7949
7950         * arm.cc (Cortex_a8_reloc): New class.
7951         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7952         and cortex_a8_relocs_info_.
7953         (Target_arm::fix_cortex_a8): New method definition.
7954         (Target_arm::Cortex_a8_relocs_info): New type.
7955         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7956         New data member declarations.
7957         (Target_arm::scan_reloc_for_stub): Record information about
7958         relocations for THUMB branches that might be exempted from the
7959         Cortex-A8 workaround.
7960         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7961         at the beginning of a relaxation pass.
7962
7963 2010-01-12  Doug Kwan  <dougkwan@google.com>
7964
7965         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7966         (Arm_relobj::Mapping_symbol_position,
7967          Arm_reloj::Mapping_symbol_position_less,
7968          Arm_relobj::Mapping_symbols_info): New types.
7969         (Target_arm::is_mapping_symbol_name): New method definition.
7970         (Arm_relobj::do_count_local_symbols): Save information about mapping
7971         symbols.
7972
7973 2010-01-11  Doug Kwan  <dougkwan@google.com>
7974
7975         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7976         Arm_relocate_functions::thumb32_branch_upper,
7977         Arm_relocate_functions::thumb32_branch_lower,
7978         Arm_relocate_functions::thumb32_cond_branch_offset,
7979         Arm_relocate_functions::thumb32_cond_branch_upper,
7980         Arm_relocate_functions::thumb32_cond_branch_lower,
7981         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7982         branch offset encoding.
7983         (Arm_relocate_functions::thumb_branch_common): Use new branch
7984         offset encoding methods to avoid code duplication.
7985         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7986         (Stub_addend_reader::operator()): Use new branch encoding method
7987         to avoid code duplication.
7988
7989 2010-01-11  Doug Kwan  <dougkwan@google.com>
7990
7991         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7992         (Target_arm::do_finalize_sections): Define special EXIDX section
7993         symbols only if referenced.
7994         * gc.h (Garbage_collection::add_reference): New method.
7995         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7996         code duplication.
7997
7998 2010-01-11  Ian Lance Taylor  <iant@google.com>
7999
8000         * script.cc (Version_script_info::build_expression_list_lookup):
8001         Change complaing about duplicate wildcard match from error to
8002         warning.
8003
8004         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8005         of 2009-12-30.
8006         (Version_script_info::Version_script_info): Initialize globs_,
8007         default_version_, default_is_global_, and exact_.  Don't
8008         initialize globals_ or locals_.
8009         (Version_script_info::build_lookup_tables): Build local symbols
8010         first.
8011         (Version_script_info::unquote): New function.
8012         (Version_script_info::add_exact_match): New function.
8013         (Version_script_info::build_expression_list_lookup): Remove lookup
8014         parameter.  Add is_global parameter.  Change all callers.  Handle
8015         wildcard pattern specially.  Unquote pattern.  Call
8016         add_exact_match.
8017         (Version_script_info::get_name_to_match): New function.
8018         (Version_script_info::get_symbol_version): New function.
8019         (Version_script_info::get_symbol_version_helper): Remove.
8020         (Version_script_info::check_unmatched_names): Call unquote.
8021         * script.h (class Version_script_info): Change get_symbol_version
8022         to be non-inline and add is_global parameter; change all callers.
8023         Rewrite symbol_is_local.  Update declarations.  Define struct
8024         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8025         Remove globals_ and locals_ members.  Add exact_, globs_,
8026         default_version_, is_global_.
8027         (Version_script_info::Glob): Remove pattern, add expression and
8028         is_global.  Update constructor.  Change all callers.
8029         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8030         default version.
8031         (Versions::symbol_section_contents): If a symbol is undefined, or
8032         defined in a dynamic object, set the version index to
8033         VER_NDX_LOCAL.
8034         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8035         symbol_is_local.
8036         (Symbol_table::add_from_pluginobj): Likewise.
8037         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8038
8039 2010-01-11  Doug Kwan  <dougkwan@google.com>
8040
8041         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8042         (incremental_dump_LDADD): Add linking option for libintl.
8043         * Makefile.in: Regenerate.
8044
8045 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8046
8047         PR gold/11144
8048         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8049         instead of -Ds.
8050         * testsuite/Makefile.in: Regenerated.
8051
8052 2010-01-10  Doug Kwan  <dougkwan@google.com>
8053
8054         * options.h (DEFINE_var): Use parentheses around argument varname__
8055         in macro body to avoid any unintended subsequent substitutions.
8056
8057 2010-01-10  Ian Lance Taylor  <iant@google.com>
8058
8059         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8060         candidates before doing symbol resolution.
8061
8062         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8063         ODR candidates if only one is weak.
8064
8065 2010-01-08  Ian Lance Taylor  <iant@google.com>
8066
8067         * script.cc (Version_script_info::build_expression_list_lookup):
8068         Don't warn about ambiguous version, just record the ambiguity.
8069         (Version_script_info::get_symbol_version_helper): Give error if
8070         version is ambiguous.
8071
8072 2010-01-08  Doug Kwan  <dougkwan@google.com>
8073
8074         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8075         prev_data_size_ and prev_addralign_.  Remove initializer for
8076         deleted data member has_been_changed_.
8077         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8078         to determine if the table is empty.
8079         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8080         Remove.
8081         (Stub_table::add_reloc_stub): Define method in class definition
8082         instead of just declaring it there.
8083         (Stub_table::add_cortex_a8_stub): New method definition.
8084         (Stub_table::update_data_size_and_addralign): Ditto.
8085         (Stub_table::finalize_stubs): Ditto.
8086         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8087         (Stub_table::do_addralign_): Return address alignment in the
8088         (Stub_table::do_reset_address_and_file_offset): Define method in
8089         class definition instead of declaring it there.  Set current data
8090         size to be the data size of the previous pass.
8091         (Stub_table::set_final_data_size): Use current data size as the
8092         final data size.
8093         (Stub_table::relocate_stub): Change parameter type of stub from
8094         Reloc_stub pointer to Stub pointer.
8095         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8096         (Stub_table::Cortex_a8_stub_list): New typedef.
8097         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8098          Stub_table::prev_addralign_): New data member.
8099         (Arm_relobj::Arm_relobj): Initialize data member
8100         section_has_cortex_a8_workaround_.
8101         (Arm_relobj::section_has_cortex_a8_workaround,
8102          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8103          definitions.
8104         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8105         declarations.
8106         (Target_arm::relocate_stub): Change parameter type of stub from
8107         Reloc_stub pointer to Stub pointer.
8108         (Insn_template::size, Insn_template::alignment): Handle
8109         THUMB16_SPECIAL_TYPE.
8110         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8111          Stub_table::update_data_size_and_addralign,
8112          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8113         definitions.
8114         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8115         (Stub_table::do_write): Ditto.
8116         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8117
8118 2010-01-08  Ian Lance Taylor  <iant@google.com>
8119
8120         PR 11108
8121         * symtab.h (class Symbol): Remove fields is_target_special_ and
8122         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8123         (Symbol::is_defined_in_discarded_section): New function.
8124         (Symbol::set_is_defined_in_discarded_section): New function.
8125         (Symbol::has_plt_offset): Rewrite.
8126         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8127         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8128         Don't initialize is_target_special_ or has_plt_offset_.
8129         Initialize is_defined_in_discarded_section_.
8130         (Symbol_table::add_from_relobj): If appropriate, set
8131         is_defined_in_discarded_section.
8132         * resolve.cc (Symbol::override_base_with_special): Don't test
8133         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8134         * target-reloc.h (relocate_section): Do special handling for
8135         symbols defined in discarded sections for global symbols as well
8136         as local symbols.
8137
8138 2010-01-08  Ian Lance Taylor  <iant@google.com>
8139
8140         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8141         the SHT_SYMTAB case.
8142
8143 2010-01-08  Ian Lance Taylor  <iant@google.com>
8144
8145         * object.cc (Sized_relobj::do_layout): Don't get confused if
8146         layout_eh_frame returns NULL.
8147
8148 2010-01-08  Ian Lance Taylor  <iant@google.com>
8149
8150         PR 11084
8151         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8152         dynamic symbol table, use the normal symbol table.
8153         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8154         symbol table.
8155
8156 2010-01-08  Ian Lance Taylor  <iant@google.com>
8157
8158         PR 11072
8159         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8160         sections.
8161
8162 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8163
8164         * version.cc (print_version): Change to "Copyright 2010".
8165
8166 2010-01-08  Ian Lance Taylor  <iant@google.com>
8167
8168         PR 10287
8169         PR 11063
8170         * i386.cc (class Target_i386): Change return type of plt_section
8171         to be non-const.
8172         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8173         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8174         tls_desc_rel_ field.
8175         (Output_data_plt_i386::rel_tls_desc): New function.
8176         (Target_i386::rel_tls_desc_section): New function.
8177         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8178         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8179         R_386_TLS_DESC reloc in rel_tls_desc_section.
8180         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8181         Define struct Tlsdesc_info.
8182         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8183         (Target_x86_64::do_reloc_symbol_index): New function.
8184         (Target_x86_64::add_tlsdesc_info): New function.
8185         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8186         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8187         tlsdesc_rel_ field.
8188         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8189         all callers.
8190         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8191         (Target_x86_64::rela_tlsdesc_section): New function.
8192         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8193         handling.
8194         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8195         (Target_x86_64::do_reloc_addend): New function.
8196         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8197         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8198         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8199         (Output_reloc::type): New function.
8200         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8201         (Output_reloc::is_target_specific): New function.
8202         (Output_reloc::target_arg): New function.
8203         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8204         absolute relocs and target specific relocs.
8205         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8206         add_target_specific.
8207         (class Output_data_reloc) [SHT_RELA]: Likewise.
8208         * output.cc (Output_reloc::Output_reloc): Add four new versions
8209         for absolute relocs and target specific relocs.
8210         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8211         (Output_reloc::get_symbol_index): Likewise.
8212         (Output_reloc::local_section_offset): Check that local_sym_index_
8213         is not TARGET_CODE or 0.
8214         (Output_reloc::symbol_value): Likewise.
8215         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8216         reloc.
8217         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8218         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8219         functions.
8220         * layout.cc (add_target_dynamic_tags): Use output section for
8221         DT_PLTRELSZ and DT_JMPREL.
8222
8223 2010-01-07  Ian Lance Taylor  <iant@google.com>
8224
8225         PR 11061
8226         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8227         function.
8228         (class Output_data_reloc_generic): Define.
8229         (class Output_data_reloc_base): Change base class to
8230         Output_data_reloc_generic.  Change add() method to call
8231         bump_relative_reloc_count for a relative reloc.  Remove
8232         sort_relocs_ field.
8233         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8234         to sort_relocs().
8235         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8236         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8237         appropriate.
8238         * layout.h (class Layout): Update declaration.
8239
8240 2010-01-07  Ian Lance Taylor  <iant@google.com>
8241
8242         * output.h (class Output_data): Add const version of
8243         output_section and do_output_section.
8244         (class Output_section_data): Add const version of
8245         do_output_section.
8246         (class Output_section): Likewise.
8247         * layout.cc (Layout::add_target_dynamic_tags): New function.
8248         * layout.h (class Layout): Update declarations.
8249         * arm.cc (Target_arm::do_finalize_sections): Use
8250         add_target_dynamic_tags.
8251         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8252         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8253         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8254         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8255
8256 2010-01-07  Ian Lance Taylor  <iant@google.com>
8257
8258         PR 11042
8259         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8260         object as needed.
8261
8262 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8263             Ian Lance Taylor  <iant@google.com>
8264
8265         PR 11019
8266         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8267         Xindex::read_symtab_xindex.
8268
8269 2010-01-07  Doug Kwan  <dougkwan@google.com>
8270
8271         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8272         (Insn_template::thumb16_bcond_insn): New method declaration.
8273         (Insn_template): Fix spelling.
8274         (Stub::thumb16_special): New method declaration.
8275         (Stub::do_write): Define virtual method which was previously pure
8276         virtual.
8277         (Stub::do_thumb16_special): New method declaration.
8278         (Stub::do_fixed_endian_write): New template member.
8279         (Reloc_stub::do_write): Remove.
8280         (Reloc_stub::do_fixed_endian_write): Remove.
8281         (Cortex_a8_stub): New class definition.
8282         (Stub_factory::make_cortex_a8_stub): New method definition.
8283         (Stub_factory::Stub_factory): Add missing static storage class
8284         qualifier for elf32_arm_stub_a8_veneer_blx.
8285
8286 2010-01-07  Ian Lance Taylor  <iant@google.com>
8287
8288         PR 10980
8289         * options.h (class General_options): Add --warn-unresolved-symbols
8290         and --error-unresolved-symbols.
8291         * errors.cc (Errors::undefined_symbol): Implement
8292         --warn-unresolved-symbols.
8293
8294         * options.h (class General_options): Add -z text and -z textoff.
8295         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8296
8297 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8298
8299         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8300         (Garbage_collection::cident_sections): New function.
8301         (Garbage_collection::add_cident_section): New function.
8302         (Garbage_collection::cident_sections_): New member.
8303         (gc_process_relocs): Add references to sections whose names are C
8304         identifiers.
8305         * gold.h (cident_section_start_prefix): New constant.
8306         (cident_section_stop_prefix): New constant.
8307         (is_cident): New function.
8308         * layout.cc (Layout::define_section_symbols): Replace string constants
8309         with the newly defined constants.
8310         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8311         C identifiers.
8312         * testsuite/Makefile.am: Add gc_orphan_section_test.
8313         * testsuite/Makefile.in: Regenerate.
8314         * testsuite/gc_orphan_section_test.cc: New file.
8315         * testsuite/gc_orphan_section_test.sh: New file.
8316
8317 2010-01-06  Ian Lance Taylor  <iant@google.com>
8318
8319         PR 10980
8320         * options.h (class General_options): Add --warn-shared-textrel.
8321         * layout.cc (Layout::finish_dynamic_section): Implement
8322         --warn-shared-textrel.
8323
8324         PR 10980
8325         * options.h (class General_options): Add --warn-multiple-gp.
8326
8327 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8328
8329         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8330         $(THREADSLIB) and $(LIBDL).
8331         * Makefile.in: Rebuild.
8332
8333 2010-01-06  Ian Lance Taylor  <iant@google.com>
8334
8335         PR 10980
8336         * options.cc (General_options::parse_section_start): New function.
8337         (General_options::section_start): New function.
8338         (General_options::General_options): Initialize all members.
8339         * options.h: Include <map>
8340         (class General_options): Add --section-start.  Add section_starts_
8341         member.
8342         * layout.cc (Layout::attach_allocated_section_to_segment): If
8343         --section-start was used, set the address of the segment.  Remove
8344         local sort_sections.
8345         (Layout::relaxation_loop_body): If the address of the load segment
8346         has been set by --section-start, don't use it.
8347         * output.h (Output_segment::update_flags_for_output_section): New
8348         function.
8349         * output.cc (Output_segment::add_output_section): Call
8350         update_flags_for_output_section.
8351
8352 2010-01-05  Ian Lance Taylor  <iant@google.com>
8353
8354         PR 10980
8355         * options.h (class General_options): Add --undefined-version.
8356         * script.cc (struct Version_expression): Add was_matched_by_symbol
8357         field.
8358         (Version_script_info::matched_symbol): New function.
8359         (Version_script_info::get_symbol_version_helper): Call
8360         matched_symbol.
8361         (Version_script_info::check_unmatched_names): New function.
8362         * script.h (class Version_script_info): Update declarations.
8363         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8364
8365         * options.h (class General_options): Use DEFINE_bool_alias for
8366         allow_multiple_definition.
8367         * resolve.cc (Symbol_table::should_override): Don't test
8368         allow_multiple_definition.
8369
8370         PR 10980
8371         * options.h (class General_options): Add --cref.
8372         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8373         until after printing cref table.
8374         * cref.cc: Include "symtab.h".
8375         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8376         (Cref_table_compare::operator()): New function.
8377         (Cref_inputs::gather_cref): New function.
8378         (filecol): New static const.
8379         (Cref_inputs::print_cref): New function.
8380         (Cref::print_cref): New function.
8381         * cref.h: Include <cstdio>.
8382         (class Cref): Update declarations.
8383         * mapfile.h (Mapfile::file): New function.
8384         * object.h (class Object): Define Symbols.  Declare virtual
8385         do_get_global_symbols.
8386         (Object::get_global_symbols): New function.
8387         * object.cc (Input_objects::add_object): Pass object to cref_ if
8388         --cref.
8389         (Input_objects::archive_start): Likewise.
8390         (Input_objects::archive_stop): Likewise.
8391         (Input_objects::print_cref): New function.
8392         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8393         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8394         --cref.
8395         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8396         function.
8397         * plugin.h (class Sized_pluginobj): Update declarations.
8398
8399 2010-01-05  Ian Lance Taylor  <iant@google.com>
8400
8401         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8402         to is_default_version.  Rename insdef to insdefault.
8403         (Symbol_table::add_from_relobj): Rename def to is_default_version
8404         and local to is_forced_local.
8405         (Symbol_table::add_from_pluginobj): Likewise.
8406         (Symbol_table::add_from_dynobj): Likewise.
8407         (Symbol_table::define_special_symbol): Rename insdef to
8408         insdefault.
8409
8410 2010-01-04  Ian Lance Taylor  <iant@google.com>
8411
8412         PR 10980
8413         * options.h (class General_options): Add
8414         --allow-multiple-definition and -z muldefs.
8415         * resolve.cc (Symbol_table::should_override): Don't warn about a
8416         multiple symbol definition if --allow-multiple-definition or -z
8417         muldefs.
8418
8419         PR 10980
8420         * options.h (class General_options): Add --add-needed and
8421         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8422         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8423         error if --copy-dt-needed-entries aka --add-needed is used and
8424         would cause a change in behaviour.
8425
8426         PR 10980
8427         * options.h (class General_options): Add -G as a short version of
8428         --shared.  Add no-op options -assert, -g, and -i.
8429
8430 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8431
8432         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8433         check for .text or .gnu.linkonce.t sections.
8434         * icf.cc (Icf::find_identical_sections): Ditto.
8435         Change the detection for mangled function name within the section
8436         name.
8437         * icf.h (is_section_foldable_candidate): New function.
8438
8439 2009-12-30  Ian Lance Taylor  <iant@google.com>
8440
8441         PR 10980
8442         * options.h (class General_options): Permit two dashes with
8443         --retain-symbols-file.
8444
8445 2009-12-30  Ian Lance Taylor  <iant@google.com>
8446
8447         PR 10979
8448         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8449         don't put the file header and segment headers in the text
8450         segment.
8451
8452         PR 10979
8453         * common.cc (Sort_commons::operator()): Stabilize sort when both
8454         entries are NULL.
8455         (Symbol_table::do_allocate_commons_list): When allocating common
8456         symbols, skip a symbol which is no longer common.
8457         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8458         an object before checking its type.
8459         * testsuite/common_test_2.c: New file.
8460         * testsuite/common_test_3.c: New file.
8461         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8462         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8463         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8464         (common_test_2_pic.o, common_test_2.so): New targets.
8465         (common_test_3_pic.o, common_test_3.so): New targets.
8466         * testsuite/Makefile.in: Rebuild.
8467
8468         PR 10979
8469         * script.cc (read_input_script): If we see a new SECTIONS clause,
8470         and we have added an input section, give an error.
8471         * layout.h (class Layout): Add have_added_input_section function.
8472         Add have_added_input_section_ field.
8473         * layout.cc (Layout::Layout): Initialize
8474         have_added_input_section_.
8475         (Layout::layout): Set have_added_input_section_.
8476         (Layout::layout_eh_frame): Likewise.
8477
8478 2009-12-30  Ian Lance Taylor  <iant@google.com>
8479
8480         PR 10931
8481         * options.h (class General_options): Add --sort-common option.
8482         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8483         * common.cc (Sort_common): Add sort_order parameter to
8484         constructor.  Add sort_order_ field.
8485         (Sort_commons::operator): Check sort_order_.
8486         (Symbol_table::allocate_commons): Determine the sort order.
8487         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8488         Change all callers.
8489         (Symbol_table::do_allocate_commons_list): Likewise.
8490
8491 2009-12-30  Ian Lance Taylor  <iant@google.com>
8492
8493         PR 10916
8494         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8495         symbols from this object, don't change the visibility of an
8496         undefined symbol.
8497         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8498
8499 2009-12-30  Ian Lance Taylor  <iant@google.com>
8500
8501         PR 10861
8502         * script.h (class Version_script_info): Define Language enum.
8503         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8504         new fields globals_, locals_, and is_finalized_.
8505         * script.cc: Various formatting fixes.
8506         (class Parser_closure): Change language_stack_ from a vector of
8507         std::string to one of Version_script_info::Language.  Adjust all
8508         uses accordingly.
8509         (class Lazy_demangler): Remove.
8510         (struct Version_expression): Change language from std::string to
8511         Version_script_info::Language.
8512         (Version_script_info::Version_script_info): New function.
8513         (Version_script_info::~Version_script_info): Don't call clear.
8514         (Version_script_info::finalize): New function.
8515         (Version_script_info::build_lookup_tables): New function.
8516         (Version_script_info::build_expression_list_lookup): New
8517         function.
8518         (Version_script_info::get_symbol_version_helper): Rewrite to use
8519         lookup tables.
8520         (Version_script_info::print_expression_list): Adjust to use
8521         Version_script_info::Language.
8522         (script_push_lex_into_version_mode): Check that the version script
8523         has not been finalized.
8524         (version_script_push_lang): Change language string to
8525         Version_script_info::Language.
8526         * options.cc (Command_line::version_script): New function.
8527         * options.h (class General_options): Add finalize_dynamic_list
8528         function.  Change version_script from declaration to definition.
8529         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8530         * testsuite/version_script.map: Remove duplicate def of foo.
8531         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8532         version_script.map.
8533         * testsuite/Makefile.in: Rebuild.
8534
8535 2009-12-30  Ian Lance Taylor  <iant@google.com>
8536
8537         PR 10843
8538         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8539         if the input symbol index is 0, make the output symbol index 0.
8540
8541 2009-12-30  Ian Lance Taylor  <iant@google.com>
8542
8543         PR 10670
8544         * options.h (class General_options): Add -x/--discard-all.
8545         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8546         --discard-all.  If the local symbol needs a dynamic entry, check
8547         that before handling --discard-locals.
8548
8549 2009-12-30  Ian Lance Taylor  <iant@google.com>
8550
8551         PR 10450
8552         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8553         flags to PF_R.
8554         (Output_segment::add_output_section): Don't change the flags if
8555         the type is PT_TLS.
8556
8557         PR 10450
8558         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8559         GNU hash table if they need a dynamic value.  Otherwise, don't add
8560         them if they are defined in a dynamic object or are forced local.
8561
8562 2009-12-29  Ian Lance Taylor  <iant@google.com>
8563
8564         PR 10450
8565         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8566         .gnu.hash table for a 32-bit target.
8567
8568         PR 10450
8569         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8570         regular and a dynamic object only needs a dynamic symbol table
8571         entry if it is externally visible.
8572
8573         PR 10450
8574         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8575         constructor.  Add global_offset_table_ field.
8576         (Target_i386::got_section): Set global_offset_table_.
8577         (Target_i386::do_finalize_sections): Set global_offset_table_
8578         size.
8579         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8580         in constructor.  Add global_offset_table_ field.
8581         (Target_x86_64::got_section): Set global_offset_table_.
8582         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8583         size.
8584
8585         * layout.cc (Layout::Layout): Initialize increase_relro_.
8586         (Layout::get_output_section): Add is_relro, is_last_relro, and
8587         is_first_non_relro parameters.  Change all callers.
8588         (Layout::choose_output_section): Likewise.
8589         (Layout::add_output_section_data): Likewise.
8590         (Layout::make_output_section): Likewise.
8591         (Layout::set_segment_offsets): Clear increase_relro when using a
8592         linker script.
8593         * layout.h (class Layout): Add increase_relro method.  Add
8594         increase_relro_ field.  Update declarations.
8595         * output.cc (Output_section::Output_section): Initialize
8596         is_last_relro_ and is_first_non_relro_.
8597         (Output_segment::add_output_section): Group relro sections is
8598         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8599         (Output_segment::maximum_alignment): Remove relro handling.
8600         (Output_segment::set_section_addresses): Add increase_relro
8601         parameter.  Change all callers.  Add initial alignment to align
8602         relro sections on separate page.  Remove old relro handling.
8603         (Output_segment::set_section_list_addresses): Remove in_relro
8604         parameter.  Change all callers.
8605         (Output_segment::set_offset): Add increase parameter.  Change all
8606         callers.  Remove old relro handling.
8607         * output.h (class Output_section): Add new methods: is_last_relro,
8608         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8609         Add is_last_relro_ and is_first_non_relro_ fields.
8610         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8611         Create separate .got.plt section.  Call increase_relro.
8612         * x86_64.cc (Target_x86_64::got_section): Likewise.
8613         * testsuite/relro_script_test.t: Add .got.plt.
8614
8615         PR 10450
8616         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8617         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8618         (Layout::finalize): Call set_dynamic_symbol_size.
8619         (Layout::set_dynamic_symbol_size): New function.
8620         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8621         set_dynamic_symbol_size.
8622
8623         PR 10450
8624         * output.h (class Output_section): Add is_entsize_zero_ field.
8625         * output.cc (Output_section::Output_section): Initialize
8626         is_entsize_zero_.
8627         (Output_section::set_entsize): If two different entsizes are
8628         requested, force it to zero.
8629         (Output_section::add_input_section): Set flags for .debug_str
8630         before updating section flags.  Set entsize.
8631         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8632         and SHF_STRING if all input sections have those flags.
8633
8634 2009-12-29   Rafael Espindola  <espindola@google.com>
8635
8636         * main.cc (main): Fix the sys time reporting.
8637         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8638         reporting.
8639
8640 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8641
8642         * options.cc (General_options::parse_version): Allow -v to exit
8643         without an error if there is nothing to link.
8644
8645 2009-12-29  Ian Lance Taylor  <iant@google.com>
8646
8647         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8648         using a version of gcc before 4.1.
8649         * configure: Rebuild.
8650
8651 2009-12-28  Chris Demetriou  <cgd@google.com>
8652
8653         * attributes.cc (Output_attributes_section_data::do_write): Use
8654         std::vector::front rather than std::vector::data.
8655
8656 2009-12-28  Ian Lance Taylor  <iant@google.com>
8657
8658         * symtab.h (class Symbol_table): Add enum Defined.
8659         * resolve.cc (Symbol_table::should_override): Add defined
8660         parameter.  Change all callers.  Test whether object is NULL
8661         before calling a method on it.
8662         (Symbol_table::report_resolve_problem): Add defined parameter.
8663         Change all callers.
8664         (Symbol_table::should_override_with_special): Likewise.
8665         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8666         parameter.  Change all callers.
8667         (Symbol_table::do_define_in_output_data): Likewise.
8668         (Symbol_table::define_in_output_segment): Likewise.
8669         (Symbol_table::do_define_in_output_segment): Likewise.
8670         (Symbol_table::define_as_constant): Likewise.
8671         (Symbol_table::do_define_as_constant): Likewise.
8672         * script.h (class Symbol_assignment): Add is_defsym parameter to
8673         constructor; change all callers.
8674         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8675         parameter.  Change all callers.  Add is_defsym_ field.
8676         (class Parser_closure): Add parsing_defsym parameter to
8677         constructor; change all callers.  Add parsing_defsym accessor
8678         function.  Add parsing_defsym_ field.
8679
8680 2009-12-28  Ian Lance Taylor  <iant@google.com>
8681
8682         * gold.cc (queue_middle_tasks): Fix formatting.
8683         * object.cc (Relobj::is_section_name_included): Likewise.
8684
8685 2009-12-23  Ian Lance Taylor  <iant@google.com>
8686
8687         * i386.cc (Target_i386::do_calls_non_split): Recognize
8688         -fsplit-stack prologue for a function with a static chain.
8689         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8690         -fsplit-stack prologue when using %r11.
8691
8692 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8693
8694         * options.cc (General_options::parse_version): Make -v continue and do
8695         the link like GNU ld does.
8696
8697 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8698
8699         * Makefile.am (CCFILES): Add timer.cc.
8700         (HFILES): Add timer.h.
8701         * configure.ac: Check for sysconf and times.
8702         * main.cc: include timer.h.
8703         (main): Use Timer instead of get_run_time.
8704         * timer.cc: New.
8705         * timer.h: New.
8706         * workqueue.cc: include timer.h.
8707         (Workqueue::find_and_run_task):
8708         Report user, sys and wall time.
8709         * Makefile.in: Regenerate.
8710         * config.in: Regenerate.
8711         * configure: Regenerate.
8712
8713 2009-12-16  Doug Kwan  <dougkwan@google.com>
8714
8715         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8716         sections.
8717         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8718         relaxed input sections.
8719         * output.cc (Output_section::find_relaxed_input_section): Change
8720         return type to Output_relaxed_input_section pointer.  Adjust code
8721         for new type of relaxed_input_section_map_.
8722         * output.h (Output_section::find_relaxed_input_section): Change
8723         return type to Output_relaxed_input_section pointer.
8724         (Output_section::Output_relaxed_input_section_by_input_section_map):
8725         New type.
8726         (Output_section::relaxed_input_section_map_): Change type to
8727         Output_section::Output_relaxed_input_section_by_input_section_map.
8728         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8729         input section.
8730
8731 2009-12-15  Ian Lance Taylor  <iant@google.com>
8732
8733         * layout.cc (Layout::create_shstrtab): Only write out after input
8734         sections if we are compressing debug sections.
8735
8736 2009-12-15  Ian Lance Taylor  <iant@google.com>
8737
8738         * archive.cc (Archive::add_symbols): Only look up a symbol without
8739         a version if there is, in fact, a version.
8740
8741 2009-12-14  Ian Lance Taylor  <iant@google.com>
8742
8743         Revert -Wshadow changes, all changes from:
8744         2009-12-11  Doug Kwan  <dougkwan@google.com>
8745         2009-12-11  Nick Clifton  <nickc@redhat.com>
8746         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8747
8748 2009-12-11  Doug Kwan  <dougkwan@google.com>
8749
8750         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8751         due to -Wshadow.
8752         * attributes.cc (Object_attribute::size): Ditto.
8753         (Attributes_section_data::size): Ditto.
8754         (Attributes_section_data::Attributes_section_data): Ditto.
8755         (Output_attributes_section_data::do_write): Ditto.
8756         * attributes.h (Object_attribute::set_type): Ditto.
8757         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8758
8759 2009-12-11  Nick Clifton  <nickc@redhat.com>
8760
8761         * archive.cc: Fix shadowed variable warnings.
8762         * arm.cc: Likewise.
8763         * compressed_output.cc: Likewise.
8764         * compressed_output.h: Likewise.
8765         * configure: Likewise.
8766         * dwarf_reader.cc: Likewise.
8767         * dynobj.cc: Likewise.
8768         * dynobj.h: Likewise.
8769         * ehframe.cc: Likewise.
8770         * ehframe.h: Likewise.
8771         * errors.cc: Likewise.
8772         * expression.cc: Likewise.
8773         * fileread.cc: Likewise.
8774         * fileread.h: Likewise.
8775         * freebsd.h: Likewise.
8776         * i386.cc: Likewise.
8777         * icf.cc: Likewise.
8778         * incremental.h: Likewise.
8779         * layout.cc: Likewise.
8780         * layout.h: Likewise.
8781         * mapfile.cc: Likewise.
8782         * merge.cc: Likewise.
8783         * merge.h: Likewise.
8784         * object.cc: Likewise.
8785         * object.h: Likewise.
8786         * options.h: Likewise.
8787         * output.cc: Likewise.
8788         * output.h: Likewise.
8789         * parameters.cc: Likewise.
8790         * plugin.cc: Likewise.
8791         * powerpc.cc: Likewise.
8792         * reduced_debug_output.cc: Likewise.
8793         * reduced_debug_output.h: Likewise.
8794         * reloc.cc: Likewise.
8795         * reloc.h: Likewise.
8796         * resolve.cc: Likewise.
8797         * script-sections.cc: Likewise.
8798         * script.cc: Likewise.
8799         * script.h: Likewise.
8800         * sparc.cc: Likewise.
8801         * symtab.cc: Likewise.
8802         * symtab.h: Likewise.
8803         * target-select.cc: Likewise.
8804         * target-select.h: Likewise.
8805         * token.h: Likewise.
8806         * workqueue.cc: Likewise.
8807         * workqueue.h: Likewise.
8808         * x86_64.cc: Likewise.
8809
8810 2009-12-10  Doug Kwan  <dougkwan@google.com>
8811
8812         * arm.cc (attributes.h): New include.
8813         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8814         (Arm_relobj::~Arm_relobj): Delete object pointed by
8815         attributes_section_data_.
8816         (Arm_relobj::attributes_section_data): New method definition.
8817         (Arm_relobj::attributes_section_data_): New data member declaration.
8818         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8819         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8820         attributes_section_data_.
8821         (Arm_dynobj::attributes_section_data): New method definition.
8822         (Arm_dynobj::attributes_section_data_): New data member declaration.
8823         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8824         initialization value of may_use_blx_ to false.
8825         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8826         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8827         object attributes to compute results instead of hard-coding.
8828         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8829         Target_arm::get_secondary_compatible_arch,
8830         Target_arm::set_secondary_compatible_arch
8831         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8832         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8833         New method declarations.
8834         (Target_arm::get_aeabi_object_attribute): New method definition.
8835         (Target_arm::attributes_section_data_): New data member declaration.
8836         (read_arm_attributes_section): New template definition.
8837         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8838         (Arm_dynobj::do_read_symbols): Ditto.
8839         (Target_arm::do_finalize_sections): Merge attributes sections from
8840         input.  Check for BLX use after attributes section merging.
8841         Fix __exidx_start and __exidx_end visibility.  Create an
8842         .ARM.attributes section if necessary.
8843         (Target_arm::get_secondary_compatible_arch,
8844         Target_arm::set_secondary_compatible_arch,
8845         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8846         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8847         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8848         New method definitions.
8849
8850 2009-12-09  Ian Lance Taylor  <iant@google.com>
8851
8852         * plugin.cc (Plugin::load): Don't cast from void* to a function
8853         pointer.
8854
8855 2009-12-09  Ian Lance Taylor  <iant@google.com>
8856
8857         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8858         information fields.
8859
8860 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8861
8862         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8863         Replace two_file_shared_1.so with two_file_shared_2.so.
8864         * testsuite/Makefile.in: Regenerated.
8865
8866 2009-12-08  Doug Kwan  <dougkwan@google.com>
8867
8868         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8869         (HFILES): Add attributes.h and int_encoding.h.
8870         * Makefile.in: Regenerate.
8871         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8872         function definitions to int_encoding.cc
8873         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8874         prototypes to int_encoding.h
8875         * reduced_debug_output.cc (int_encoding.h): New include.
8876         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8877         function definitions to int_encoding.cc
8878         (insert_into_vector, read_from_pointer): Move template definitions to
8879         int_encoding.h
8880         * attributes.cc: New file.
8881         * attributes.h: New file.
8882         * int_encoding.cc: New file.
8883         * int_encoding.h: New file.
8884
8885 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8886
8887         PR gold/11055
8888         * incremental-dump.cc (dump_incremental_inputs): New.
8889         (main): Use dump_incremental_inputs.
8890
8891 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8892
8893         PR gold/10893
8894         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8895         checking elfcpp::STT_FUNC.
8896         (Target_i386::Relocate::relocate): Likewise.
8897         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8898
8899         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8900         symbols from shared libraries into normal FUNC symbols.
8901
8902         * symtab.h (Symbol): Add is_func and use it.
8903
8904 2009-12-05  Doug Kwan  <dougkwan@google.com>
8905
8906         * arm.cc (Target_arm::arm_info): Initialize new fields
8907         attributes_section and attributes_vendor.
8908         * i386.cc (Target_i386::i386_info): Same.
8909         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8910         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8911         fields attributes_section and attributes_vendor.
8912         * sparc.cc (Target_sparc::sparc_info): Same.
8913         * target.h (Target::attributes_section, Target::attributes_vendor,
8914         Target::is_attributes_section, Target::attribute_arg_type,
8915         Target::attributes_order): New method definitions.
8916         (Target::Target_info::attributes_section,
8917         Target::Target_info::attributes_vendor): New fields.
8918         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8919         virtual method definitions.
8920         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8921         attributes_section and attributes_vendor.
8922         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8923
8924 2009-12-05  Doug Kwan  <dougkwan@google.com>
8925
8926         * arm.cc: Update comments about interworking and stub generation.
8927         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8928         considered as non-PIC.
8929         (Arm_relocate_functions::base_abs): Fix formatting.
8930         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8931         of function to use GOT entry address instead of offset.
8932         (Target_arm::Scan::global): Issue an error if a symbol would need a
8933         PLT does not get one because it is untyped.  Remove code to create
8934         dynamic symbols for relative branches.
8935         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8936         takes unsigned integer instead of boolean.
8937
8938 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8939
8940         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8941         (two_file_test_LDADD): Likewise.
8942         (common_test_1_LDADD): Likewise.
8943         (exception_test_LDADD) Likewise.
8944         (weak_test_LDADD): Likewise.
8945         (many_sections_test_LDADD): Likewise.
8946         (initpri1_LDADD): Likewise.
8947         (script_test_1_LDADD): Likewise.
8948         (script_test_2_LDADD): Likewise.
8949         (justsyms_LDADD): Likewise.
8950         (binary_test_LDADD): Likewise.
8951         (large_LDADD): Likewise.
8952         * testsuite/Makefile.in: Regenerated.
8953
8954 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8955
8956         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8957         (Symbol_table::override_with_special): Likewise.
8958         (Symbol_table::add_from_object): Likewise.
8959
8960 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8961
8962         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8963         Don't set the data_offset twice.
8964
8965 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8966
8967         * testsuite/Makefile.in: Regenerate.
8968
8969 2009-12-03  Doug Kwan  <dougkwan@google.com>
8970
8971         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8972         (Target_arm::do_finalize_sections): Add parameter for symbol table
8973         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8974         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8975         parameter for symbol table pointer.
8976         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8977         an additional parameter for a pointer to symbol table.
8978         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8979         parameter for a symbol table pointer.
8980         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8981         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8982         Ditto.
8983         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8984         parameter for a symbol table pointer.
8985
8986 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8987
8988         * incremental.cc (Incremental_inputs_header)
8989         (Incremental_inputs_header_write, Incremental_inputs_entry)
8990         (Incremental_inputs_entry_write): Move ...
8991         * incremental.h (Incremental_inputs_header)
8992         (Incremental_inputs_header_write, Incremental_inputs_entry)
8993         (Incremental_inputs_entry_write): here.
8994
8995 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8996
8997         * incremental.cc (make_sized_incremental_binary): Set the target.
8998         Error if it is incompatible.
8999         * output.h (Output_file): Add filename method.
9000
9001 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9002
9003         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9004         from the get_* methods.
9005
9006 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9007
9008         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9009         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9010         Write 0 for the data_offset of scripts.
9011
9012 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9013
9014         * testsuite/Makefile.am: Add the incremental_test.sh test.
9015         * testsuite/incremental_test.sh: New.
9016         * testsuite/incremental_test_1.c: New.
9017         * testsuite/incremental_test_2.c: New.
9018
9019 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9020
9021         * incremental-dump.cc (main): Fix typos.
9022
9023 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9024
9025         PR gold/11025
9026         * incremental-dump.cc (main): Use llu to print 64 bit values.
9027
9028 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9029             H.J. Lu  <hongjiu.lu@intel.com>
9030
9031         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9032         $(LIBDL).
9033         (incremental_dump_LDADD): Likewise.
9034         * Makefile.in: Regenerated.
9035
9036 2009-11-25  Doug Kwan  <dougkwan@google.com>
9037
9038         Revert:
9039
9040         2009-11-25  Doug Kwan  <dougkwan@google.com>
9041
9042                 * arm.cc (Target_arm::Target_arm): Move method definition
9043                 outside of class definition.  Add code to handle
9044                 --target1-rel, --target1-abs and --target2= options.
9045                 (Target_arm::get_reloc_reloc_type): Change method to be
9046                 non-static and const.
9047                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9048                 New data member declaration.
9049                 (Target_arm::Scan::local, Target_arm::Scan::global,
9050                 Target_arm::Relocate::relocate,
9051                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9052                 Adjust call to Target_arm::get_real_reloc_type.
9053                 (Target_arm::get_real_reloc_type): Use command line options
9054                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9055                 * options.h (--target1-rel, --target1-abs, --target2): New
9056                 ARM-only options.
9057
9058 2009-11-25  Doug Kwan  <dougkwan@google.com>
9059
9060         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9061         class definition.  Add code to handle --target1-rel, --target1-abs
9062         and --target2= options.
9063         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9064         and const.
9065         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9066         member declaration.
9067         (Target_arm::Scan::local, Target_arm::Scan::global,
9068         Target_arm::Relocate::relocate,
9069         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9070         call to Target_arm::get_real_reloc_type.
9071         (Target_arm::get_real_reloc_type): Use command line options to
9072         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9073         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9074         options.
9075
9076 2009-11-25  Doug Kwan  <dougkwan@google.com>
9077
9078         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9079         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9080         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9081         formatting.
9082         (Arm_relocate_functions::thm_call): Replace body with a call to
9083         Arm_relocate_functions::thumb_branch_common.
9084         (Arm_relocate_functions::thm_jump24,
9085         Arm_relocate_functions::thm_xpc22): New method definitions.
9086         (Arm_relocate_functions::thumb_branch_common): New method definition.
9087         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9088         operator.
9089         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9090         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9091
9092 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9093
9094         * Makefile.am: Build incremental-dump
9095         * Makefile.in: Regenerate.
9096         * incremental-dump.cc: New.
9097         * incremental.cc (Incremental_inputs_header_data,
9098         Incremental_inputs_entry_data): Move to incremental.h
9099         * incremental.h: (Incremental_inputs_header_data,
9100         Incremental_inputs_entry_data): Move from incremental.cc
9101
9102 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9103
9104         * incremental.cc (Incremental_inputs_header,
9105         Incremental_inputs_header_write, Incremental_inputs_entry,
9106         Incremental_inputs_entry_write): Add a typedef with the data type.
9107
9108 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9109
9110         * incremental.cc (Incremental_inputs_header,
9111         Incremental_inputs_header_write, Incremental_inputs_entry,
9112         Incremental_inputs_entry_write): Update comment about which
9113         type has the filed descriptions.
9114
9115 2009-11-15  Doug Kwan  <dougkwan@google.com>
9116
9117         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9118         (Arm_relocate_functions::arm_branch_common): Change method defintion
9119         in class definition to a method declaration and update list of formal
9120         parameters.
9121         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9122         Arm_relocation_functions::jump24): Adjust call to
9123         Arm_relocate_functions::arm_branch_common.  Update list of formal
9124         parameters.
9125         (Arm_relocate_functions::xpc25): New method definition.
9126         (Arm_relocate_functions::arm_branch_common): Move method defintion
9127         out from class definition.  Use stubs for mode-switching and extending
9128         branch ranges.
9129         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9130         specially.  Change code to enable use of stubs in ARM branches.
9131
9132 2009-11-10  Doug Kwan  <dougkwan@google.com>
9133
9134         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9135         in method declaration.
9136         (Target_arm::relocate_stub): New method declaration.
9137         (Target_arm::default_target): Change to return a pointer instead of
9138         a const reference.
9139         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9140         Target_arm::default_target.
9141         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9142         method definition.
9143         (Target_arm::relocate_section): Adjust view.
9144         (Target_arm::relocate_stub): New method definition.
9145
9146 2009-11-10  Doug Kwan  <dougkwan@google.com>
9147
9148         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9149         a format warning.
9150         * incremental.cc (open_incremental_binary): Initialized local
9151         variables to avoid warnings.
9152         * object.cc (make_elf_object): Ditto.
9153         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9154         a format warning.
9155
9156 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9157
9158         PR gold/10930
9159         * testsuite/plugin_test.c: Include "config.h".
9160
9161 2009-11-09  Doug Kwan  <dougkwan@google.com>
9162
9163         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9164         (arm_symbol_value): Remove.
9165         (Arm_relocate_functions::arm_branch_common,
9166         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9167         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9168         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9169         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9170         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9171         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9172         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9173         Arm_relocate_functions::thm_mobw_abs_nc,
9174         Arm_relocate_functions::thm_mov_abs,
9175         Arm_relocate_functions::movw_prel_nc,
9176         Arm_relocate_functions::thm_movt_abs,
9177         Arm_relocate_functions::movt_prel,
9178         Arm_relocate_functions::thm_movw_prel_nc,
9179         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9180         (Target_arm::Relocate::relocate): Only decompose address into two
9181         parts if relocation type uses the thumb-bit and pass the actual
9182         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9183         calls to methods in Arm_relocate_functions for this change.
9184
9185 2009-11-08  Ian Lance Taylor  <iant@google.com>
9186
9187         PR 10925
9188         * reloc.cc: Instantiate
9189         Sized_relobj::initialize_input_to_output_maps and
9190         Sized_relobj:free_input_to_output_maps.
9191
9192 2009-11-06  Ian Lance Taylor  <iant@google.com>
9193
9194         PR 10876
9195         * defstd.cc (in_segment): Set only_if_ref true for "end".
9196
9197 2009-11-06  Doug Kwan  <dougkwan@google.com>
9198
9199         * arm.cc (class Reloc_stub): Correct a comment.
9200         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9201         (Target_arm::scan_section_for_stubs): New method declaration.
9202         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9203         Change methods from private to protected.
9204         (Target_arm::do_may_relax): New method definition.
9205         (Target_arm::do_relax, Target_arm::group_sections,
9206         Target_arm::scan_reloc_for_stub,
9207         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9208         (Target_arm::arm_input_section_map_): New data member declaration.
9209         (Target_arm::scan_reloc_for_stub,
9210         Target_arm::scan_reloc_section_for_stubs,
9211         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9212         Target_arm::do_relax): New method definitions.
9213
9214 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9215
9216         * configure.ac: Check for (struct stat)::st_mtim
9217         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9218         * config.in: Regenerate.
9219         * configure: Regenerate.
9220
9221 2009-11-05  Ian Lance Taylor  <iant@google.com>
9222
9223         PR 10910
9224         * output.cc (Output_segment::add_output_section): Add missing
9225         return statement.
9226
9227 2009-11-04  Ian Lance Taylor  <iant@google.com>
9228
9229         PR 10880
9230         * object.h (class Object): Add is_needed and set_is_needed
9231         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9232         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9233         defined in a dynamic object and referenced by a regular object,
9234         set is_needed for the dynamic object.
9235         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9236         if the file is marked with as_needed and it is not needed.
9237
9238 2009-11-04  Ian Lance Taylor  <iant@google.com>
9239
9240         PR 10887
9241         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9242         tags if data is discarded by linker script.
9243         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9244         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9245         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9246         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9247
9248 2009-11-04  Ian Lance Taylor  <iant@google.com>
9249
9250         * layout.cc (Layout::get_output_section): Add is_interp and
9251         is_dynamic_linker_section parameters.  Change all callers.
9252         (Layout::choose_output_section): Likewise.
9253         (Layout::make_output_section): Likewise.
9254         (Layout::add_output_section_data): Add is_dynamic_linker_section
9255         parameter.  Change all callers.
9256         * layout.h (class Layout): Update declarations.
9257         * output.h (class Output_section): Add is_interp, set_is_interp,
9258         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9259         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9260         generate_code_fills_at_write_ to a bitfield.
9261         * output.cc (Output_section::Output_sections): Initialize new
9262         fields.
9263         (Output_segment::add_output_section): Add do_sort parameter.
9264         Change all callers.
9265
9266 2009-11-03  Ian Lance Taylor  <iant@google.com>
9267
9268         PR 10860
9269         * options.h (class General_options): Add --warn-common.
9270         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9271         merging two common symbols.
9272         (Symbol_table::should_override): Handle --warn-common when merging
9273         a common symbol with a defined symbol.  Use report_resolve_problem
9274         for multiple definitions.
9275         (Symbol_table::report_resolve_problem): New function.
9276         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9277
9278 2009-11-03  Doug Kwan  <dougkwan@google.com>
9279
9280         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9281         stub_factory_.
9282         (Target_arm::stub_factory): New method definition.
9283         (Target_arm::new_arm_input_section,
9284         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9285         Target_arm::reloc_uses_thumb_bit): New method declarations.
9286         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9287         New type definitions.
9288         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9289         member declarations.
9290         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9291         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9292         New method definitions.
9293
9294 2009-11-03  Ian Lance Taylor  <iant@google.com>
9295
9296         * options.h (class General_options): Add --warn_constructors.
9297
9298 2009-11-03  Ian Lance Taylor  <iant@google.com>
9299
9300         PR 10893
9301         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9302         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9303
9304 2009-11-03  Ian Lance Taylor  <iant@google.com>
9305
9306         PR 10895
9307         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9308         --msgid-bugs-address.
9309         (install-pdf): New target.
9310         (install-data_yes): Look up one directory to find mkinstalldirs.
9311
9312 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9313
9314         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9315         tree.
9316
9317 2009-10-30  Doug Kwan  <dougkwan@google.com>
9318
9319         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9320
9321 2009-10-30  Doug Kwan  <dougkwan@google.com>
9322
9323         * arm.cc (Stub_addend_reader): New struct template definition
9324         and partial specializations.
9325         (Stub_addend_reader::operator()): New method definition for a
9326         partially specialized template.
9327
9328 2009-10-30  Doug Kwan  <dougkwan@google.com>
9329
9330         * arm.cc (Arm_relobj::processor_specific_flags): New method
9331         definition.
9332         (Arm_relobj::do_read_symbols): New method declaration.
9333         (Arm_relobj::processor_specific_flags_): New data member declaration.
9334         (Arm_dynobj): New class definition.
9335         (Target_arm::do_finalize_sections): Add input_objects parameter.
9336         (Target_arm::do_adjust_elf_header): New method declaration.
9337         (Target_arm::are_eabi_versions_compatible,
9338         (Target_arm::merge_processor_specific_flags): New method declaration.
9339         (Target_arm::do_make_elf_object): New overloaded method definitions
9340         and declaration.
9341         (Arm_relobj::do_read_symbols): New method definition.
9342         (Arm_dynobj::do_read_symbols): Ditto.
9343         (Target_arm::do_finalize_sections): Add input_objects parameters.
9344         Merge processor-specific flags from all input objects.
9345         (Target_arm::are_eabi_versions_compatible,
9346         Target_arm::merge_processor_specific_flags,
9347         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9348         New method definitions.
9349         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9350         Input_objects pointer type parameter.
9351         * layout.cc (Layout::finalize): Pass input objects to target's.
9352         finalize_sections function.
9353         * output.cc (Output_file_header::do_sized_write): Set ELF file
9354         header's processor-specific flags.
9355         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9356         Input_objects pointer type parameter.
9357         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9358         * target.h (Input_objects): New forward class declaration.
9359         (Target::processor_specific_flags,
9360         Target::are_processor_specific_flags_sect): New method definitions.
9361         (Target::finalize_sections): Add input_objects parameter.
9362         (Target::Target): Initialize processor_specific_flags_ and
9363         are_processor_specific_flags_set_.
9364         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9365         parameter.
9366         (Target::set_processor_specific_flags): New method definition.
9367         (Target::processor_specific_flags_,
9368         Target::are_processor_specific_flags_set_): New data member
9369         declarations.
9370         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9371         Input_objects pointer type parameter.
9372
9373 2009-10-30  Doug Kwan  <dougkwan@google.com>
9374
9375         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9376
9377 2009-10-28  Ian Lance Taylor  <iant@google.com>
9378
9379         * object.h (class Relobj): Drop options parameter from
9380         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9381         do_scan_relocs, do_relocate.  Change all callers.
9382         (class Sized_relobj): Drop options parameters from
9383         do_gc_process_relocs, do_scan_relocs, do_relocate,
9384         do_relocate_sections, relocate_sections, emit_relocs_scan,
9385         emit_relocs_scan_reltype.  Change all callers.
9386         (struct Relocate_info): Remove options field and all references to
9387         it.
9388         * reloc.h (class Read_relocs): Remove options constructor
9389         parameter and options_ field.  Change all callers.
9390         (class Gc_process_relocs, class Scan_relocs): Likewise.
9391         (class Relocate_task): Likewise.
9392         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9393         all callers.
9394         (scan_relocatable_relocs): Likewise.
9395         * target.h (class Sized_target): Remove options parameter from
9396         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9397         all callers.
9398         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9399         callers.
9400         * arm.cc: Update functions to remove options parameters.
9401         * i386.cc: Likewise.
9402         * powerpc.cc: Likewise.
9403         * sparc.cc: Likewise.
9404         * x86_64.cc: Likewise.
9405         * testsuite/testfile.cc: Likewise.
9406
9407 2009-10-28  Doug Kwan  <dougkwan@google.com>
9408
9409         * arm.cc (Arm_relobj): New class definition.
9410         (Arm_relobj::scan_sections_for_stubs,
9411         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9412         New method definitions.
9413
9414 2009-10-28  Cary Coutant  <ccoutant@google.com>
9415
9416         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9417         (Plugin::cleanup_done_): New member.
9418         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9419         (Plugin_manager::cleanup_done_): Remove.
9420         (Plugin_manager::add_input_file): Edit error message.
9421         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9422         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9423
9424 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9425
9426         * fileread.cc: (File_read::View::~View): Use the new
9427         data_ownership_ filed.
9428         (File_read::~File_read): Dispose the new whole_file_view_.
9429         (File_read::open): Mmap the whole file if needed.
9430         (File_read::open): Use whole_file_view_ instead of contents_.
9431         (File_read::find_view): Use whole_file_view_ if applicable.
9432         (File_read::do_read): Use whole_file_view_ instead of contents_.
9433         (File_read::make_view): Use whole_file_view_ instead of contents_,
9434         update File_read::View::View call.
9435         (File_read::find_or_make_view): Update File_read::View::View
9436         call.
9437         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9438         remove contents_
9439         (File_read::View::Data_ownership): New enum.
9440         (File_read::View::View): Replace bool mapped_ with Data_ownership
9441         argument.
9442         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9443         (File_read::View::data_ownership_): New field.
9444         (File_read::contents_): Remove (replaced by whole_file_view_).
9445         (File_read::whole_file_view_): New field.
9446         * options.h (class General_options): Add --keep-files-mapped.
9447
9448 2009-10-27  Cary Coutant  <ccoutant@google.com>
9449
9450         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9451         * testsuite/Makefile.am (plugin_test_5): New test case.
9452         * testsuite/Makefile.in: Regenerate.
9453
9454 2009-10-25  Doug Kwan  <dougkwan@google.com>
9455
9456         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9457         from private to protected to allow access by child class.
9458         (Sized_relobj::do_relocate_sections): New method declaration.
9459         (Sized_relobj::relocate_sections): Virtualize.
9460         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9461         Sized_relobj::relocate_sections.  Instantiate template explicitly
9462         for different target sizes and endianity.
9463
9464 2009-10-24  Doug Kwan  <dougkwan@google.com>
9465
9466         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9467         (Arm_input_section::as_arm_input_section): New method.
9468         (Arm_output_section): New class definition.
9469         (Arm_output_section::create_stub_group,
9470         Arm_output_section::group_sections): New method definitions.
9471
9472 2009-10-22  Doug Kwan  <dougkwan@google.com>
9473
9474         * arm.cc (Arm_input_section): New class definition.
9475         (Arm_input_section::init, Arm_input_section:do_write,
9476         Arm_input_section::set_final_data_size,
9477         Arm_input_section::do_reset_address_and_file_offset): New method
9478         definitions.
9479
9480 2009-10-21  Doug Kwan  <dougkwan@google.com>
9481
9482         * arm.cc (Stub_table, Arm_input_section): New forward class
9483         declarations.
9484         (Stub_table): New class defintion.
9485         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9486         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9487         New method definition.
9488
9489 2009-10-21  Doug Kwan  <dougkwan@google.com>
9490
9491         * arm.cc: Update copyright comments.
9492         (Target_arm): New forward class template declaration.
9493         (Arm_address): New type.
9494         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9495         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9496         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9497         constants.
9498         (Insn_template): Same.
9499         (DEF_STUBS): New macro.
9500         (Stub_type): New enum type.
9501         (Stub_template): New class definition.
9502         (Stub): Same.
9503         (Reloc_stub): Same.
9504         (Stub_factory): Same.
9505         (Target_arm::Target_arm): Initialize may_use_blx_ and
9506         should_force_pic_veneer_.
9507         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9508         Target_arm::should_force_pic_veneer,
9509         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9510         Target_arm::using_thumb_only, Target_arm:;default_target): New
9511         method defintions.
9512         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9513         New data member declarations.
9514         (Insn_template::size, Insn_template::alignment): New method defintions.
9515         (Stub_template::Stub_template): New method definition.
9516         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9517         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9518         (Stub_factory::Stub_factory): New method definition.
9519         * gold.h (string_hash): New template.
9520         * output.h (Input_section_specifier::hash_value): Use
9521         gold::string_hash.
9522         (Input_section_specifier::string_hash): Remove.
9523         * stringpool.cc (Stringpool_template::string_hash): Use
9524         gold::string_hash.
9525
9526 2009-10-20  Doug Kwan  <dougkwan@google.com>
9527
9528         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9529         symbols of relaxed input sections.
9530         * output.h (Output_section::find_relaxed_input_section): Make
9531         method public.
9532
9533 2009-10-16  Doug Kwan  <dougkwan@google.com>
9534
9535         * dynobj.cc (Versions::Versions): Initialize version_script_.
9536         Only insert base version symbol definition for a shared object
9537         if version script defines any version versions.
9538         (Versions::define_base_version): New method definition.
9539         (Versions::add_def): Check that base version is not needed.
9540         (Versions::add_need): Define base version lazily.
9541         * dynobj.h (Versions::define_base_version): New method declaration.
9542         (Versions::needs_base_version_): New data member declaration.
9543         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9544         (check_DATA): Add no_version_test.stdout.
9545         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9546         New make rules.
9547         * testsuite/Makefile.in: Regenerate.
9548         * testsuite/no_version_test.c: New file.
9549         * testsuite/no_version_test.sh: Ditto.
9550
9551 2009-10-16  Doug Kwan  <dougkwan@google.com>
9552
9553         * expression.cc (class Segment_start_expression): New class definition.
9554         (Segment_start_expression::value): New method definition.
9555         (script_exp_function_segment_start): Return a new
9556         Segment_start_expression.
9557         * gold/script-c.h (script_saw_segment_start_expression): New function
9558         prototype.
9559         * script-sections.cc (Script_sections::Script_sections): Initialize
9560         SAW_SEGMENT_START_EXPRESSION_ to false.
9561         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9562         and -Tbbs options to specify section addresses if given in
9563         command line and no SEGMENT_START expression is seen in a script.
9564         * script-sections.h (Script_sections::saw_segment_start_expression,
9565         Script_sections::set_saw_segment_start_expression): New method
9566         definition.
9567         (Script_sections::saw_segment_start_expression_): New data member
9568         declaration.
9569         * script.cc (script_saw_segment_start_expression): New function.
9570         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9571         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9572         script_test_7.sh and script_test_8.sh.
9573         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9574         script_test_8.stdout.
9575         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9576         (script_test_6, script_test_6.stdout, script_test_7,
9577         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9578         * Makefile.in: Regenerate.
9579         * testsuite/script_test_6.sh: New file.
9580         * testsuite/script_test_6.t: Same.
9581         * testsuite/script_test_7.sh: Same.
9582         * testsuite/script_test_7.t: Same.
9583         * testsuite/script_test_8.sh: Same.
9584
9585 2009-10-16  Doug Kwan  <dougkwan@google.com>
9586
9587         * output.cc (Output_segment::set_section_list_address): Cast
9588         expressions to unsigned long long type to avoid format warnings.
9589
9590 2009-10-15  Ian Lance Taylor  <iant@google.com>
9591
9592         * script.cc (Script_options::add_symbol_assignment): Always add a
9593         dot assignment to script_sections_.
9594         * script-sections.cc (Script_sections::add_dot_assignment):
9595         Initialize if necessary.
9596
9597         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9598         program headers with no load segment if there is a linker script.
9599
9600         * layout.cc (Layout::set_segment_offsets): Align the file offset
9601         to the segment aligment for -N or -n with no load segment.
9602         * output.cc (Output_segment::add_output_section): Don't crash if
9603         the first section is a TLS section.
9604         (Output_segment::set_section_list_addresses): Print an error
9605         message if the address moves backward in a linker script.
9606         * script-sections.cc
9607         (Output_section_element_input::set_section_addresses): Don't
9608         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9609         (Orphan_output_section::set_section_addresses): Likewise.
9610
9611 2009-10-15  Doug Kwan  <dougkwan@google.com>
9612
9613         * layout.cc (Layout::finish_dynamic_section): Generate tags
9614         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9615         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9616         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9617
9618 2009-10-14  Ian Lance Taylor  <iant@google.com>
9619
9620         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9621         fields.
9622         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9623         data_shdr fields of relinfo.
9624         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9625         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9626         R_386_TLS_LDO_32, adjust based on section flags.
9627         (Target_i386::Relocate::fix_up_ldo): Remove.
9628
9629 2009-10-13  Ian Lance Taylor  <iant@google.com>
9630
9631         Add support for -pie.
9632         * options.h (class General_options): Add -pie and
9633         --pic-executable.
9634         (General_options::output_is_position_independent): Test -pie.
9635         (General_options::output_is_executable): Return true if not shared
9636         and not relocatable.
9637         (General_options::output_is_pie): Remove.
9638         * options.cc (General_options::finalize): Reject incompatible uses
9639         of -pie.
9640         * gold.cc (queue_middle_tasks): A -pie link is not static.
9641         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9642         * symtab.cc (Symbol::final_value_is_known): Return false if
9643         output_is_position_independent.
9644         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9645         output_is_position_independent.
9646         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9647         output_is_position_independent.
9648         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9649         output_is_position_independent.
9650         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9651         two_file_pie_test.
9652         (basic_pie_test.o, basic_pie_test): New targets.
9653         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9654         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9655         (two_file_pie_test): New target.
9656         * testsuite/Makefile.in: Rebuild.
9657         * README: Remove note saying that -pie is not supported.
9658
9659 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9660
9661         * options.h (class General_options): Add -init and -fini.
9662         * layout.cc (Layout::finish_dynamic_section): Emit
9663         given init and fini functions.
9664
9665 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9666
9667         * gc.h (gc_process_relocs): Check if icf is enabled using new
9668         function.
9669         * gold.cc (queue_initial_tasks): Likewise.
9670         (queue_middle_tasks): Likewise.
9671         * object.cc (do_layout): Likewise.
9672         * symtab.cc (is_section_folded): Likewise.
9673         * main.cc (main): Likewise.
9674         * reloc.cc (Read_relocs::run): Likewise.
9675         (Sized_relobj::do_scan_relocs): Likewise.
9676         * icf.cc (is_function_ctor_or_dtor): New function.
9677         (Icf::find_identical_sections): Check if function is ctor or dtor when
9678         safe icf is chosen.
9679         * options.h (General_options::icf): Change option to be an enum.
9680         (Icf_status): New enum.
9681         (icf_enabled): New method.
9682         (icf_safe_folding): New method.
9683         (set_icf_status): New method.
9684         (icf_status_): New variable.
9685         * (options.cc) (General_options::finalize): Set icf_status_.
9686         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9687         icf_test and icf_keep_unique_test to use the --icf enum flag.
9688         * testsuite/icf_safe_test.sh: New file.
9689         * testsuite/icf_safe_test.cc: New file.
9690
9691 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9692
9693         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9694         includes to gc.h and icf.h.
9695         * arm.cc: Include gc.h.
9696         * gold.cc: Likewise.
9697         * i386.cc: Likewise.
9698         * powerpc.cc: Likewise.
9699         * sparc.cc: Likewise.
9700         * x86_64.cc: Likewise.
9701         * gc.h: Include icf.h.
9702
9703 2009-10-11  Ian Lance Taylor  <iant@google.com>
9704
9705         * plugin.cc: Include "gold.h" before other header files.
9706
9707 2009-10-10  Chris Demetriou  <cgd@google.com>
9708
9709         * options.h (Input_file_argument::Input_file_type): New enum.
9710         (Input_file_argument::is_lib_): Replace with...
9711         (Input_file_argument::type_): New member.
9712         (Input_file_argument::Input_file_argument): Take Input_file_type
9713         'type' rather than boolean 'is_lib' as second argument.
9714         (Input_file_argument::is_lib): Use type_.
9715         (Input_file_argument::is_searched_file): New function.
9716         (Input_file_argument::may_need_search): Handle is_searched_file.
9717         * options.cc (General_options::parse_library): Support -l:filename.
9718         (General_options::parse_just_symbols): Update for Input_file_argument
9719         changes.
9720         (Command_line::process): Likewise.
9721         * archive.cc (Archive::get_file_and_offset): Likewise.
9722         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9723         * script.cc (read_script_file, script_add_file): Likewise.
9724         * fileread.cc (Input_file::Input_file): Likewise.
9725         (Input_file::will_search_for): Handle is_searched_file.
9726         (Input_file::open): Likewise.
9727         * readsyms.cc (Read_symbols::get_name): Likewise.
9728         * testsuite/Makefile.am (searched_file_test): New test.
9729         * testsuite/Makefile.in: Regenerate.
9730         * testsuite/searched_file_test.cc: New file.
9731         * testsuite/searched_file_test_lib.cc: New file.
9732
9733 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9734             Ian Lance Taylor  <iant@google.com>
9735
9736         * descriptor.cc: Include <cstdio> and "binary-io.h".
9737         (Descriptors::open): Open the files in binary mode always.
9738         * script.cc (Lex::get_token): Treat \r as whitespace.
9739
9740 2009-10-09  Ian Lance Taylor  <iant@google.com>
9741
9742         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9743
9744 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9745             Ian Lance Taylor  <iant@google.com>
9746
9747         * configure.ac: Check for readv function also.
9748         * fileread.cc (readv): Define if not HAVE_READV.
9749         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9750         does not exist.
9751         * config.in: Regenerate.
9752         * configure: Regenerate.
9753
9754 2009-10-09  Doug Kwan  <dougkwan@google.com>
9755
9756         * layout.cc (Layout::make_output_section): Call target hook to make
9757         ordinary output section.
9758         (Layout::finalize): Adjust parameter list of call the
9759         Target::may_relax().
9760         * layout.h (class Layout::section_list): New method.
9761         * merge.h (Output_merge_base::entsize): Change visibility to public.
9762         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9763         New methods.
9764         (Output_merge_string::do_is_string): New method.
9765         * object.cc (Sized_relobj::do_setup): renamed from
9766         Sized_relobj::set_up.
9767         * object.h (Sized_relobj::adjust_shndx,
9768         Sized_relobj::initializ_input_to_output_maps,
9769         Sized_relobj::free_input_to_output_maps): Change visibilities to
9770         protected.
9771         (Sized_relobj::setup): Virtualize.
9772         (Sized_relobj::do_setup): New method declaration.
9773         (Sized_relobj::invalidate_section_offset,
9774         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9775         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9776         * options.cc (parse_int): New function.
9777         * options.h (parse_int): New declaration.
9778         (DEFINE_int): New macro.
9779         (stub_group_size): New option.
9780         * output.cc (Output_section::Output_section): Initialize memebers
9781         merge_section_map_, merge_section_by_properties_map_,
9782         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9783         (Output_section::add_input_section): Handled deferred code-fill
9784         generation and remove an old comment.
9785         (Output_section::add_relaxed_input_section): New method definition.
9786         (Output_section::add_merge_input_section): Use merge section by
9787         properties map to speed to search.  Update merge section maps
9788         as appropriate.
9789         (Output_section::build_relaxation_map): New method definition.
9790         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9791         Same.
9792         (Output_section::relax_input_section): Renamed to
9793         Output_section::convert_input_sections_to_relaxed_sections and change
9794         interface to take a vector of pointers to relaxed sections.
9795         (Output_section::find_merge_section,
9796         Output_section::find_relaxed_input_section): New method definitions.
9797         (Output_section::is_input_address_mapped,
9798         Output_section::output_offset, Output_section::output_address):
9799         Use output section data maps to speed up searching.
9800         (Output_section::find_starting_output_address): Add comments.
9801         (Output_section::do_write,
9802         Output_section::write_to_postprocessing_buffer): Do code-fill
9803         generation as appropriate.
9804         (Output_section::get_input_sections): Invalidate relaxed input section
9805         map.
9806         (Output_section::restore_states): Adjust type of checkpoint .
9807         Invalidate relaxed input section map.
9808         * output.h (Output_merge_base): New class declaration.
9809         (Input_section_specifier): New class defintion.
9810         (class Output_relaxed_input_section) Change base class to
9811         Output_section_data_build.
9812         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9813         base class initializer.
9814         (Output_section::add_relaxed_input_section): New method declaration.
9815         (Output_section::Input_section): Change visibility to protected.
9816         (Output_section::Input_section::relobj,
9817         Output_section::Input_section::shndx): Handle relaxed input sections.
9818         Output_section::input_sections) Change visibility to protected.  Also
9819         define overload to return a non-const pointer.
9820         (Output_section::Merge_section_properties): New class defintion.
9821         (Output_section::Merge_section_by_properties_map,
9822         Output_section::Output_section_data_by_input_section_map,
9823         Output_section::Relaxation_map): New types.
9824         (Output_section::relax_input_section): Rename method to
9825         Output_section::convert_input_sections_to_relaxed_sections and change
9826         interface to take a vector of relaxed section pointers.
9827         (Output_section::find_merge_section,
9828         Output_section::find_relaxed_input_section,
9829         Output_section::build_relaxation_map,
9830         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9831         New method declarations.
9832         (Output_section::merge_section_map_
9833         Output_section::merge_section_by_properties_map_,
9834         Output_section::relaxed_input_section_map_,
9835         Output_section::is_relaxed_input_section_map_valid_,
9836         Output_section::generate_code_fills_at_write_): New data members.
9837         * script-sections.cc
9838         (Output_section_element_input::set_section_addresses): Call
9839         current_data_size and addralign methods of relaxed input sections.
9840         (Orphan_output_section::set_section_addresses): Call current_data_size
9841         and addralign methods of relaxed input sections.
9842         * symtab.cc (Symbol_table::compute_final_value): Extract template
9843         from the body of Symbol_table::sized_finalize_symbol.
9844         (Symbol_table::sized_finalized_symbol): Call
9845         Symbol_table::compute_final_value.
9846         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9847         (Symbol_table::compute_final_value): New templated method declaration.
9848         * target.cc (Target::do_make_output_section): New method defintion.
9849         * target.h (Target::make_output_section): New method declaration.
9850         (Target::relax): Add more parameters for input objects, symbol table
9851         and layout.  Adjust call to do_relax.
9852         (Target::do_make_output_section): New method declaration.
9853         (Target::do_relax): Add parameters for input objects, symbol table
9854         and layout.
9855
9856 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9857
9858         * pread.c: Include stdio.h.
9859
9860 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9861
9862         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9863         defined.
9864
9865 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9866
9867         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9868         Change read_shndx type to unsigned int.
9869         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9870         int.
9871         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9872         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9873         Change read_shndx type to unsigned int.
9874         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9875         int.
9876         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9877         * layout.cc (Layout::create_symtab_sections): Cast the result of
9878         local_symcount * symsize to off_t in the gold_assert.
9879
9880 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9881
9882         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9883         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9884         R_ARM_BASE_ABS.
9885         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9886         (Arm_relocate_functions::thm_abs5): New function.
9887         (Arm_relocate_functions::abs12): New function.
9888         (Arm_relocate_functions::abs16): New function.
9889         (Arm_relocate_functions::base_abs): New function.
9890         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9891         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9892         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9893         R_ARM_BASE_ABS.
9894         (Scan::global): Likewise.
9895         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9896         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9897         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9898         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9899         R_ARM_BASE_ABS.
9900
9901 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9902
9903         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9904         (Arm_relocate_functions::movt_prel): New function.
9905         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9906         (Arm_relocate_functions::thm_movt_prel): New function.
9907         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9908         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9909         (Scan::global, Relocate::relocate): Likewise.
9910         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9911
9912 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9913
9914         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9915         Incremental_checker.
9916         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9917         unsigned int.
9918         (class Incremental_inputs_header): New class.
9919         (Incremental_inputs_header_writer): Edit comment.
9920         (Incremental_inputs_entry): New class.
9921         (Incremental_inputs_entry_writer): Edit comment.
9922         (Sized_incremental_binary::do_find_incremental_inputs_section):
9923         Add *strtab_shndx parameter, fill it.
9924         (Sized_incremental_binary::do_check_inputs): New method.
9925         (Incremental_checker::can_incrementally_link_output_file): Use
9926         Sized_incremental_binary::check_inputs.
9927         (Incremental_inputs::report_command_line): Save command line in
9928         command_line_.
9929         * incremental.h:
9930         (Incremental_binary::find_incremental_inputs_section): New
9931         method.
9932         (Incremental_binary::do_find_incremental_inputs_section): Add
9933         strtab_shndx parameter.
9934         (Incremental_binary::do_check_inputs): New pure virtual method.
9935         (Sized_incremental_binary::do_check_inputs): Declare.
9936         (Incremental_checker::Incremental_checker): Add incremental_inputs
9937         parameter, use it to initialize incremental_inputs_.
9938         (Incremental_checker::incremental_inputs_): New field.
9939         (Incremental_checker::command_line): New method.
9940         (Incremental_checker::inputs): New method.
9941         (Incremental_checker::command_line_): New field.
9942
9943 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9944
9945         * incremental.cc: Include <cstdarg> and "target-select.h".
9946         (vexplain_no_incremental): New function.
9947         (explain_no_incremental): New function.
9948         (Incremental_binary::error): New method.
9949         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9950         method.
9951         (make_sized_incremental_binary): New function.
9952         (open_incremental_binary): New function.
9953         (can_incrementally_link_file): Add checks if output is ELF and has
9954         inputs section.
9955         * incremental.h: Include "elfcpp_file.h" and "output.h".
9956         (Incremental_binary): New class.
9957         (Sized_incremental_binary): New class.
9958         (open_incremental_binary): Declare.
9959         * object.cc (is_elf_object): Use
9960         elfcpp::Elf_recognizer::is_elf_file.
9961         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9962         * output.h (Output_file::filesize): New method.
9963
9964 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9965
9966         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9967         New function.
9968         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9969         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9970         function.
9971         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9972         function.
9973         (Arm_relocate_functions::movw_abs_nc): New function.
9974         (Arm_relocate_functions::movt_abs): New function.
9975         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9976         (Arm_relocate_functions::thm_movt_abs): New function.
9977         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9978         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9979         (Scan::global): Likewise.
9980         (Relocate::relocate): Likewise.
9981         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9982
9983 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9984
9985         * arm.cc (Arm_relocate_functions::got_prel) New function.
9986         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9987         (Relocate::relocate): Likewise.
9988         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9989
9990 2009-10-06  Ian Lance Taylor  <iant@google.com>
9991
9992         * options.h (class General_options): Define
9993         split_stack_adjust_size parameter.
9994         * object.h (class Object): Add uses_split_stack_ and
9995         has_no_split_stack_ fields.  Add uses_split_stack and
9996         has_no_split_stack accessor functions.  Declare
9997         handle_split_stack_section.
9998         (class Reloc_symbol_changes): Define.
9999         (class Sized_relobj): Define Function_offsets.  Declare
10000         split_stack_adjust, split_stack_adjust_reltype, and
10001         find_functions.
10002         * object.cc (Object::handle_split_stack_section): New function.
10003         (Sized_relobj::do_layout): Call handle_split_stack_section.
10004         * dynobj.cc (Sized_dynobj::do_layout): Call
10005         handle_split_stack_section.
10006         * reloc.cc (Sized_relobj::relocate_sections): Call
10007         split_stack_adjust for executable sections in split_stack
10008         objects.  Pass reloc_map to relocate_section.
10009         (Sized_relobj::split_stack_adjust): New function.
10010         (Sized_relobj::split_stack_adjust_reltype): New function.
10011         (Sized_relobj::find_functions): New function.
10012         * target-reloc.h: Include "object.h".
10013         (relocate_section): Add reloc_symbol_changes parameter.  Change
10014         all callers.
10015         * target.h (class Target): Add calls_non_split method.  Declare
10016         do_calls_non_split virtual method.  Declare match_view and
10017         set_view_to_nop.
10018         * target.cc: Include "elfcpp.h".
10019         (Target::do_calls_non_split): New function.
10020         (Target::match_view): New function.
10021         (Target::set_view_to_nop): New function.
10022         * gold.cc (queue_middle_tasks): Give an error if mixing
10023         split-stack and non-split-stack objects with -r.
10024         * i386.cc (Target_i386::relocate_section): Add
10025         reloc_symbol_changes parameter.
10026         (Target_i386::do_calls_non_split): New function.
10027         * x86_64.cc (Target_x86_64::relocate_section): Add
10028         reloc_symbol_changes parameter.
10029         (Target_x86_64::do_calls_non_split): New function.
10030         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10031         parameter.
10032         * powerpc.cc (Target_powerpc::relocate_section): Add
10033         reloc_symbol_changes parameter.
10034         * sparc.cc (Target_sparc::relocate_section): Add
10035         reloc_symbol_changes parameter.
10036         * configure.ac: Call AM_CONDITIONAL for the default target.
10037         * configure: Rebuild.
10038         * testsuite/Makefile.am (TEST_AS): New variable.
10039         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10040         (check_DATA): Add split_i386 and split_x86_64 files.
10041         (SPLIT_DEFSYMS): Define.
10042         (split_i386_[1234n].o): New targets.
10043         (split_i386_[124]): New targets.
10044         (split_i386_[1234r].stdout): New targets.
10045         (split_x86_64_[1234n].o): New targets.
10046         (split_x86_64_[124]): New targets.
10047         (split_x86_64_[1234r].stdout): New targets.
10048         (MOSTLYCLEANFILES): Add new executables.
10049         * testsuite/split_i386.sh: New file.
10050         * testsuite/split_x86_64.sh: New file.
10051         * testsuite/split_i386_1.s: New file.
10052         * testsuite/split_i386_2.s: New file.
10053         * testsuite/split_i386_3.s: New file.
10054         * testsuite/split_i386_4.s: New file.
10055         * testsuite/split_i386_n.s: New file.
10056         * testsuite/split_x86_64_1.s: New file.
10057         * testsuite/split_x86_64_2.s: New file.
10058         * testsuite/split_x86_64_3.s: New file.
10059         * testsuite/split_x86_64_4.s: New file.
10060         * testsuite/split_x86_64_n.s: New file.
10061         * testsuite/testfile.cc (Target_test): Update relocation_section
10062         function.
10063         * testsuite/Makefile.in: Rebuild.
10064
10065 2009-10-06  Ian Lance Taylor  <iant@google.com>
10066
10067         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10068         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10069         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10070         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10071         the address on ldo_addrs_.
10072         (Target_i386::Relocate::fix_up_ldo): New function.
10073
10074 2009-10-06   Rafael Espindola  <espindola@google.com>
10075
10076         * plugin.cc (add_input_library): New.
10077         (Plugin::load): Add add_input_library to tv.
10078         (Plugin_manager::add_input_file): Add the is_lib argument.
10079         (add_input_file): Update call to Plugin_manager::add_input_file.
10080         (add_input_library): New.
10081         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10082
10083 2009-09-30  Doug Kwan  <dougkwan@google.com>
10084
10085         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10086         symbol and call Symbol::may_need_copy_reloc to determine if
10087         a copy reloc is needed.
10088         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10089         nocopyreloc is given in command line.
10090         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10091         given in command line.
10092         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10093         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10094         of the removed Target_i386::may_need_copy_reloc.
10095         * options.h (copyreloc): New option with default value false.
10096         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10097         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10098         instead of the removed Target_powerpc::may_need_copy_reloc.
10099         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10100         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10101         instead of the removed Target_sparc::may_need_copy_reloc.
10102         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10103         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10104         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10105         instead of the removed Target_x86_64::may_need_copy_reloc.
10106
10107 2009-09-30  Ian Lance Taylor  <iant@google.com>
10108
10109         * object.h (class Object): Remove target_ field, and target,
10110         sized_target, and set_target methods.
10111         (Object::sized_target): Remove.
10112         (class Sized_relobj): Update declarations.  Remove sized_target.
10113         * object.cc (Sized_relobj::setup): Remove target parameter.
10114         Change all callers.
10115         (Input_objects::add_object): Don't do anything with the target.
10116         (make_elf_sized_object): Add punconfigured parameter.  Change all
10117         callers.  Set or test parameter target.
10118         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10119         Change all callers.
10120         * parameters.cc (Parameters::set_target): Change parameter type to
10121         be non-const.
10122         (Parameters::default_target): Remove.
10123         (set_parameters_target): Change parameter type to be non-const.
10124         (parameters_force_valid_target): New function.
10125         (parameters_clear_target): New function.
10126         * parameters.h (class Parameters): Update declarations.  Remove
10127         default_target method.  Add sized_target and clear_target
10128         methods.  Change target_ to be non-const.
10129         (set_parameters_target): Update declaration.
10130         (parameters_force_valid_target): Declare.
10131         (parameters_clear_target): Declare.
10132         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10133         as NULL if we aren't searching.
10134         (Add_symbols::run): Don't check for compatible target.
10135         * fileread.cc (Input_file::open_binary): Call
10136         parameters_force_valid_target.
10137         * gold.cc (queue_middle_tasks): Likewise.
10138         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10139         set_target on object.
10140         * dynobj.h (class Sized_dynobj): Update declarations.
10141         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10142         make_elf_object returns NULL.
10143         (Archive::include_member): Don't check whether object target is
10144         compatible.
10145         * output.cc (Output_section::add_input_section): Get target from
10146         parameters.
10147         (Output_section::relax_input_section): Likewise.
10148         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10149         parameters.
10150         (Sized_relobj::do_scan_relocs): Likewise.
10151         (Sized_relobj::relocate_sections): Likewise.
10152         * resolve.cc (Symbol_table::resolve): Likewise.
10153         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10154         parameter.  Change all callers.
10155         (Symbol_table::add_from_object): Get target from parameters.
10156         (Symbol_table::add_from_relobj): Don't check object target.
10157         (Symbol_table::add_from_dynobj): Likewise.
10158         (Symbol_table::define_special_symbol): Get target from
10159         parameters.
10160         * symtab.h (class Symbol_table): Update declaration.
10161         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10162         parameter.  Change all callers.  Clear parameter target.
10163         (Binary_test): Test target here.
10164         * testsuite/object_unittest.cc (gold_testsuite): Remove
10165         target_test_pointer parameter.  Change all callers.
10166         (Object_test): Test target here.
10167
10168 2009-09-26  Ian Lance Taylor  <iant@google.com>
10169
10170         * testsuite/initpri1.c: Don't try to use constructor priorities if
10171         compiling with gcc before 4.3.
10172
10173 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10174
10175         * testsuite/retain_symbols_file_test.sh (check_present): Change
10176         output file name to retain_symbols_file_test.stdout.
10177         (check_absent): Likewise.
10178
10179 2009-09-18  Craig Silverstein  <csilvers@google.com>
10180
10181         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10182         * options.cc: Include <cerrno> and <fstream>.
10183         (General_options::finalize): Parse -retain-symbols-file tag.
10184         * options.h: New flag.
10185         (General_options): New method should_retain_symbol, new
10186         variable symbols_to_retain.
10187         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10188         should_retain_symbol map.
10189         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10190         * testsuite/Makefile.in: Regenerate.
10191         * testsuite/retain_symbols_file_test.sh: New file.
10192
10193 2009-09-18  Nick Clifton  <nickc@redhat.com>
10194
10195         * po/es.po: Updated Spanish translation.
10196
10197 2009-09-17  Doug Kwan  <dougkwan@google.com>
10198
10199         * debug.h (DEBUG_RELAXATION): New constant.
10200         (DEBUG_ALL): Add DEBUG_RELAXATION.
10201         (debug_string_to_enum): Add relaxation debug option.
10202         * layout.cc
10203         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10204         Layout::Relaxation_debug_check::read_sections,
10205         Layout::Relaxation_debug_check::read_sections): New method definitions.
10206         (Layout::Layout): Initialize data members
10207         record_output_section_data_from_scrips_,
10208         script_output_section_data_list_ and relaxation_debug_check_.
10209         (Layout::save_segments, Layout::restore_segments,
10210         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10211         Layout::relaxation_loop_body): New method definitions.
10212         (Layout::finalize): Support relaxation.  Move section layout code to
10213         Layout::relaxation_loop_body.
10214         (Layout::set_asection_address_from_script): Move code for orphan
10215         section placement out.
10216         (Layout::place_orphan_sections_in_script): New method definition.
10217         * layout.h (Output_segment_headers, Output_file_header):
10218         New forward class declarations.
10219         (Layout::~Layout): Define.
10220         (Layout::new_output_section_data_from_script): New method definition.
10221         (Layout::place_orphan_sections_in_script): New method declaration.
10222         (Layout::Segment_states): New type declaration.
10223         (Layout::save_segments, Layout::restore_segments,
10224         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10225         Layout::relaxation_loop_body): New method declarations.
10226         (Layout::Output_section_data_list): New type declaration.
10227         (Layout::Relaxation_debug_check): New class definition.
10228         (Layout::record_output_section_data_from_script_,
10229         Layout::script_output_section_data_list_, Layout::segment_states_,
10230         Layout::relaxation_debug_check_): New data members.
10231         * output.cc: (Output_section_headers::do_size): New method definition.
10232         (Output_section_headers::Output_section_headers): Move size
10233         computation to Output_section_headers::do_size.
10234         (Output_segment_headers::do_size): New method definition.
10235         (Output_file_header::Output_file_header): Move size computation to
10236         Output_file_header::do_size and call it.
10237         (Output_file_header::do_size): New method definition.
10238         (Output_data_group::Output_data_group): Adjust call to
10239         Output_section_data.
10240         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10241         (Output_symtab_xindex::do_write): Add array bound check.
10242         (Output_section::Input_section::print_to_mapfile): Handle
10243         RELAXED_INPUT_SECTION_CODE.
10244         (Output_section::Output_section): Initialize data member checkpoint_.
10245         (Output_section::~Output_section): Delete checkpoint object pointed
10246         by checkpoint_.
10247         (Output_section::add_input_section): Always add an Input_section if
10248         relaxing.
10249         (Output_section::add_merge_input_section): Add assert.
10250         (Output_section::relax_input_section): New method definition.
10251         (Output_section::set_final_data_size): Set load address to zero for
10252         an unallocated section.
10253         (Output_section::do_address_and_file_offset_have_reset_values):
10254         New method definition.
10255         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10256         Handle relaxed input section.
10257         (Output_section::sort_attached_input_sections): Checkpoint input
10258         section list lazily.
10259         (Output_section::get_input_sections): Change type of input_sections to
10260         list of Simple_input_section pointers.  Checkpoint input section list
10261         lazily.  Also handle relaxed input sections.
10262         (Output_section::add_input_section_for_script): Take a reference to
10263         a Simple_input_section object instead of Relobj pointer and section
10264         index as parameter.  Handle relaxed input sections.
10265         (Output_section::save_states, Output_section::restore_states): New
10266         method definitions.
10267         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10268         (Output_data::is_data_size_fixed): New method definition.
10269         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10270         if it is fixed.
10271         (Output_data::address_and_file_offset_have_reset_values): New method
10272         definition.
10273         (Output_data::do_address_and_file_offset_have_reset_values): New method
10274         definition.
10275         (Output_data::set_data_size): Check that data size is not fixed.
10276         (Output_data::fix_data_size): New method definition.
10277         (Output_data::is_data_size_fixed_): New data member.
10278         (Output_section_headers::set_final_data_size): New method definition.
10279         (Output_section_headers::do_size): New method declaration.
10280         (Output_segment_headers::set_final_data_size): New method definition.
10281         (Output_segment_headers::do_size): New method declaration.
10282         (Output_file_header::set_final_data_size)::New method definition.
10283         (Output_file_header::do_size)::New method declaration.
10284         (Output_section_data::Output_section_data): Add new parameter
10285         is_data_size_fixed and use it to fix data size.
10286         (Output_data_const::Output_data_const): Adjust call to base class
10287         constructor and fix data size.
10288         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10289         base class constructor and fix data size.
10290         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10291         base class constructor and fix data size.
10292         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10293         class constructor and fix data size.
10294         (Output_data_group::set_final_data_size): New method definition.
10295         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10296         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10297         class constructor and fix data size.
10298         (Output_relaxed_input_section): New class definition.
10299         (Output_section::Simple_input_section): New class definition.
10300         (Output_section::get_input_sections): Adjust parameter list.
10301         (Output_section::add_input_section_for_script): Same.
10302         (Output_section::save_states, Output_section::restore_states,
10303         Output_section::do_address_and_file_offset_have_reset_values,
10304         (Output_section::Input_section::Input_section): Handle
10305         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10306         Output_relaxed_input_section.
10307         (Output_section::Input_section::is_input_section,
10308         Output_section::Input_section::set_output_section): Handle relaxed
10309         input section.
10310         (Output_section::Input_section::is_relaxed_input_section,
10311         Output_section::Input_section::output_section_data,
10312         Output_section::Input_section::relaxed_input_section): New method
10313         definitions.
10314         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10315         value.
10316         (Output_section::Input_section::u1_): Update comments.
10317         (Output_section::Input_section::u2_): Add new union member poris.
10318         (Output_section::Checkpoint_output_section): New classs definition.
10319         (Output_section::relax_input_section): New method declaration.
10320         (Output_section::checkpoint_): New data member.
10321         (Output_segment): Update comments.
10322         (Output_segment::Output_segment): Un-privatize copy constructor.
10323         (Output_segment::operator=): Un-privatize.
10324         * script-sections.cc (Output_section_element::Input_section_list):
10325         Change element type to Output_section::Simple_input_section.
10326         (Output_section_element_dot_assignment::set_section_addresses):
10327         Register output section data for relaxation clean up.
10328         (Output_data_exression::Output_data_expression): Adjust call to base
10329         constructor to fix data size.
10330         (Output_section_element_data::set_section_addresses): Register
10331         Output_data_expression object for relaxation clean up.
10332         (struct Input_section_info): Replace Relobj pointer and section index
10333         pair with Output_section::Simple_input_section and Convert struct to a
10334         class.
10335         (Input_section_sorter::operator()): Adjust access to
10336         Input_section_info data member to use accessors.
10337         (Output_section_element_input::set_section_addresses): Use layout
10338         parameter.  Adjust code to use Output_section::Simple_input_section
10339         and Input_secction_info classes.  Register filler for relaxation
10340         clean up.
10341         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10342         and section index pair with Output_section::Simple_input_section
10343         class.  Adjust code accordingly.
10344         (Phdrs_element::release_segment): New method definition.
10345         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10346         segment list.
10347         (Script_sections::release_segments): New method definition.
10348         * gold/script-sections.h (Script_sections::release_segments): New
10349         method declaration.
10350         * gold/target.h (Target::may_relax, Target::relax,
10351         Target::do_may_relax, Target::do_relax): New method definitions.
10352
10353 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10354
10355         * arm.cc (has_signed_unsigned_overflow): New function.
10356         (Arm_relocate_functions::abs8): New function.
10357         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10358         (Target_arm::Scan::global): Likewise.
10359         (Target_arm::relocate::relocate): Likewise.
10360         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10361         Likewise.
10362
10363 2009-09-16  Cary Coutant  <ccoutant@google.com>
10364
10365         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10366         * testsuite/Makefile.in: Regenerate.
10367
10368 2009-09-11  Nick Clifton  <nickc@redhat.com>
10369
10370         * po/gold.pot: Updated by the Translation project.
10371
10372 2009-09-08  Cary Coutant  <ccoutant@google.com>
10373
10374         * output.cc (Output_file::open): Add execute permission to empty file.
10375         * testsuite/Makefile.am (permission_test): New test.
10376         * testsuite/Makefile.in: Regenerate.
10377
10378 2009-09-02  Ian Lance Taylor  <iant@google.com>
10379
10380         * output.cc (Output_file::resize): Call map_no_anonymous rather
10381         than map.
10382
10383 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10384
10385         * gold.cc: Include "incremental.h".
10386         (queue_initial_tasks): Call Incremental_checker methods.
10387         * incremental.cc: Include "output.h".
10388         (Incremental_checker::can_incrementally_link_output_file): New
10389         method.
10390         * incremental.h (Incremental_checker): New class.
10391
10392         * output.cc (Output_file::open_for_modification): New method.
10393         (Output_file::map_anonymous): Changed return type to bool.  Record
10394         map in base_ field.
10395         (Output_file::map_no_anonymous): New method, broken out of map.
10396         (Output_file::map): Use map_no_anonymous and map_anonymous.
10397         * output.h (class Output_file): Update declarations.
10398
10399 2009-08-24  Cary Coutant  <ccoutant@google.com>
10400
10401         * options.h (Command_line::Pre_options): New class.
10402         (Command_line::pre_options): New member.
10403         * options.cc (gold::options::ready_to_register): New variable.
10404         (One_option::register_option): Do nothing if not registering options.
10405         Assert if same short option registered twice.
10406         (General_options::General_options): Turn off option registration when
10407         done constructing.
10408         (Command_line::Pre_options::Pre_options): New constructor.
10409
10410 2009-08-24  Cary Coutant  <ccoutant@google.com>
10411
10412         * options.h (General_options::no_keep_memory): Remove incorrect
10413         short option.
10414
10415 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10416
10417         * Makefile.am (am__skiplex, am__skipyacc): New.
10418         * Makefile.in: Regenerate.
10419
10420 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10421
10422         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10423         (INCLUDES): ... this.
10424         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10425         (AM_CPPFLAGS): Renamed from ...
10426         (INCLUDE): ... this.
10427         * Makefile.in, testsuite/Makefile.in: Regenerate.
10428
10429         * Makefile.in: Regenerate.
10430         * aclocal.m4: Likewise.
10431         * config.in: Likewise.
10432         * configure: Likewise.
10433         * testsuite/Makefile.in: Likewise.
10434
10435         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10436         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10437         * Makefile.in: Regenerate.
10438         * testsuite/Makefile.in: Regenerate.
10439
10440 2009-08-19  Cary Coutant  <ccoutant@google.com>
10441
10442         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10443         symbols in shared libraries overridden by hidden or internal symbols
10444         in the main program.
10445
10446 2009-08-19  Chris Demetriou  <cgd@google.com>
10447
10448         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10449         checking source file names in error messages.
10450
10451 2009-08-18  Doug Kwan  <dougkwan@google.com>
10452
10453         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10454         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10455         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10456         an elfcpp::Ehdr as parameter.
10457         * object.cc (Object::set_target): Remove the version that looks up
10458         a target and sets it.
10459         (Sized_relobj::setup): Take a Target object instead of
10460         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10461         (make_elf_sized_object): Find target and ask target to
10462         make an ELF object.
10463         * object.h: (Object::set_target): Remove the version that looks up
10464         a target and sets it.
10465         (Sized_relobj::setup): Take a Target object instead of
10466         an elfcpp:Ehdr as parameter.
10467         * target.cc: Include dynobj.h.
10468         (Target::do_make_elf_object_implementation): New.
10469         (Target::do_make_elf_object): New.
10470         * target.h (Target::make_elf_object): New template declaration.
10471         (Target::do_make_elf_object): New method declarations.
10472         (Target::do_make_elf_object_implementation): New template declaration.
10473
10474 2009-08-14  Ian Lance Taylor  <iant@google.com>
10475
10476         * gold.h (FUNCTION_NAME): Define.
10477         (gold_unreachable): Use FUNCTION_NAME.
10478
10479 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10480
10481         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10482         symbol in the --keep-unique list is not found.
10483
10484 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10485
10486         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10487         been maked as --keep-unique.
10488         (Icf::unfold_section): New function.
10489         * icf.h (Icf::unfold_section): New function.
10490         * options.h (General_options::keep_unique): New option.
10491         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10492         * testsuite/Makefile.in: Regenerate.
10493         * testsuite/icf_keep_unique_test.sh: New file.
10494         * testsuite/icf_keep_unique_test.cc: New file.
10495
10496 2009-08-12  Cary Coutant  <ccoutant@google.com>
10497
10498         PR 10471
10499         * resolve.cc (Symbol_table::resolve): Check for references from
10500         dynamic objects to hidden and internal symbols.
10501         * testsuite/Makefile.am (hidden_test.sh): New test.
10502         * testsuite/Makefile.in: Regenerate.
10503         * testsuite/hidden_test.sh: New script.
10504         * testsuite/hidden_test_1.c: New test source.
10505         * testsuite/hidden_test_main.c: New test source.
10506
10507 2009-08-11  Doug Kwan  <dougkwan@google.com>
10508
10509         * arm.cc: Update comments.
10510         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10511         segment to locate the .ARM.exidx section if present.
10512
10513 2009-08-09  Doug Kwan  <dougkwan@google.com>
10514
10515         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10516         patch.
10517
10518 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10519         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10520         compiler warnings.
10521
10522 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10523
10524         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10525         valid tls_segment only for non-debug-section relocations.
10526         * testsuite/Makefile.am: Add gc_tls_test.
10527         * testsuite/Makefile.in: Regenerate.
10528         * testsuite/gc_tls_test.cc: New file.
10529         * testsuite/gc_tls_test.sh: New file.
10530
10531 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10532
10533         * icf.cc: New file.
10534         * icf.h: New file.
10535         * Makefile.am (CCFILES): Add icf.cc.
10536         (HFILES): Add icf.h
10537         * Makefile.in: Regenerate.
10538         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10539         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10540         section, symbol and addend information for the relocs.
10541         * gold.cc (queue_middle_tasks): Call identical code folding.
10542         * gold.h: Add defines for multimap.
10543         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10544         to the call of finalize_local_symbols.
10545         * main.cc (main): Create object of class Icf.
10546         * object.cc (Sized_relobj::do_layout): Allow this function to be
10547         called twice during icf.
10548         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10549         to sections marked as identical by icf.
10550         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10551         when available.
10552         (Sized_relobj::do_section_entsize): New function.
10553         * object.h (Object::section_entsize): New function.
10554         (Object::do_section_entsize): New pure virtual function.
10555         (Relobj::finalize_local_symbols): Add new parameter.
10556         (Relobj::do_section_entsize): New function.
10557         * options.h (General_options::icf): New option.
10558         (General_options::icf_iterations): New option.
10559         (General_options::print_icf_sections): New option.
10560         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10561         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10562         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10563         icf.
10564         * symtab.cc (Symbol_table::is_section_folded): New function.
10565         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10566         to sections marked as identical by icf.
10567         * symtab.h (Symbol_table::set_icf): New function.
10568         (Symbol_table::icf): New function.
10569         (Symbol_table::is_section_folded): New function.
10570         (Symbol_table::icf_): New data member.
10571         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10572         * testsuite/Makefile.am: Add commands to build icf_test.
10573         * testsuite/Makefile.in: Regenerate.
10574         * testsuite/icf_test.sh: New file.
10575         * testsuite/icf_test.cc: New file.
10576
10577 2009-07-24  Chris Demetriou  <cgd@google.com>
10578
10579         * layout.cc (is_compressible_debug_section): Fix incorrect
10580         comment about compressed section names.
10581
10582 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10583
10584         PR 10419
10585         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10586
10587 2009-07-16  Ian Lance Taylor  <iant@google.com>
10588
10589         PR 10400
10590         * layout.h: #include <map>.
10591         (class Kept_section): Change from struct to class.  Add accessors
10592         and setters.  Add section size to Comdat_group mapping.  Change
10593         Comdat_group to std::map.  Add is_comdat_ field.  Add
10594         linkonce_size field in union.
10595         (class Layout): Update declaration of find_or_add_kept_section.
10596         Don't declare find_kept_object.
10597         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10598         parameter.  Add object, shndx, is_comdat, and is_group_name
10599         parameters.  Change all callers.  Adjust for new Kept_section.
10600         (Layout::find_kept_object): Remove.
10601         * object.cc (Sized_relobj::include_section_group): Update use of
10602         Kept_section.  Rename secnum to shndx.  Only record
10603         Kept_comdat_section if sections are the same size.
10604         (Sized_relobj::include_linkonce_section): Update use of
10605         Kept_section.  Only record Kept_comdat_section if sections are the
10606         same size.  Set size of linkonce section.
10607         (Sized_relobj::map_to_kept_section): Update call to
10608         get_kept_comdat_section.
10609         * object.h (class Sized_relobj): Rename fields in
10610         Kept_comdat_section to drop trailing underscores; change object
10611         field to Relobj*.  Change Kept_comdat_section_table to store
10612         struct rather than pointer.
10613         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10614         Add kept_object and kept_shndx parameters.  Change all callers.
10615         (Sized_relobj::get_kept_comdat_section): Change return type to
10616         bool.  Add kept_object and kept_shndx parameters.  Change all
10617         callers.
10618         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10619         Layout::find_or_add_kept_section.
10620
10621 2009-07-09  Ian Lance Taylor  <iant@google.com>
10622
10623         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10624         Reserve space in the hash table.
10625
10626 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10627
10628         * fileread.cc (File_read::get_mtime): New method.
10629         * fileread.h (Timespec): New structure.
10630         (File_read::get_mtime): New method.
10631         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10632         Renamed from timestamp_nsec.
10633         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10634         Elf_Xword.
10635         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10636         timestamp_nsec.
10637         (Incremental_inputs::report_archive): Save mtime; style fix.
10638         (Incremental_inputs::report_obejct): Save mtime; style fix.
10639         (Incremental_inputs::report_script): Save mtime; style fix.
10640         (Incremental_inputs::finalize_inputs): Style fix.
10641         (Incremental_inputs::finalize): Style fix.
10642         (Incremental_inputs::create_input_section_data): Store inputs
10643         mtime.
10644         * incremental.h (Incremental_inputs::report_script): Add mtime
10645         argument.
10646         (Incremental_inputs::Input_info::Input_info): Intialize only one
10647         union member.
10648         (Incremental_inputs::Input_info::archive): Move to nameless
10649         union.
10650         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10651         (Incremental_inputs::Input_info::script): Move to nameless union.
10652         (Incremental_inputs::mtime): New field.
10653         * script.cc (read_input_script): Pass file mtime to
10654         Incremental_input.
10655         * script.h (Script_info::inputs): Style fix.
10656
10657 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10658
10659         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10660         instead of 32.
10661
10662 2009-06-24  Ian Lance Taylor  <iant@google.com>
10663
10664         PR 10156
10665         * layout.cc (Layout::choose_output_section): If we find an
10666         existing section, update the flags.
10667         (Layout::create_notes): New function, broken out of
10668         Layout::finalize.
10669         (Layout::finalize): Don't create note sections.
10670         (Layout::create_note): Don't crash if linker script discards
10671         section.
10672         (Layout::create_gold_note): Likewise.
10673         (Layout::create_build_id): Likewise.  Don't set
10674         after_input_sections on the section.
10675         (Layout::create_executable_stack_info): Remove target parameter.
10676         Change caller.
10677         * layout.h (class Layout): Declare create_notes.  Update
10678         declaration of create_executable_stack_info.
10679         * gold.cc (queue_middle_tasks): Call create_notes.
10680         * output.cc (Output_section::update_flags_for_input_section): Move
10681         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10682         invalid.
10683         * output.h (Output_data::mark_address_invalid): New function.
10684         (class Output_section): Only declare, not define,
10685         update_flags_for_input_section.  Remove set_flags.
10686
10687 2009-06-24  Ian Lance Taylor  <iant@google.com>
10688
10689         * script-sections.cc (Output_section_definition::
10690         set_section_addresses): Rename shadowing local load_address to
10691         laddr.
10692
10693 2009-06-24  Ian Lance Taylor  <iant@google.com>
10694
10695         PR 10244
10696         * reloc.cc (relocate_sections): Skip empty relocation sections.
10697
10698 2009-06-23  Ian Lance Taylor  <iant@google.com>
10699
10700         PR 10156
10701         * layout.cc (Layout::create_note): Use choose_output_section
10702         rather than make_output_section.
10703
10704 2009-06-23  Ian Lance Taylor  <iant@google.com>
10705
10706         PR 10237
10707         * options.cc (General_options::parse_V): Set printed_version_.
10708         (General_options::General_options): Initialize printed_version_.
10709         * options.h (class General_options): Add printed_version_ field.
10710         * gold.cc (queue_initial_tasks): If there are no input files,
10711         don't give a fatal error if we printed the version information.
10712         (queue_middle_tasks): If using -r with a shared object, give a
10713         fatal error rather than an ordinary error.
10714
10715 2009-06-23  Ian Lance Taylor  <iant@google.com>
10716
10717         PR 10219
10718         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10719         (Layout::make_output_section): Set have_stabstr_section_ if we see
10720         a .stab*str section.
10721         (Layout::finalize): Call link_stabs_sections.
10722         (Layout::link_stabs_sections): New file.
10723         * layout.h (class Layout): Add have_stabstr_section_ field.
10724         Declare link_stabs_sections.
10725
10726 2009-06-23  Doug Kwan  <dougkwan@google.com>
10727
10728         * Makefile.am (libgold_a_LIBADD): New.
10729         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10730         * Makefile.in: Regenerate.
10731         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10732         * configure: Regenerate.
10733         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10734         * fileread.cc: Include sys/state.h
10735         * gold.h: Declare memmem and strndup if found missing.
10736         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10737
10738 2009-06-23  Ian Lance Taylor  <iant@google.com>
10739
10740         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10741         * configure: Rebuild.
10742
10743 2009-06-23  Ian Lance Taylor  <iant@google.com>
10744
10745         PR 10147
10746         * object.cc (Object::section_contents): Don't try to get a view if
10747         the section has length zero.
10748         (Object::handle_gnu_warning_section): If the section is empty, use
10749         the name of the section as the warning.
10750
10751 2009-06-23  Ian Lance Taylor  <iant@google.com>
10752
10753         PR 10133
10754         * stringpool.h (class Stringpool_template): Add optimize_ field.
10755         (Stringpool_template::set_optimize): New function.
10756         * stringpool.cc (Stringpool_template::Stringpool_template):
10757         Initialize optimize_ field.
10758         (Stringpool_template::set_string_offsets): Test local optimize
10759         fild rather than parameter.
10760         * layout.cc (Layout::Layout): Call set_optimize on the section
10761         name stringpool.
10762
10763 2009-06-22  Ian Lance Taylor  <iant@google.com>
10764
10765         PR 10030
10766         * yyscript.y: Parse TARGET.
10767         * script.cc (script_set_target): New function.
10768         * script-c.h (script_set_target): Declare.
10769         * options.cc (General_options::string_to_object_format): Rename
10770         from string_to_object_format in anonymous namespace.  Change
10771         callers.
10772         * options.h (class General_options): Declare
10773         string_to_object_format.
10774
10775 2009-06-22  Ian Lance Taylor  <iant@google.com>
10776
10777         * script-sections.cc (Script_sections::create_segments): Don't put
10778         program headers in a PT_LOAD segment if -n or -N.
10779
10780 2009-06-22  Ian Lance Taylor  <iant@google.com>
10781
10782         PR 10141
10783         * options.h (class General_options): Add -z lazy and -z now.  Sort
10784         -z options into alphabetical order.
10785         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10786
10787 2009-06-21  Ian Lance Taylor  <iant@google.com>
10788
10789         * layout.cc (Layout::make_output_section): Call
10790         Target::new_output_section.
10791         (Layout::attach_allocated_section_to_segment): Put large section
10792         sections in a separate load segment with the large segment flag
10793         set.
10794         (Layout::segment_precedes): Sort large data segments after other
10795         load segments.
10796         (align_file_offset): New static function.
10797         (Layout::set_segment_offsets): Use align_file_offset.
10798         * output.h (class Output_section): Add is_small_section_ and
10799         is_large_section_ fields.
10800         (Output_section::is_small_section): New function.
10801         (Output_section::set_is_small_section):  New function.
10802         (Output_section::is_large_section): New function.
10803         (Output_section::set_is_large_section): New function.
10804         (Output_section::is_large_data_section): New function.
10805         (class Output_segment): Add is_large_data_segment_ field.
10806         (Output_segment::is_large_data_segment): New function.
10807         (Output_segment::set_is_large_data_segment): New function.
10808         * output.cc (Output_section::Output_section): Initialize new
10809         fields.
10810         (Output_segment::Output_segment): Likewise.
10811         (Output_segment::add_output_section): Add assertion that large
10812         data sections always go in large data segments.  Force small data
10813         sections to the end of the list of data sections.  Force small BSS
10814         sections to the start of the list of BSS sections.  For large BSS
10815         sections to the end of the list of BSS sections.
10816         * symtab.h (class Symbol): Declare is_common_shndx.
10817         (Symbol::is_defined): Check Symbol::is_common_shndx.
10818         (Symbol::is_common): Likewise.
10819         (class Symbol_table): Define enum Commons_section_type.  Update
10820         declarations.  Add small_commons_ and large_commons_ fields.
10821         * symtab.cc (Symbol::is_common_shndx): New function.
10822         (Symbol_table::Symbol_table): Initialize new fields.
10823         (Symbol_table::add_from_object): Put small and large common
10824         symbols in the right list.
10825         (Symbol_table::sized_finalized_symbol): Check
10826         Symbol::is_common_shndx.
10827         (Symbol_table::sized_write_globals): Likewise.
10828         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10829         common symbol lists.  Don't call do_allocate_commons_list if the
10830         list is empty.
10831         (Symbol_table::do_allocate_commons_list): Remove is_tls
10832         parameter.  Add comons_section_type parameter.  Change all
10833         callers.  Handle small and large common symbols.
10834         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10835         Symbol::is_common_shndx.
10836         * resolve.cc (symbol_to_bits): Likewise.
10837         * target.h (Target::small_common_shndx): New function.
10838         (Target::small_common_section_flags): New function.
10839         (Target::large_common_shndx): New function.
10840         (Target::large_common_section_flags): New function.
10841         (Target::new_output_section): New function.
10842         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10843         small_common_section_flags, and large_common_section_flags
10844         fields.
10845         (Target::do_new_output_section): New virtual function.
10846         * arm.cc (Target_arm::arm_info): Initialize new fields.
10847         * i386.cc (Target_i386::i386_info): Likewise.
10848         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10849         Likewise.
10850         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10851         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10852         (Target_x86_64::do_new_output_section): New function.
10853         * configure.ac: Define conditional MCMODEL_MEDIUM.
10854         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10855         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10856         (large_LDFLAGS): Define.
10857         * testsuite/large.c: New file.
10858         * testsuite/testfile.cc (Target_test::test_target_info):
10859         Initialize new fields.
10860         * configure, testsuite/Makefile.in: Rebuild.
10861
10862 2009-06-05  Doug Kwan  <dougkwan@google.com>
10863
10864         * Makefile.am (CCFILES): Add target.cc.
10865         * Makefile.in: Regenerate.
10866         * i386.cc (class Target_i386): Define new virtual method to
10867         override do_is_local_label_name in parent.
10868         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10869         local symbols if --discard-locals or -X is given.
10870         * options.h (class General_options): Declare new options
10871         '--discard-locals' and '-X' for discarding locals.
10872         * target.h (class Target): Define new methods is_local_label_name.
10873         Declare new virtual method do_is_local_label_name.
10874         * target.cc: New file.
10875         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10876         (check_SCRIPTS): Add discard_locals_test.sh.
10877         (check_DATA): Add discard_local_tests.syms.
10878         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10879         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10880         * testsuite/Makefile.in: Regenerate.
10881         * testsuite/discard_locals_test.c: New file.
10882         * testsuite/discard_locals_test.sh: Same.
10883
10884 2009-06-05  Doug Kwan  <dougkwan@google.com>
10885
10886         * object.cc (Sized_relobj::Sized_relobj): Initialize
10887         discarded_eh_frame_shndx_ to -1U.
10888         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10889         section.
10890         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10891         a discarded .eh_frame section.
10892         (Sized_relobj::do_finalize_local_symbols): Ditto.
10893         * object.h (class Sized_relobj): Declare new member
10894         discarded_eh_frame_shndx_.
10895         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10896         (local_labels_test.o, local_labels_test): New rules.
10897         * testsuite/Makefile.in: Regenerate.
10898
10899 2009-06-04  Doug Kwan  <dougkwan@google.com>
10900
10901         * layout.cc (Layout::section_name_mapping): Add mapping for
10902         special ARM sections.
10903
10904 2009-06-03  Doug Kwan  <dougkwan@google.com>
10905
10906         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10907         (utils::has_overflow): Same.
10908
10909 2009-06-03  Ian Lance Taylor  <iant@google.com>
10910
10911         * layout.cc (Layout::section_name_mapping): New array, replacing
10912         Layout::linkonce_mapping.
10913         (Layout::section_name_mapping_count): New variable, replacing
10914         Layout::linkonce_mapping_count.
10915         (Layout::linkonce_output_name): Remove.
10916         (Layout::output_section_name): Rewrite.
10917         * layout.h (class Layout): Rename Linkonce_mapping to
10918         Section_name_mapping, linkonce_mapping to section_name_mapping,
10919         linkonce_mapping_count to section_name_mapping_count.  Don't
10920         declare linkonce_output_name.
10921
10922 2009-06-03  Doug Kwan  <dougkwan@google.com>
10923
10924         * gold/arm.cc (namespace utils): New.
10925         (Target_arm::reloc_is_non_pic): Define new method.
10926         (class Arm_relocate_functions): New.
10927         (Target_arm::Relocate::relocate): Handle relocation types used by
10928         Android.
10929
10930 2009-06-03  Ian Lance Taylor  <iant@google.com>
10931
10932         * arm.cc (Target_arm::scan::global): Use || instead of |.
10933
10934 2009-06-02  Doug Kwan  <dougkwan@google.com>
10935
10936         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10937         issued_non_pic_error_.
10938         (class Target_arm::Scan): Declare new method check_non_pic.
10939         Define new method symbol_needs_plt_entry.
10940         Declare new data member issued_non_pic_error_.
10941         (class Target_arm::Relocate): Declare new method
10942         should_apply_static_reloc.
10943         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10944         (Target_arm::Scan::check_non_pic): Define new method.
10945         (Target_arm::Scan::local): Handle a small subset of reloc types used
10946         by Android.
10947         (Target_arm::Scan::local): Same.
10948         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10949
10950 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10951
10952         * incremental.cc (Incremental_inputs::report_command_line): Filter
10953         out --incremental-* options.
10954
10955 2009-05-29  Doug Kwan  <dougkwan@google.com>
10956
10957         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10958         template class.
10959         (class Target_arm): Update comment.
10960         (Target_arm::Target_arm): Initialize new data members GOT_,
10961         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10962         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10963         and Target_arm::rel_dyn_section.
10964         Declare new_enum Target_arm::Got_type.
10965         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10966         and DYNBSS_.
10967         Update commments for member do_dynsym_value.
10968         (Target_arm::got_size, Target_arm::plt_section,
10969         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10970         new methods inside class defintion.
10971         (Target_arm::got_section): Define new method.
10972         (Target_arm::rel_dyn_section): Same.
10973         (Output_data_plt_arm): New template class.
10974         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10975         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10976         (Output_data_plt_arm::add_entry): Same.
10977         (Output_data_plt_arm::first_plt_entry): Define new
10978         static data member for PLT instruction template.
10979         (Output_data_plt_arm::plt_entry): Same.
10980         (Output_data_plt_arm::do_write): Define new method.
10981         (Target_arm::make_plt_entry): Same.
10982         (Target_arm::do_finalize_sections): Same.
10983         (Target_arm::do_dynsym_value): Same.
10984
10985 2009-05-28  Doug Kwan  <dougkwan@google.com>
10986
10987         * Makefile.am (TARGETSOURCES): Add arm.cc.
10988         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10989         * Makefile.in: Regenerate.
10990         * arm.cc: New file.
10991         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10992
10993 2009-05-26  Doug Kwan  <dougkwan@google.com>
10994
10995         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10996         (General_options::check_excluded_libs): Strip off directories in
10997         archive name before matching like GNU ld does.
10998         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10999         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11000         (exclude_libs_test_LDFLAGS): Add linker option
11001         -Wl,--exclude-libs,libexclude_libs_test_3
11002         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11003         an explicit archive without using -l.
11004         (alt/libexclude_libs_test_3.a): New make rule.
11005         * testsuite/Makefile.in: Regenerate.
11006         * testsuite/exclude_libs_test.c : Declare lib3_default().
11007         (main): Call it.
11008         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11009         * exclude_libs_test_3.c: New file.
11010
11011 2009-05-26  Nick Clifton  <nickc@redhat.com>
11012
11013         * po/id.po: New Indonesian translation.
11014         * po/gold.pot: Updated template file.
11015
11016 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11017
11018         * testsuite/Makefile.am: Add -ffunction-sections to compile
11019         gc_comdat_test files.  Add -Wl,--gc-sections to build
11020         gc_comdat_test.
11021         * testsuite/Makefile.in: Regenerate.
11022         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11023
11024 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11025
11026         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11027         kept comdat section was garbage collected.
11028         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11029         * testsuite/Makefile.in: Regenerate.
11030         * testsuite/gc_comdat_test.sh: New file.
11031         * testsuite/gc_comdat_test_1.cc: New file.
11032         * testsuite/gc_comdat_test_2.cc: New file.
11033
11034 2009-05-19  Doug Kwan  <dougkwan@google.com>
11035
11036         * archive.cc (Archive::Archive): Move constructor from archive.h
11037         to here.  Initialize no_export_.
11038         (Archive::get_elf_object_for_member): Set no_export flag of object.
11039         * archive.h (Archive::Archive): Move constructor body to
11040         archive.cc.
11041         (Archive::no_export): New method.
11042         (Archive::no_export_): New field.
11043         * object.h (Object::Object): Initialize no_export_ to false.
11044         (Object::no_export, Object::set_no_export): New methods.
11045         (Object::no_export_): New field.
11046         * options.cc (General_options::parse_exclude_libs): New method.
11047         (General_options::check_excluded_libs) Same.
11048         * options.h (exclude_libs): New option.
11049         (General_options::check_excluded_libs): New method declaration.
11050         (General_options::excluded_libs_): New field.
11051         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11052         default or protected visibility if an object has no-export flag set.
11053         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11054         (check_SCRIPTS): Add exclude_libs_test.sh.
11055         (check_DATA): Add exclude_libs_test.syms.
11056         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11057         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11058         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11059         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11060         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11061         libexclude_libs_test_2.a): New rules.
11062         * testsuite/Makefile.in: Regenerate.
11063         * testsuite/exclude_libs_test.c: New file.
11064         * testsuite/exclude_libs_test.sh: Ditto.
11065         * testsuite/exclude_libs_test_1.c: Ditto.
11066         * testsuite/exclude_libs_test_2.c: Ditto.
11067
11068 2009-05-15  Ian Lance Taylor  <iant@google.com>
11069
11070         * configure.ac: Check for declarations for cases where libiberty.h
11071         checks HAVE_DECL_xxx.
11072         * configure, config.in: Rebuild.
11073
11074 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11075
11076         * gold.h (Incremental_argument_list): Remove (invalid) forward
11077         declaration.
11078         * incremental.cc (Incremental_inputs::report_achive): New method.
11079         (Incremental_inputs::report_object): New method.
11080         (Incremental_inputs::report_script): New method.
11081         (Incremental_inputs::finalize_inputs): New method.
11082         (Incremental_inputs::finalize): Call finalize_inputs().
11083         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11084         Create inputs entries.
11085         * incremental.h (Incremental_input_type): New enum.
11086         (Incremental_inputs::Incremental_input): Initialize new fields.
11087         (Incremental_inputs::report_inputs): New method.
11088         (Incremental_inputs::report_achive): New method.
11089         (Incremental_inputs::report_object): New method.
11090         (Incremental_inputs::report_script): New method.
11091         (Incremental_inputs::finalize_inputs): New method.
11092         (Incremental_inputs::Input_info): New struct.
11093         (Incremental_inputs::Input_info_map): New typedef.
11094         (Incremental_inputs::lock_): New field.
11095         (Incremental_inputs::Inputs_): New field.
11096         (Incremental_inputs::Inputs_map): New field.
11097         * main.cc (main): Call Incremental_input::report_inputs.
11098         * options.h (Input_argument_list): Typedef moved from
11099         Input_arguments.
11100         (Input_file_group::Files): Remove, use ::Input_argument_list.
11101         (Input_file_group::Input_argument_list): Remove, use
11102         ::Input_argument_list.
11103         * plugin.cc (Plugin_manager::add_input_file): Add error in
11104         incremental build.
11105         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11106         functions.
11107         * script.cc (read_input_script): Call
11108         Incremental_input::report_script.
11109         * script.h (Script_info): New class.
11110
11111 2009-04-27  Ian Lance Taylor  <iant@google.com>
11112
11113         * x86_64.cc (do_adjust_output_section): Set entsize to
11114         plt_entry_size.
11115
11116 2009-04-23  Elliott Hughes  <enh@google.com>
11117
11118         * output.cc (Output_file::close): After short writes, continue
11119         writing from the correct offset in the buffer being written.
11120
11121 2009-04-23  Chris Demetriou  <cgd@google.com>
11122
11123         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11124         * configure: Regenerate.
11125         * config.in: Regenerate.
11126         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11127         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11128
11129 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11130
11131         * incremental.cc (Incremental_inputs_header_data): Renamed from
11132         Incremental_input_header_data.
11133         (Incremental_inputs_header_data::data_size): New field.
11134         (Incremental_inputs_header_data::put_input_file_count): Renamed
11135         from input_file_count.
11136         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11137         from command_line_offset.
11138         (Incremental_inputs_header_data::put_reserved): Renamed from
11139         put_reserved.
11140         (Incremental_inputs_entry_data): Renamed from
11141         Incremental_input_entry_data.
11142         (Incremental_inputs_entry_data::data_size): New field.
11143         (Incremental_inputs::report_command_line): New method.
11144         (Incremental_inputs::finalize): New method.
11145         (Incremental_inputs::create_incremental_inputs_data): New method.
11146         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11147         * incremental.h: New file.
11148         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11149         (Layout::finalize): Create incremental inputs section in
11150         incremental builds.
11151         (Layout::create_incremental_info_sections): New method.
11152         * layout.h (Layout::incremental_inputs): New method.
11153         (Layout::create_incremental_info_sections): New method.
11154         (Layout::incremental_inputs_): New field.
11155         * main.cc (main): Notify Incremental_input of the command line.
11156
11157 2009-04-01  Ian Lance Taylor  <iant@google.com>
11158             Mikolaj Zalewski  <mikolajz@google.com>
11159
11160         * gold.h (reserve_unordered_map): Define, three versions, one for
11161         each version of Unordered_map.
11162         * layout.cc (Layout::Layout): Remove options parameter.  Add
11163         number_of_input_files parameter.  Don't initialize options_.
11164         Initialize number_of_input_files_ and resized_signatures_.  Move
11165         sections_are_attached_.
11166         (Layout::layout_group): Reserve space for group_signatures_.
11167         (Layout::find_or_add_kept_section): Change name parameter to be a
11168         reference.  Resize signatures_ map when it gets large enough.
11169         (Layout::layout_eh_frame): Use parameters->options() instead of
11170         this->options_.
11171         (Layout::make_output_section): Likewise.
11172         (Layout::attach_allocated_section_to_segment): Likewise.
11173         (Layout::finalize, Layout::create_executable_stack): Likewise.
11174         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11175         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11176         * layout.h (class Layout): Update declarations.  Remove options_
11177         field.  Add number_of_input_files_ and resized_signatures_
11178         fields.  Move sections_are_attached_ field.
11179         * main.cc (main): Pass number of input files to Layout
11180         constructor.  Don't pass options.
11181
11182 2009-03-30  Ian Lance Taylor  <iant@google.com>
11183
11184         * ffsll.c (ffsll): Correct implementation.
11185
11186 2009-03-27  Ian Lance Taylor  <iant@google.com>
11187
11188         * ffsll.c: New file.
11189         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11190         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11191         * ftruncate.c (ftruncate): Declare before definition.
11192         * mremap.c (mremap): Likewise.
11193         * pread.c (pread): Likewise.
11194         * configure, Makefile.in, config.in: Rebuild.
11195
11196         * mremap.c: New file.
11197         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11198         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11199         (mremap): Declare if HAVE_MREMAP is not defined.
11200         * configure, Makefile.in, config.in: Rebuild.
11201
11202 2009-03-27  Cary Coutant  <ccoutant@google.com>
11203
11204         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11205         position independent.
11206         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11207         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11208
11209 2009-03-24  Cary Coutant  <ccoutant@google.com>
11210
11211         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11212         an executable.
11213         (needs_dynamic_reloc): Likewise.
11214
11215 2009-03-24  Ian Lance Taylor  <iant@google.com>
11216
11217         * yyscript.y (file_cmd): Recognize EXTERN.
11218         (extern_name_list, extern_name_list_body): New nonterminals.
11219         * script.cc (script_add_extern): Define.
11220         * script-c.h (script_add_extern): Declare.
11221
11222 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11223
11224         * object.cc (is_elf_object): Define.
11225         * object.h (is_elf_object): Declare.
11226         * archive.cc (Archive::get_elf_object_for_member): Call
11227         is_elf_object.
11228         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11229
11230 2009-03-24  Elliott Hughes  <enh@google.com>
11231
11232         * output.cc (Output_file::map_anonymous): Define.
11233         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11234         try an anonymous one.  Report the size if the mmap fails.
11235         * output.h (class Output_file): Declare map_anonymous.
11236
11237 2009-03-24  Ian Lance Taylor  <iant@google.com>
11238
11239         * target-select.cc (instantiate_target): Don't acquire the lock if
11240         the instantiated_target_ field has already been set.
11241
11242 2009-03-23  Ian Lance Taylor  <iant@google.com>
11243
11244         * gold-threads.h (class Initialize_lock): Define.
11245         * gold-threads.cc (class Initialize_lock_once): Define.
11246         (initialize_lock_control): New static variable.
11247         (initialize_lock_pointer): New static variable.
11248         (initialize_lock_once): New static function.
11249         (Initialize_lock::Initialize_lock): Define.
11250         (Initialize_lock::initialize): Define.
11251         * target-select.h: Include "gold-threads.h".
11252         (class Target_selector): Add lock_ and initialize_lock_ fields.
11253         Don't define instantiate_target, just declare it.
11254         * target-select.cc (Target_selector::Target_selector): Initialize
11255         new fields.
11256         (Target_selector::instantiate_target): Define.
11257         * descriptors.h: Include "gold-threads.h".
11258         (class Descriptors): Add initialize_lock_ field.
11259         * descriptors.cc (Descriptors::Descriptors): Initialize new
11260         field.
11261         (Descriptors::open): Use initialize_lock_ field
11262         * errors.h (class Errors): Add initialize_lock_ field.
11263         * errors.cc (Errors::Errors): Initialize new field.
11264         (Errors::initialize_lock): Use initialize_lock_ field.
11265         * powerpc.cc (class Target_selector_powerpc): Remove
11266         instantiated_target_ field.  In do_recognize call
11267         instantiate_target rather than do_instantiate_target.  In
11268         do_instantiate_target just allocate a new target.
11269         * sparc.cc (class Target_selector_sparc): Likewise.
11270
11271         * freebsd.h: New file.
11272         * i386.cc: Include "freebsd.h".
11273         (Target_i386): Derive from Target_freebsd rather than
11274         Sized_target.
11275         (Target_selector_i386): Derive from Target_selector_freebsd rather
11276         than Target_selector.
11277         * x86_64.cc: Include "freebsd.h".
11278         (Target_x86_64): Derive from Target_freebsd rather than
11279         Sized_target.
11280         (Target_selector_x86_64): Derive from Target_selector_freebsd
11281         rather than Target_selector.
11282         * target.h (class Target): Add adjust_elf_header and
11283         do_adjust_elf_header.
11284         * output.cc (Output_file_header:: do_sized_write): Call target
11285         adjust_elf_header routine.
11286         * configure.tgt: Set targ_osabi.
11287         * configure.ac: Define GOLD_DEFAULT_OSABI.
11288         * parameters.cc (Parameters::default_target): Pass
11289         GOLD_DEFAULT_OSABI to select_target.
11290         * target-select.h (class Target_selector): Make instantiate_target
11291         protected rather than private.
11292         * Makefile.am (HFILES): Add freebsd.h.
11293         * configure, Makefile.in, config.in: Rebuild.
11294
11295         * merge.cc (do_add_input_section): Correct pend value.  Change
11296         message about last entry not being null terminated from error to
11297         warning.
11298
11299 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11300
11301         * incremental.cc: New file.
11302         * Makefile.am (CCFILES): Add incremental.cc.
11303         * Makefile.in: Rebuild.
11304
11305 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11306
11307         * layout.cc (Layout::output_section_name): Preserve names
11308         of '.note.' sections.
11309
11310 2009-03-19  Ian Lance Taylor  <iant@google.com>
11311
11312         * descriptors.cc (Descriptors::open): Check that the options are
11313         valid before using them.
11314
11315 2009-03-18  Ian Lance Taylor  <iant@google.com>
11316
11317         * script-sections.h: Include <list>.
11318         (class Script_sections): Change Sections_elements from std::vector
11319         to std::list.  Typedef public Elements_iterator.  Add
11320         orphan_section_placement_, data_segment_align_start_, and
11321         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11322         field.
11323         * script-sections.cc (class Orphan_section_placement): New class.
11324         (class Sections_element): Add virtual functions is_relro and
11325         orphan_section_init.  Remove virtual function place_orphan_here.
11326         (class Output_section_definition): Add is_relro and
11327         orphan_section_init.  Remove place_orphan_here.
11328         (class Orphan_output_section): Likewise.
11329         (Script_sections::Script_sections): Update for field changes.
11330         (Script_sections::data_segment_align): Set saw_data_segment_align_
11331         and data_segment_align_start_, not data_segment_align_index.
11332         (Script_sections::data_segment_relro_end): Check
11333         saw_data_segment_align_.  Use data_segment_align_start_ rather
11334         than data_segment_align_index_.
11335         (Script_sections::place_orphan): Rewrite to use
11336         Orphan_section_placement.
11337
11338 2009-03-17  Ian Lance Taylor  <iant@google.com>
11339
11340         * archive.cc (Archive::add_symbols): Check for a version attached
11341         to the symbol name in the archive map.
11342         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11343         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11344         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11345         (ver_test_11.a): New target.
11346         * testsuite/Makefile.in: Rebuild.
11347
11348         * configure.ac: Check for chsize and posix_fallocate.  Replace
11349         ftruncate.
11350         * ftruncate.c: New file, from gnulib.
11351         * output.cc (posix_fallocate): Define dummy version if not
11352         HAVE_POSIX_FALLOCATE.
11353         (Output_file::map): Call posix_fallocate rather than lseek and
11354         write.
11355         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11356         * configure, Makefile.in, config.in: Rebuild.
11357
11358 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11359
11360         * layout.h (Layout::create_note): Add section_name parameter.
11361         * layout.cc (Layout::create_note): Likewise.
11362         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11363
11364 2009-03-17  Ian Lance Taylor  <iant@google.com>
11365
11366         * descriptors.cc: Include "options.h".
11367         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11368         (Descriptors::open): Always use O_CLOEXEC when opening a new
11369         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11370         then set FD_CLOEXEC.
11371
11372         * sparc.cc (class Target_sparc): Add has_got_section.
11373         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11374         make sure we have a GOT section.
11375
11376         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11377         (Target_sparc::Scan::local): Likewise.
11378         (Target_sparc::Scan::global): Likewise.
11379         (Target_sparc::Relocate::relocate): Likewise.
11380         (Target_sparc::Relocate::relocate_tls): Likewise.
11381
11382         * symtab.cc (Symbol_table::define_default_version): New function,
11383         broken out of add_from_object.
11384         (Symbol_table::add_from_object): Call define_default_version.
11385         (Symbol_table::define_special_symbol): Add resolve_oldsym
11386         parameter.  Change all callers.  If the version for a symbol comes
11387         from a version script, resolve it with the symbol with the same
11388         name with no version.  Also add the symbol without a version if
11389         appropriate.
11390         (do_define_in_output_data): If resolving with oldsym, don't delete
11391         sym.
11392         (do_define_in_output_segment): Likewise.
11393         (do_define_as_constant): Likewise.
11394         * symtab.h (class Symbol_table): Update declarations.
11395
11396 2009-03-13  Ian Lance Taylor  <iant@google.com>
11397
11398         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11399         (Read_symbols::requeue): New function.
11400         (Read_symbols::do_read_symbols): If make_elf_object fails because
11401         the target type is not configured, and the file was searched for,
11402         issue a warning and retry with the next directory.
11403         (Add_symbols::run): If the file has an incompatible format, and
11404         it was searched for, requeue the Read_symbols task.  On error,
11405         release the object.
11406         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11407         dirindex parameter to constructor.  Change all callers.  Declare
11408         incompatible_warning and requeue.
11409         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11410         input_argument_ and input_group_ fields.  Add them to
11411         constructor.  Change all callers.
11412         (class Read_script): Add dirindex_ field.  Add it to constructor.
11413         Change all callers.
11414         * archive.cc (Archive::setup): Remove input_objects parameter.
11415         Change all callers.
11416         (Archive::get_file_and_offset): Likewise.
11417         (Archive::read_all_symbols): Likewise.
11418         (Archive::read_symbols): Likewise.
11419         (Archive::get_elf_object_for_member): Remove input_objects
11420         parameter.  Add punconfigured parameter.  Change all callers.
11421         (Archive::add_symbols): Change return type to bool.  Check return
11422         value of include_member.
11423         (Archive::include_all_members): Likewise.
11424         (Archive::include_member): Change return type to bool.  Return
11425         false if first included object has incompatible target.  Set
11426         included_member_ field.
11427         (Add_archive_symbols::run): If add_symbols returns false, requeue
11428         Read_symbols task.
11429         * archive.h (class Archive): Add included_member_ field.
11430         Initialize it in constructor.  Add input_file and searched_for
11431         methods.  Update declarations.
11432         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11433         input_argument_ fields.  Add them to constructor.  Change all
11434         callers.
11435         * script.cc: Include "target-select.h".
11436         (class Parser_closure): Add skip_on_incompatible_target_ and
11437         found_incompatible_target_ fields.  Add
11438         skip_on_incompatible_target parameter to constructor.  Change all
11439         callers.  Add methods skip_on_incompatible_target,
11440         clear_skip_on_incompatible_target, found_incompatible_target, and
11441         set_found_incompatible_target.
11442         (read_input_script): Add dirindex parameter.  Change all callers.
11443         If parser finds an incompatible target, requeue Read_symbols
11444         task.
11445         (script_set_symbol): Clear skip_on_incompatible_target in
11446         closure.
11447         (script_add_assertion, script_parse_option): Likewise.
11448         (script_start_sections, script_add_phdr): Likewise.
11449         (script_check_output_format): New function.
11450         * script.h (read_input_script): Update declaration.
11451         * script-c.h (script_check_output_format): Declare.
11452         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11453         (ignore_cmd): Remove OUTPUT_FORMAT.
11454         * fileread.cc (Input_file::Input_file): Add explicit this.
11455         (Input_file::will_search_for): New function.
11456         (Input_file::open): Add pindex parameter.  Change all callers.
11457         * fileread.h (class Input_file): Add input_file_argument method.
11458         Declare will_search_for.  Update declarations.
11459         * object.cc (make_elf_object): Add punconfigured parameter.
11460         Change all callers.
11461         * object.h (class Object): Make input_file public.  Add
11462         searched_for method.
11463         (make_elf_object): Update declaration.
11464         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11465         restart search.
11466         * dirsearch.h (class Dirsearch): Update declaration.
11467         * options.h (class General_options): Add --warn-search-mismatch.
11468         * parameters.cc (Parameters::is_compatible_target): New function.
11469         * parameters.h (class Parameters): Declare is_compatible_target.
11470         * workqueue.cc (Workqueue::add_blocker): New function.
11471         * workqueue.h (class Workqueue): Declare add_blocker.
11472
11473         * fileread.cc (Input_file::open): Remove options parameter.
11474         Change all callers.
11475         (Input_file::open_binary): Likewise.
11476         * script.cc (read_input_script): Likewise.
11477         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11478         options parameter from constructor.  Change all callers.
11479         (class Read_script): Likewise.
11480         * fileread.h (class Input_file): Update declarations.
11481         * script.h (read_input_script): Update declaration.
11482
11483 2009-03-10  Nick Clifton  <nickc@redhat.com>
11484
11485         * po/es.po: New Spanish translation.
11486
11487 2009-03-06  Cary Coutant  <ccoutant@google.com>
11488
11489         * options.cc (parse_short_option): Keep dash_z from registering itself.
11490
11491 2009-03-03  Ian Lance Taylor  <iant@google.com>
11492
11493         PR 9918
11494         * target-reloc.h (relocate_section): Pass output_section to
11495         relocate.
11496         * i386.cc (Target_i386::should_apply_static_reloc): Add
11497         output_section parameter.  Change all callers.
11498         (Target_i386::Relocate::relocate): Add output_section parameter.
11499         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11500         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11501         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11502         * testsuite/two_file_shared.sh: New script.
11503         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11504         (check_DATA): Add two_file_shared.dbg.
11505         (two_file_shared.dbg): New target.
11506         * testsuite/Makefile.in: Rebuild.
11507
11508 2009-03-01  Ian Lance Taylor  <iant@google.com>
11509
11510         * configure.ac: Check for byteswap.h.
11511         * configure: Rebuild.
11512         * config.in: Rebuild.
11513
11514 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11515
11516         * layout.cc (Layout::find_or_add_kept_section): New function.
11517         (Layout::add_comdat): Removed.
11518         * layout.h (struct Kept_section): Move out of class Layout.
11519         Remove trailing underscores from field names.  Add group_sections
11520         field.  Rename group_ field to is_group.  Change all uses.
11521         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11522         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11523         comdat_groups_ field.
11524         (Sized_relobj::include_section_group): Use
11525         find_or_add_kept_section and Kept_section::group_sections.
11526         (Sized_relobj::include_linkonce_section): Likewise.
11527         * object.cc (class Sized_relobj): Don't define Comdat_group or
11528         Comdat_group_table.  Remove find_comdat_group and
11529         add_comdat_group.  Remove comdat_groups_ field.
11530         * plugin.cc (include_comdat_group): Use
11531         Layout::find_or_add_kept_section.
11532
11533 2009-02-28  Ian Lance Taylor  <iant@google.com>
11534
11535         * README: --gc-sections and map files are now supported.  Document
11536         some build requirements.
11537
11538         PR 6992
11539         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11540         relocatable link set the value of the section symbol to zero.
11541         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11542         relocatable link don't include the section address in the local
11543         symbol value.
11544
11545 2009-02-27  Ian Lance Taylor  <iant@google.com>
11546
11547         PR 6811
11548         * options.h (class Search_directory): Add is_system_directory.
11549         (class General_options): Declare is_in_system_directory.
11550         * options.cc (get_relative_sysroot): Make static.
11551         (get_default_sysroot): Make static.
11552         (General_optoins::is_in_system_directory): New function.
11553         * fileread.cc (Input_file::is_in_system_directory): New function.
11554         * fileread.h (class Input_file): Declare is_in_system_directory.
11555         * object.h (class Object): Add is_in_system_directory.
11556         (class Input_objects): Remove system_library_directory_ field.
11557         * object.cc (Input_objects::add_object): Don't set
11558         system_library_directory_.
11559         (input_objects::found_in_system_library_directory): Remove.
11560         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11561         parameter.  Change all callers.
11562         (Symbol_table::sized_write_globals): Likewise.
11563         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11564         Call Object::is_in_system_directory.
11565         * symtab.h (class Symbol_table): Update declarations.
11566
11567         PR 5990
11568         * descriptors.h (Open_descriptor): Add is_on_stack field.
11569         * descriptors.cc (Descriptors::open): If the descriptor is on the
11570         top of the stack, remove it.  Initialize is_on_stack field.
11571         (Descriptors::release): Only add pod to stack if it is not on the
11572         stack already.
11573         (Descriptors::close_some_descriptor): Clear stack_next and
11574         is_on_stack fields.
11575
11576         PR 7091
11577         * output.cc (Output_section::find_starting_output_address): Rename
11578         from starting_output_address; add PADDR parameter; change return
11579         type.
11580         * output.h (class Output_section): Declare
11581         find_starting_output_address instead of starting_output_address.
11582         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11583         section symbol for which we can't find a merge section.
11584
11585         PR 9836
11586         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11587         hidden or internal, force the symbol to be local.
11588         * resolve.cc (Symbol::override_visibility): Define.
11589         (Symbol::override_base): Use override_visibility.
11590         (Symbol_table::resolve): Likewise.
11591         (Symbol::override_base_with_special): Likewise.
11592         (Symbol_table::override_with_special): If the visibility is hidden
11593         or internal, force the symbol to be local.
11594         * symtab.h (class Symbol): Add set_visibility and
11595         override_visibility.
11596         * testsuite/ver_test_1.sh: New file.
11597         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11598         (check_DATA): Add ver_test_1.syms.
11599         (ver_test_1.syms): New target.
11600         * testsuite/Makefile.in: Rebuild.
11601
11602 2009-02-25  Cary Coutant  <ccoutant@google.com>
11603
11604         * layout.cc (Layout::choose_output_section): Don't rename sections
11605         when using a linker script that has a SECTIONS clause.
11606         * Makefile.in: Regenerate.
11607
11608         * testsuite/Makefile.am (script_test_5.sh): New test case.
11609         * testsuite/Makefile.in: Regenerate.
11610         * testsuite/script_test_5.cc: New file.
11611         * testsuite/script_test_5.sh: New file.
11612         * testsuite/script_test_5.t: New file.
11613
11614 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11615
11616         * archive.cc (Archive::include_member): Update calls to add_symbols.
11617         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11618         the Layout argument.
11619         * dynobj.h (do_add_symbols): Add the Layout argument.
11620         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11621         Layout argument.
11622         * object.h (Object::add_symbols): Add the Layout argument.
11623         (Object::do_add_symbols): Add the Layout argument.
11624         (Sized_relobj::do_add_symbols): Add the Layout argument.
11625         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11626         Unify the two versions.
11627         (Add_plugin_symbols): Remove.
11628         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11629         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11630         (Add_plugin_symbols): Remove.
11631         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11632         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11633         (Add_symbols::run): Make it work with Pulginobj.
11634
11635 2009-02-06  Ian Lance Taylor  <iant@google.com>
11636
11637         * object.cc (Sized_relobj::do_layout): Make info message start
11638         with lower case letter.
11639
11640 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11641
11642         * binary.cc: Fix file comment.
11643
11644         * options.h (enum Incremental_disposition): Define.
11645         (class General_options): Add new options: --incremental,
11646         --incremental_changed, --incremental_unchanged,
11647         --incremental_unknown.  Add incremental_disposition_ and
11648         implicit_incremental_ fields.
11649         (General_options::incremental_disposition): New function.
11650         (class Position_dependent_options): Add incremental_disposition
11651         option.
11652         (Position_dependent_options::copy_from_options): Set incremental
11653         dispositions.
11654         * options.cc (General_options::parse_incremental_changed): New
11655         function.
11656         (General_options::parse_incremental_unchanged): New function.
11657         (General_options::parse_incremental_unknown): New function.
11658         (General_options::General_options): Initialize new fields
11659         incremental_disposition_ and implicit_incremental_.
11660         (General_options::finalize): Check for uasge of --incremental-*
11661         without --incremental.
11662
11663 2009-02-06  Chris Demetriou  <cgd@google.com>
11664
11665         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11666         pointer and to report location as the file name associated with
11667         the symbol.
11668         (gold_undefined_symbol_at_location): New function to replace the
11669         old gold_undefined_symbol functionality.
11670         * target-reloc.h (relocate_section): Update to use
11671         gold_undefined_symbol_at_location.
11672         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11673         Call gold_undefined_symbol function rather than gold_error.
11674         * errors.h (Errors::undefined_symbol): Take location as a
11675         string, rather than calculating it from a relocation.
11676         * errors.cc (Errors::fatal): Print "fatal error:" before the
11677         formatted message.
11678         (Errors::error, Errors::error_at_location): Print "error: "
11679         before the formatted message.
11680         (Errors::undefined_symbol): Take location as a string, rather
11681         than calculating it from a relocation.
11682         (gold_undefined_symbol_at_location): New function akin to
11683         old gold_undefined_symbol, calculates location from relocation.
11684         (gold_undefined_symbol): Change to take only a Symbol pointer
11685         and to report location as the file name associated with the symbol.
11686         * testsuite/debug_msg.sh: Update for changed error messages.
11687         * testsuite/undef_symbol.sh: Likewise.
11688
11689 2009-02-04  Duncan Sands  <baldrick@free.fr>
11690
11691         PR 9812
11692         * reduced_debug_output.h
11693         (Output_reduced_debug_abbrev_section::failed): Use format for
11694         gold_warning.
11695         (Output_reduced_debug_info_section::faild): Likewise.
11696
11697 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11698
11699         * script.cc (Lazy_demangler): New class.
11700         (Version_script_info::get_symbol_version_helper): Demangle a
11701         symbol only once.
11702
11703 2009-01-29  Cary Coutant  <ccoutant@google.com>
11704
11705         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11706         to __tls_get_addr.
11707         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11708
11709 2009-01-28  Ian Lance Taylor  <iant@google.com>
11710
11711         * version.cc (version_string): Bump to 1.9.
11712
11713         * gold.h: Include <cstring> and <stdint.h>.
11714         * version.cc: Include <cstdio>.
11715         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11716         warning.
11717         * reduced_debug_output.cc (insert_into_vector): Rename from
11718         Insert_into_vector; change all callers.  Use Swap_unaligned to
11719         avoid aliasing issue; remove union since it is unnecessary.
11720
11721 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11722
11723         * Makefile.am (CCFILES): Add gc.cc.
11724         (HFILES): Add gc.h.
11725         * Makefile.in: Regenerate.
11726         * gold.cc (Gc_runner): New class.
11727         (queue_initial_tasks): Call garbage collection related tasks
11728         when corresponding options are invoked.
11729         (queue_middle_gc_tasks): New function.
11730         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11731         processed early before laying out sections during garbage collection.
11732         * gold.h (queue_middle_gc_tasks): New function.
11733         (is_prefix_of): Move from "layout.cc".
11734         * i386.cc (Target_i386::gc_process_relocs): New function.
11735         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11736         * main.cc (main): Create object of class "Garbage_collection".
11737         * object.cc (Relobj::copy_symbols_data): New function.
11738         (Relobj::is_section_name_included): New function.
11739         (Sized_relobj::do_layout): Allow this function to be called twice
11740         during garbage collection and defer layout of section during the
11741         first call.
11742         * object.h (Relobj::get_symbols_data): New function.
11743         (Relobj::is_section_name_included): New function.
11744         (Relobj::copy_symbols_data): New function.
11745         (Relobj::set_symbols_data): New function.
11746         (Relobj::get_relocs_data): New function.
11747         (Relobj::set_relocs_data): New function.
11748         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11749         (Relobj::gc_process_relocs): New function.
11750         (Relobj::do_gc_process_relocs): New pure virtual function.
11751         (Relobj::sd_): New data member.
11752         (Sized_relobj::is_output_section_offset_invalid): New function.
11753         (Sized_relobj::do_gc_process_relocs): New function.
11754         * options.h (General_options::gc_sections): Modify to not be a no-op.
11755         (General_options::print_gc_sections): New option.
11756         * plugin.cc (Plugin_finish::run): Remove function call to
11757         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11758         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11759         * reloc.cc (Read_relocs::run): Add task to process relocs and
11760         determine unreferenced sections when doing garbage collection.
11761         (Gc_process_relocs): New class.
11762         (Sized_relobj::do_gc_process_relocs): New function.
11763         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11764         sections that are garbage collected.
11765         * reloc.h (Gc_process_relocs): New class.
11766         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11767         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11768         symbols whose corresponding sections are garbage collected.
11769         (Symbol_table::Symbol_table): Add new parameter for the garbage
11770         collection object.
11771         (Symbol_table::gc_mark_undef_symbols): New function.
11772         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11773         (Symbol_table::gc_mark_dyn_syms): New function.
11774         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11775         as garbage.
11776         (Symbol_table::add_from_object): Likewise.
11777         (Symbol_table::add_from_relobj): When building shared objects, do not
11778         treat externally visible symbols as garbage.
11779         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11780         table information for static and relocatable links.
11781         * symtab.h (Symbol_table::set_gc): New function.
11782         (Symbol_table::gc): New function.
11783         (Symbol_table::gc_mark_undef_symbols): New function.
11784         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11785         (Symbol_table::gc_mark_dyn_syms): New function.
11786         (Symbol_table::gc_): New data member.
11787         * target.h (Sized_target::gc_process_relocs): New pure virtual
11788         function.
11789         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11790         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11791
11792 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11793
11794         * options.h (General_options::gc_sections): Define as a no-op for now.
11795         (General_options::no_keep_memory): Ditto.
11796         (General_options::Bshareable): Define.
11797         * options.cc (General_options::finalize): Honor -Bshareable.
11798
11799 2009-01-20  Andreas Schwab  <schwab@suse.de>
11800
11801         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11802         read the value in the contents, since we don't use it.  Use the
11803         template endianness when writing.
11804         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11805
11806 2009-01-19  Andreas Schwab  <schwab@suse.de>
11807
11808         * configure.tgt (powerpc64-*): Fix targ_obj.
11809
11810 2009-01-15  Ian Lance Taylor  <iant@google.com>
11811
11812         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11813         local symbols when stripping all symbols.
11814
11815 2009-01-14  Cary Coutant  <ccoutant@google.com>
11816
11817         * output.cc (Output_reloc): Add explicit instantiations.
11818
11819 2009-01-14  Cary Coutant  <ccoutant@google.com>
11820
11821         * archive.cc (Archive::get_elf_object_for_member): Remove call
11822         to File_read::claim_for_plugin.
11823         * descriptors.cc (Descriptors::open): Remove reference to
11824         is_claimed.
11825         (Descriptors::claim_for_plugin): Remove.
11826         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11827         (Descriptors::is_claimed): Remove.
11828         (claim_descriptor_for_plugin): Remove.
11829         * fileread.cc (File_read::claim_for_plugin): Remove.
11830         * fileread.h (File_read::claim_for_plugin): Remove.
11831         (File_read::descriptor): Reopen descriptor if necessary.
11832         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11833         (Plugin_manager::all_symbols_read): Add task parameter. Change
11834         all callers.
11835         (Plugin_manager::get_input_file): New function.
11836         (Plugin_manager::release_input_file): New function.
11837         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11838         corresponding data member.
11839         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11840         and pass to base constructor. Change all callers.
11841         (get_input_file, release_input_file): New functions.
11842         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11843         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11844         (Plugin_manager::all_symbols_read): Add task parameter.
11845         (Plugin_manager::get_input_file): New function.
11846         (Plugin_manager::release_input_file): New function.
11847         (Plugin_manager::task_): New data member.
11848         (Pluginobj::Pluginobj): Add filesize parameter.
11849         (Pluginobj::filename): New function.
11850         (Pluginobj::descriptor): New function.
11851         (Pluginobj::filesize): New function.
11852         (Pluginobj::filesize_): New data member.
11853         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11854         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11855         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11856
11857         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11858         with archive libraries.
11859         * testsuite/Makefile.in: Regenerate.
11860         * testsuite/plugin_test.c (struct sym_info): New type.
11861         (get_input_file, release_input_file): New static variables.
11862         (onload): Capture new transfer vector entries.
11863         (claim_file_hook): Stop reading at end of file according to filesize.
11864         Factor out parsing of readelf output into separate function.
11865         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11866         APIs and get the source file name from the symbol table.  Convert
11867         source file name to corresponding object file name.  Print info
11868         message when adding new input files.
11869         (parse_readelf_line): New function.
11870         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11871         * testsuite/plugin_test_2.sh: Likewise.
11872         * testsuite/plugin_test_3.sh: Likewise.
11873         * testsuite/plugin_test_4.sh: New test case.
11874
11875 2009-01-07  Ian Lance Taylor  <iant@google.com>
11876
11877         * version.cc (version_string): Bump to 1.8.
11878
11879 2008-12-23  Cary Coutant  <ccoutant@google.com>
11880
11881         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11882         * plugin.cc (Plugin_manager::finish): Rename as
11883         layout_deferred_objects.  Move cleanup to separate function.
11884         (Plugin_manager::cleanup): New function.
11885         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11886         separately.
11887         * plugin.h (Plugin_manager::finish): Rename as
11888         layout_deferred_objects.
11889         (Plugin_manager::cleanup): New function.
11890         (Plugin_manager::cleanup_done): New field.
11891
11892 2008-12-23  Cary Coutant  <ccoutant@google.com>
11893
11894         * plugin.cc (is_visible_from_outside): New function.
11895         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11896         so we don't return "IR only" status for exported symbols or -r links.
11897
11898         * testsuite/Makefile.am (plugin_test_3): New test case.
11899         * testsuite/Makefile.in: Regenerate.
11900         * testsuite/plugin_test_3.sh: New file.
11901
11902 2008-12-22  Cary Coutant  <ccoutant@google.com>
11903
11904         * object.cc (Sized_relobj::layout_section): New function.
11905         (Sized_relobj::do_layout): Defer layout of input sections until after
11906         plugin has provided replacement files.
11907         (Sized_relobj::do_layout_deferred_sections): New function.
11908         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11909         (Relobj::layout_deferred_sections): New function.
11910         (Relobj::do_layout_deferred_sections): New function.
11911         (Sized_relobj::do_layout_deferred_sections): New function.
11912         (Sized_relobj::layout_section): New function.
11913         (Sized_relobj::Deferred_layout): New structure.
11914         (Sized_relobj::deferred_layout_): New field.
11915         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11916         Change all callers.  Layout deferred sections.
11917         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11918         references.
11919         (Plugin_hook::run): Move code from do_plugin_hook inline.
11920         (Plugin_hook::do_plugin_hook): Remove.
11921         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11922         (Plugin_manager::finish): Renamed, was cleanup.
11923         (Plugin_manager::should_defer_layout): New function.
11924         (Plugin_manager::add_deferred_layout_object): New function.
11925         (Plugin_manager::Deferred_layout_list): New type.
11926         (Plugin_manager::deferred_layout_objects_): New field.
11927         (Plugin_hook::do_plugin_hook): Remove.
11928
11929 2008-12-17  Ian Lance Taylor  <iant@google.com>
11930
11931         * options.h (class General_options): Add --no case for
11932         --export-dynamic.
11933
11934 2008-12-16  Cary Coutant  <ccoutant@google.com>
11935
11936         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11937         vector.
11938         (Plugin_manager::claim_file): Create plugin object even if
11939         plugin did not call the add_symbols callback.
11940         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11941         asking for more symbols than were added.
11942         * testsuite/Makefile.am (plugin_test_1): Add test case with
11943         no global symbols.
11944         (empty.syms): New target.
11945         * testsuite/Makefile.in: Regenerate.
11946         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11947         message. Don't call add_symbols if no globals.
11948         (all_symbols_read_hook): Don't provide replacement for empty
11949         claimed file.
11950
11951 2008-12-12  Ian Lance Taylor  <iant@google.com>
11952
11953         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11954         r_type == 0 for a local symbol with r_sym == 0.
11955         (scan_relocatable_relocs): Pass r_sym to
11956         local_non_section_strategy.
11957         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11958         r_sym parameter.
11959
11960         * configure.ac: Update test for TLS descriptors: they are
11961         supported as of glibc 2.9.
11962         * configure: Rebuild.
11963
11964 2008-12-11  Ian Lance Taylor  <iant@google.com>
11965
11966         PR 7091
11967         * target-reloc.h (Default_scan_relocatable_relocs): For each
11968         function, map r_type == 0 to RELOC_DISCARD.
11969
11970 2008-12-10  Cary Coutant  <ccoutant@google.com>
11971
11972         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11973         object to override a kept COMDAT group from a plugin object.
11974
11975 2008-12-09  Ian Lance Taylor  <iant@google.com>
11976
11977         PR 7088
11978         * yyscript.y (file_cmd): Handle INPUT.
11979
11980         * testsuite/initpri1.c: Change all declarations to be full
11981         prototypes by adding void, to avoid compiler warnings.
11982
11983 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11984
11985         * options.cc (General_options::parse_plugin_opt): New.
11986         (General_options::add_plugin): The argument now is just the filename.
11987         (General_options::add_plugin_option): New.
11988         * options.h (plugin_opt): New.
11989         (add_plugin): Change argument name.
11990         (add_plugin_option): New.
11991         * plugin.cc (Plugin::load): Don't parse the plugin option.
11992         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11993         (Plugin::add_option): New.
11994         (Plugin::args_): Change type.
11995         (Plugin::filename_): New.
11996         (Plugin_manager::add_plugin_option): New.
11997         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11998         * testsuite/Makefile.in: Regenerate.
11999
12000 2008-12-05  Cary Coutant  <ccoutant@google.com>
12001
12002         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12003         Handle --strip-lto-sections option.
12004         * options.h (strip_lto_sections): New option.
12005
12006 2008-12-01  Cary Coutant  <ccoutant@google.com>
12007
12008         * plugin.cc (ld_plugin_message): Change format parameter to const.
12009         Fix mismatch between new[] and delete.
12010
12011 2008-11-14  Cary Coutant  <ccoutant@google.com>
12012
12013         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12014         instead of -1U.
12015
12016 2008-11-05  Craig Silverstein  <csilvers@google.com>
12017
12018         * options.cc (General_options::parse_dynamic_list): New function.
12019         * options.h (General_options): New flags dynamic_list,
12020         dynamic_list_data, dynamic_list_cpp_new, and
12021         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12022         (General_options::in_dynamic_list): New function.
12023         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12024         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12025         (Lex::can_continue_name): Likewise.
12026         (yylex): Likewise.
12027         (read_script_file): New parameter script_options.
12028         (read_dynamic_list): New function.
12029         (Script_options::define_dynamic_list): New function.
12030         (dynamic_list_keyword_parsecodes): New variable.
12031         (dynamic_list_keywords): New variable.
12032         * script.h (Script_options::define_dynamic_list): New function
12033         prototype.
12034         (read_dynamic_list): New function prototype.
12035         * symtab.cc (strprefix): New macro.
12036         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12037         dynamic_list_data, dynamic_list_cpp_new, and
12038         dynamic_list_cpp_typeinfo.
12039         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12040         (dynamic_list_expr): New rule.
12041         (dynamic_list_nodes): Likewise.
12042         (dynamic_list_node): Likewise.
12043         * testsuite/Makefile.am (dynamic_list): New test.
12044         * testsuite/Makefile.in: Regenerated.
12045         * testsuite/dynamic_list.t: New file.
12046         * testsuite/dynamic_list.sh: New file.
12047
12048 2008-11-05  Craig Silverstein  <csilvers@google.com>
12049
12050         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12051         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12052         (t11_last): Likewise.
12053         * testsuite/ver_test_6.c (main): Likewise.
12054
12055 2008-10-07  Cary Coutant  <ccoutant@google.com>
12056
12057         * options.c (General_options::finalize): Add check for -static and
12058         -shared.
12059         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12060         is not empty.
12061
12062 2008-10-02  Cary Coutant  <ccoutant@google.com>
12063
12064         * plugin.cc (make_sized_plugin_object): Fix conditional
12065         compilation to work when not all targets are enabled.
12066
12067 2008-09-29  Cary Coutant  <ccoutant@google.com>
12068
12069         * archive.cc (Archive::get_file_and_offset): Use filename instead
12070         of name to get library path.
12071         (Archive::include_member): Unlock external member of a thin archive.
12072
12073         * testsuite/Makefile.am (TEST_AR): New variable.
12074         (thin_archive_test_1): New test.
12075         (thin_archive_test_2): New test.
12076         * testsuite/Makefile.in: Regenerate.
12077         * testsuite/thin_archive_main.cc: New file.
12078         * testsuite/thin_archive_test_1.cc: New file.
12079         * testsuite/thin_archive_test_2.cc: New file.
12080         * testsuite/thin_archive_test_3.cc: New file.
12081         * testsuite/thin_archive_test_4.cc: New file.
12082
12083 2008-09-29  Cary Coutant  <ccoutant@google.com>
12084
12085         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12086         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12087         instead of -1U.
12088         (Sized_relobj::do_finalize_local_symbols): Likewise.
12089         (Sized_relobj::map_to_kept_section): Likewise.
12090         * object.h (Sized_relobj::invalid_address): New constant.
12091         (Sized_relobj::do_output_section_offset): Check for invalid_address
12092         and return -1ULL.
12093         * output.cc (Output_reloc::local_section_offset): Use constant
12094         invalid_address instead of -1U.
12095         (Output_reloc::get_address): Likewise.
12096         (Output_section::output_address): Change -1U to -1ULL.
12097         * output.h (Output_reloc::invalid_address): New constant.
12098         * reloc.cc (Sized_relobj::write_sections): Use constant
12099         invalid_address instead of -1U.
12100         (Sized_relobj::relocate_sections): Likewise.
12101         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12102         values for merge sections.
12103         * target-reloc.h (relocate_for_relocatable): Use constant
12104         invalid_address instead of -1U.
12105
12106 2008-09-19  Cary Coutant  <ccoutant@google.com>
12107
12108         Add plugin functionality for link-time optimization (LTO).
12109         * configure.ac (plugins): Add --enable-plugins option.
12110         * configure: Regenerate.
12111         * config.in: Regenerate.
12112         * Makefile.am (LIBDL): New variable.
12113         (CCFILES): Add plugin.cc.
12114         (HFILES): Add plugin.h.
12115         (ldadd_var): Add LIBDL.
12116         * Makefile.in: Regenerate.
12117
12118         * archive.cc: Include "plugin.h".
12119         (Archive::setup): Don't preread archive symbols when using a plugin.
12120         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12121         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12122         files.
12123         (Archive::include_member): Add symbols from plugin objects.
12124         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12125         * descriptors.cc (Descriptors::open): Check for file descriptors
12126         abandoned by plugins.
12127         (Descriptors::claim_for_plugin): New function.
12128         * descriptors.h (Descriptors::claim_for_plugin): New function.
12129         (Open_descriptor::is_claimed): New field.
12130         (claim_descriptor_for_plugin): New function.
12131         * fileread.cc (File_read::claim_for_plugin): New function.
12132         * fileread.h (File_read::claim_for_plugin): New function.
12133         (File_read::descriptor): New function.
12134         * gold.cc: Include "plugin.h".
12135         (queue_initial_tasks): Add task to call plugin hooks for generating
12136         new object files.
12137         * main.cc: Include "plugin.h".
12138         (main): Load plugin libraries.
12139         * object.h (Pluginobj): Declare.
12140         (Object::pluginobj): New function.
12141         (Object::do_pluginobj): New function.
12142         (Object::set_target): New function.
12143         * options.cc: Include "plugin.h".
12144         (General_options::parse_plugin): New function.
12145         (General_options::General_options): Initialize plugins_ field.
12146         (General_options::add_plugin): New function.
12147         * options.h (Plugin_manager): Declare.
12148         (General_options): Add --plugin option.
12149         (General_options::has_plugins): New function.
12150         (General_options::plugins): New function.
12151         (General_options::add_plugin): New function.
12152         (General_options::plugins_): New field.
12153         * plugin.cc: New file.
12154         * plugin.h: New file.
12155         * readsyms.cc: Include "plugin.h".
12156         (Read_symbols::do_read_symbols): Check for archive before checking
12157         for ELF file.  Call plugin hooks to claim files.
12158         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12159         from a real object file; force override when processing replacement
12160         files.
12161         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12162         (Symbol::init_base_object): Likewise.
12163         (Symbol::init_base_output_data): Likewise.
12164         (Symbol::init_base_output_segment): Likewise.
12165         (Symbol::init_base_constant): Likewise.
12166         (Symbol::init_base_undefined): Likewise.
12167         (Symbol::output_section): Assert that object is not a plugin.
12168         (Symbol_table::add_from_pluginobj): New function.
12169         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12170         undefined.
12171         (Symbol_table::sized_write_globals): Likewise.
12172         (Symbol_table::add_from_pluginobj): Instantiate template.
12173         * symtab.h (Sized_pluginobj): Declare.
12174         (Symbol::in_real_elf): New function.
12175         (Symbol::set_in_real_elf): New function.
12176         (Symbol::in_real_elf_): New field.
12177         (Symbol_table::add_from_pluginobj): New function.
12178
12179         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12180         (LIBDL): New variable.
12181         (LDADD): Add LIBDL.
12182         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12183         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12184         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12185         (MOSTLYCLEANFILES): Likewise.
12186         * testsuite/Makefile.in: Regenerate.
12187         * testsuite/plugin_test.c: New file.
12188         * testsuite/plugin_test_1.sh: New file.
12189         * testsuite/plugin_test_2.sh: New file.
12190
12191 2008-09-16  Ian Lance Taylor  <iant@google.com>
12192
12193         * target-reloc.h (relocate_section): Check whether a symbol is
12194         defined by the ABI before reporting an undefined symbol error.
12195         * target.h (Target::is_defined_by_abi): Make parameter const.
12196         (Target::do_is_defined_by_abi): Likewise.
12197         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12198         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12199         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12200         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12201         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12202         * testsuite/Makefile.in: Rebuild.
12203
12204         * fileread.cc (make_view): Add casts to avoid warning.
12205
12206 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12207
12208         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12209         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12210
12211 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12212
12213         * options.h (General_options::output_is_executable): New.
12214         (General_options::output_is_pie): New.
12215         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12216         for shared libraries.
12217         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12218
12219 2008-09-11  Chris Demetriou  <cgd@google.com>
12220
12221         * options.h (origin): New -z option.
12222         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12223         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12224         in DT_FLAGS_1.
12225
12226 2008-09-05  Cary Coutant  <ccoutant@google.com>
12227
12228         * fileread.cc (File_read::make_view): Add check for attempt to map
12229         beyond end of file.
12230
12231 2008-09-05  Cary Coutant  <ccoutant@google.com>
12232
12233         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12234         explicit instantiations.
12235
12236 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12237
12238         PR gold/6858
12239         * options.cc (General_options::finalize): Allow undefined symbols
12240         in shlibs if linking -shared.
12241
12242         PR gold/6859
12243         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12244         symbols as not needing a dynsym entry.
12245
12246 2008-08-20  Craig Silverstein  <csilvers@google.com>
12247
12248         * fileread.cc (File_read::open): Do not lock the file unless it
12249         was successfully opened.
12250
12251 2008-08-14  Cary Coutant  <ccoutant@google.com>
12252
12253         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12254         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12255         * testsuite/tls_test.cc (struct int128): 128-bit struct
12256         for testing TLS relocs with non-zero addend.
12257         (v12): New TLS variable.
12258         (t12): New test.
12259         (t_last): Add check for v12.
12260         * testsuite/tls_test.h (t12): New function.
12261         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12262
12263 2008-08-13  Ian Lance Taylor  <iant@google.com>
12264
12265         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12266         set tls_segment_ or relro_segment_.
12267         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12268         when appropriate.
12269         * output.h (Output_section::clear_is_relro): New function.
12270         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12271         sections specially even when output_data_ is empty.
12272         (Output_segment::maximum_alignment): When first section is relro,
12273         only force alignment for PT_LOAD segments.
12274         * script.cc (script_data_segment_align): New function.
12275         (script_data_segment_relro_end): New function.
12276         * script-c.h (script_data_segment_align): Declare.
12277         (script_data_segment_relro_end): Declare.
12278         * script-sections.h (class Script_sections): Declare
12279         data_segment_align and data_segment_relro_end.  Add fields
12280         segment_align_index_ and saw_relro_end_.
12281         * script-sections.cc (class Sections_element): Add set_is_relro
12282         virtual function.  Add new bool* parameter to place_orphan_here.
12283         Add get_output_section virtual function.
12284         (class Output_section_definition): Add set_is_relro.  Add new
12285         bool* parameter to place_orphan_here.  Add get_output_section.
12286         Add is_relro_ field.
12287         (Output_section_definition::Output_section_definition): Initialize
12288         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12289         and is_relro_ fields.
12290         (Output_section_definition::place_orphan_here): Add is_relro
12291         parameter.
12292         (Output_section_definition::set_section_addresses): Set relro for
12293         output section.
12294         (Output_section_definition::alternate_constraint): Likewise.
12295         (class Orphan_output_section): Add new bool* parameter to
12296         place_orphan_here.  Add get_output_section.
12297         (Orphan_output_section::place_orphan_here): Add is_relro
12298         parameter.
12299         (Script_sections::Script_sections): Initialize
12300         data_segment_align_index_ and saw_relro_end_.
12301         (Script_sections::data_segment_align): New function.
12302         (Script_sections::data_segment_relro_end): New function.
12303         (Script_sections::place_orphan): Set or clear is_relro.
12304         (Script_sections::set_section_addresses): Force alignment of first
12305         TLS section.
12306         * yyscript.y (exp): Call script_data_segment_align and
12307         script_data_segment_relro_end.
12308         * testsuite/relro_script_test.t: New file.
12309         * testsuite/relro_test.cc (using_script): Declare.
12310         (t1, t2): Test using_script.
12311         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12312         (relro_script_test_SOURCES): Define.
12313         (relro_script_test_DEPENDENCIES): Define.
12314         (relro_script_test_LDFLAGS): Define.
12315         (relro_script_test_LDADD): Define.
12316         (relro_script_test.so): New target.
12317         * testsuite/Makefile.in: Rebuild.
12318
12319 2008-08-06  Cary Coutant <ccoutant@google.com>
12320
12321         * archive.cc (Archive::total_archives, Archive::total_members)
12322         (Archive::total_members_loaded): New variables.
12323         (Archive::setup): Add parameter.  Add option to preread
12324         archive symbols.
12325         (Archive::read_armap): Add counter.
12326         (Archive::get_file_and_offset): New function.
12327         (Archive::get_elf_object_for_member): New function.
12328         (Archive::read_all_symbols): New function.
12329         (Archive::read_symbols): New function.
12330         (Archive::add_symbols): Add counters.
12331         (Archive::include_all_members): Use armap to find members if it's
12332         already built.
12333         (Archive::include_member): Skip reading symbols if already read.
12334         Factored code into Archive::get_file_and_offset and
12335         Archive::get_elf_object_for_member.  Changed call to
12336         Mapfile::report_include_archive_member.
12337         (Archive::print_stats): New function.
12338         * archive.h: Declare Object and Read_symbols_data classes.
12339         (Archive::Archive): Add initializers for new members.
12340         (Archive::setup): Add parameter.
12341         (Archive::print_stats): New function.
12342         (Archive::total_archives, Archive::total_members)
12343         (Archive::total_members_loaded): New variables.
12344         (Archive::get_file_and_offset): New function.
12345         (Archive::get_elf_object_for_member): New function.
12346         (Archive::read_all_symbols): New function.
12347         (Archive::read_symbols): New function.
12348         (Archive::Archive_member): New class.
12349         (Archive::members_): New member.
12350         (Archive::num_members_): New member.
12351         * main.cc: Include archive.h.
12352         (main): Call Archive::print_stats.
12353         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12354         archive parameter; member_name is now the fully-decorated name.
12355         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12356         * options.h: (General_options): Add --preread-archive-symbols option.
12357         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12358         Archive::setup.
12359
12360 2008-08-04  Ian Lance Taylor  <iant@google.com>
12361
12362         * symtab.h (Symbol::use_plt_offset): New function.
12363         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12364         * powerpc.cc (Relocate::relocate): Likewise.
12365         * sparc.cc (Relocate::relocate): Likewise.
12366         * x86_64.cc (Relocate::relocate): Likewise.
12367         * testsuite/weak_plt.sh: New test.
12368         * testsuite/weak_plt_main.cc: New test.
12369         * testsuite/weak_plt_shared.cc: New test.
12370         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12371         (check_PROGRAMS): Add weak_plt.
12372         (check_DATA): Add weak_plt_shared.so.
12373         (weak_plt_main_pic.o, weak_plt): New targets.
12374         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12375         * testsuite/Makefile.in: Rebuild.
12376
12377         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12378         gcctestdir/ld.
12379         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12380         * testsuite/Makefile.in: Rebuild.
12381
12382 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12383
12384         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12385         * Makefile.in: Regenerate.
12386         * po/POTFILES.in: Regenerate.
12387
12388 2008-07-29  Ian Lance Taylor  <iant@google.com>
12389
12390         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12391         symbols before other symbols.
12392         * testsuite/script_test_2.cc (test_addr): Declare.
12393         (test_addr_alias): Declare.
12394         (main): Check that test_addr and test_addr_alias have the right
12395         values.
12396         * testsuite/script_test_2.t: Define test_addr_alias and
12397         test_addr.
12398
12399 2008-07-24  Ian Lance Taylor  <iant@google.com>
12400
12401         PR 5990
12402         * descriptors.cc: New file.
12403         * descriptors.h: New file.
12404         * gold-threads.h (class Hold_optional_lock): New class.
12405         * fileread.cc: Include "descriptors.h".
12406         (File_read::~File_read): Release descriptor rather than closing
12407         it.
12408         (File_read::open) [file]: Call open_descriptor rather than open.
12409         Set is_descriptor_opened_.
12410         (File_read::open) [memory]: Assert that descriptor is not open.
12411         (File_read::reopen_descriptor): New function.
12412         (File_read::release): Release descriptor.
12413         (File_read::do_read): Make non-const.  Reopen descriptor.
12414         (File_read::read): Make non-const.
12415         (File_read::make_view): Reopen descriptor.
12416         (File_read::do_readv): Likewise.
12417         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12418         Update declarations.
12419         * layout.cc: Include "descriptors.h".
12420         (Layout::create_build_id): Use open_descriptor rather than open.
12421         * output.cc: Include "descriptors.h".
12422         (Output_file::open): Use open_descriptor rather than open.
12423         * archive.cc (Archive::const_iterator): Change Archive to be
12424         non-const.
12425         (Archive::begin, Archive::end): Make non-const.
12426         (Archive::count_members): Likewise.
12427         * archive.h (class Archive): Update declarations.
12428         * object.h (Object::read): Make non-const.
12429         * Makefile.am (CCFILES): Add descriptors.cc.
12430         (HFILES): Add descriptors.h.
12431         * Makefile.in: Rebuild.
12432
12433         PR 6716
12434         * gold.h: Always include <clocale>.  Add Solaris workarounds
12435         following code in binutils/sysdep.h.
12436
12437         PR 6048
12438         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12439         this->eh_frame_hdr_ is NULL before using it.
12440
12441         * dynobj.cc (Versions::Versions): Update comment.
12442
12443         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12444         the base version name.
12445
12446         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12447         array size plus one.
12448         (Stringpool_template::set_string_offsets): Subtract one from key
12449         before using it as an array index.
12450         (Stringpool_template::get_offset_with_length): Likewise.
12451         (Stringpool_template::write_to_buffer): Likewise.
12452         * stringpool.h (Stringpool_template::get_offset_from_key):
12453         Likewise.
12454
12455 2008-07-23  Ian Lance Taylor  <iant@google.com>
12456
12457         PR 6658
12458         * object.h (Merged_symbol_value::value): Do our best to handle a
12459         negative addend.
12460
12461         PR 6647
12462         * script.cc (Version_script_info::get_versions): Don't add empty
12463         version tag to return value.
12464         (Version_script_info::get_symbol_version_helper): Change return
12465         type to bool.  Add pversion parameter.  Change all callers.
12466         (script_register_vers_node): Don't require a non-NULL tag.
12467         * script.h (class Version_script_info): Update declarations.
12468         (Version_script_info::get_symbol_version): Change return type to
12469         bool.  Add version parameter.  Change all callers.
12470         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12471         handling.  Handle an empty version from a version script.
12472         (Symbol_table::define_special_symbol): Likewise.
12473         * testsuite/ver_test_10.script: New file.
12474         * testsuite/ver_test_10.sh: New file.
12475         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12476         (check_DATA): Add ver_test_10.syms.
12477         (ver_test_10.syms, ver_test_10.so): New target.
12478         * testsuite/Makefile.in: Rebuild.
12479
12480 2008-07-23  Simon Baldwin  <simonb@google.com>
12481
12482         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12483         to zero for undefined symbols from dynamic libraries.
12484
12485 2008-07-23  Ian Lance Taylor  <iant@google.com>
12486
12487         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12488         Change all callers.
12489         * symtab.h (class Symbol_table): Update declaration.
12490         * testsuite/ver_test_9.cc: New file.
12491         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12492         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12493         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12494         (ver_test_9.so, ver_test_9.o): New targets.
12495         * testsuite/Makefile.in: Rebuild.
12496
12497 2008-07-22  Ian Lance Taylor  <iant@google.com>
12498
12499         * options.h (class General_options): Define --check-sections.
12500         * layout.cc (Layout::set_segment_offsets): Handle
12501         --check-sections.
12502
12503         * options.h (class General_options): Define -n/--nmagic and
12504         -N/--omagic.
12505         * options.cc (General_options::finalize): For -n/--nmagic or
12506         -N/--omagic, set -static.
12507         * layout.cc (Layout::attach_allocated_section_to_segment): If
12508         -N/--omagic, don't put read-only and read-write sections in
12509         different segments.
12510         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12511         finding a read-only segment.
12512         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12513         don't set the minimum segment alignment to the common page size,
12514         and don't set the file offset to the address modulo the page size.
12515         * script-sections.cc (Script_sections::create_segments): If
12516         -n/--omagic, don't put read-only and read-write sections in
12517         different segments.
12518
12519         * cref.cc: New file.
12520         * cref.h: New file.
12521         * options.h (class General_options): Add --print-symbol-counts.
12522         * main.cc (main): Issue defined symbol report if requested.
12523         * archive.cc (Archive::interpret_header): Make into a const member
12524         function.
12525         (Archive::add_symbols): Call Input_objects::archive_start and
12526         archive_stop.
12527         (Archive::const_iterator): Define new class.
12528         (Archive::begin, Archive::end): New functions.
12529         (Archive::include_all_members): Rewrite to use iterator.
12530         (Archive::count_members): New function.
12531         * archive.h (class Archive): Update declarations.
12532         (Archive::filename): New function.
12533         * object.cc: Include "cref.h".
12534         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12535         (Sized_relobj::do_get_global_symbol_counts): New function.
12536         (Input_objects::add_object): Add object to cross-referencer.
12537         (Input_objects::archive_start): New function.
12538         (Input_objects::archive_stop): New function.
12539         (Input_objects::print_symbol_counts): New function.
12540         * object.h: Declare Cref and Archive.
12541         (Object::get_global_symbol_counts): New function.
12542         (Object::do_get_global_symbol_counts): New pure virtual function.
12543         (class Sized_relobj): Add defined_count_ field.  Update
12544         declarations.
12545         (class Input_objects): Add cref_ field.  Update constructor.
12546         Update declarations.
12547         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12548         defined_count_.
12549         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12550         symbol counts.
12551         (Sized_dynobj::do_get_global_symbol_counts): New function.
12552         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12553         defined_count_.  Update declarations.  Define Symbols typedef.
12554         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12555         parameter.  Change all callers.
12556         (Symbol_table::add_from_dynobj): Add sympointers and defined
12557         parameters.  Change all callers.
12558         * symtab.h (class Symbol_table): Update declarations.
12559         * Makefile.am (CCFILES): Add cref.cc.
12560         (HFILES): Add cref.h.
12561         * Makefile.in: Rebuild.
12562
12563 2008-07-22  Simon Baldwin  <simonb@google.com>
12564
12565         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12566         to zero when writing undefined symbols.
12567
12568 2008-07-22  Ian Lance Taylor  <iant@google.com>
12569
12570         * output.cc (Output_section::add_input_section): Don't try to
12571         merge empty merge sections.
12572
12573 2008-07-21  Craig Silverstein  <csilvers@google.com>
12574
12575         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12576         Include symbol version in error message.
12577
12578 2008-07-20  Chris Demetriou  <cgd@google.com>
12579
12580         * configure.ac (gold_cv_c_random_seed): New configured variable.
12581         (RANDOM_SEED_CFLAGS): New substituted variable.
12582         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12583         * configure: Rebuild.
12584         * Makefile.in: Likewise.
12585         * testsuite/Makefile.in: Likewise.
12586
12587 2008-07-18  Ian Lance Taylor  <iant@google.com>
12588
12589         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12590         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12591         * testsuite/ver_test_main.cc (main): Call t4.
12592         (t4, t4_2a): Define.
12593         * testsuite/ver_test_2.cc (t4_2): Define.
12594         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12595         * testsuite/ver_test_4.cc (t4_2a): Define.
12596         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12597         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12598
12599 2008-07-17  Ian Lance Taylor  <iant@google.com>
12600
12601         * dynobj.cc (Versions::add_def): If we give an error about a
12602         missing version, go ahead and create the version anyhow.
12603
12604 2008-07-10  Ian Lance Taylor  <iant@google.com>
12605
12606         Handle output sections with more than 0x7fffffff bytes.
12607         * object.h (class Relobj): Change map_to_output_ to
12608         output_sections_, and just keep a section pointer.  Change all
12609         uses.  Move comdat group support to Sized_relobj.
12610         (Relobj::is_section_specially_mapped): Remove.
12611         (Relobj::output_section): Remove poff parameter.  Change all
12612         callers.
12613         (Relobj::output_section_offset): New function.
12614         (Relobj::set_section_offset): Rewrite.
12615         (Relobj::map_to_output): Remove.
12616         (Relobj::output_sections): New function.
12617         (Relobj::do_output_section_offset): New pure virtual function.
12618         (Relobj::do_set_section_offset): Likewise.
12619         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12620         group support from Relobj.  Update declarations.
12621         (Sized_relobj::get_output_section_offset): New function.
12622         (Sized_relobj::do_output_section_offset): New function.
12623         (Sized_relobj::do_set_section_offset): New function.
12624         * object.cc (Relobj::output_section_address): Remove.
12625         (Sized_relobj::Sized_relobj): Initialize new fields.
12626         (Sized_relobj::include_section_group): Cast find_kept_object to
12627         Sized_relobj.
12628         (Sized_relobj::include_linkonce_section): Likewise.
12629         (Sized_relobj::do_layout): Use separate arrays for output section
12630         and output offset.
12631         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12632         output_sections.
12633         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12634         output_sections and section_offsets.
12635         (Sized_relobj::write_local_symbols): Likewise.
12636         (map_to_kept_section): Compute output address directly.
12637         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12638         output_sections and section_offsets.
12639         (Sized_relobj::write_sections): Likewise.
12640         (Sized_relobj::relocate_sections): Likewise.
12641         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12642         * output.h (class Output_reloc): Update declarations.  Change
12643         u2_.relobj to Sized_relobj*.
12644         (class Output_data_reloc): Change add functions to use
12645         Sized_relobj*.
12646         * output.cc (Output_reloc::Output_reloc): Change relobj to
12647         Sized_relobj*.
12648         (Output_reloc::local_section_offset): Change return type to
12649         Elf_Addr.  Use get_output_section_offset.
12650         (Output_reloc::get_address): Likewise.
12651         (Output_section::is_input_address_mapped): Don't call
12652         is_section_specially_mapped.
12653         (Output_section::output_offset): Likewise.
12654         (Output_section::output_address): Likewise.
12655         (Output_section::starting_output_address): Likewise.
12656         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12657         parameter to Sized_relobj*.
12658         (Copy_relocs::need_copy_reloc): Likewise.
12659         (Copy_relocs::save): Likewise.
12660         * copy-relocs.h (class Copy_relocs): Update declarations.
12661         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12662         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12663         * target-reloc.h (relocate_for_relocatable): Change
12664         offset_in_output_section type to Elf_Addr.  Change code that uses
12665         it as well.
12666         * layout.cc (Layout::layout): Always set *off.
12667         * mapfile.cc (Mapfile::print_input_section): Use
12668         output_section_offset.
12669         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12670         Sized_relobj*.
12671         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12672         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12673         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12674
12675 2008-07-03  Ian Lance Taylor  <iant@google.com>
12676
12677         * layout.cc (Layout::include_section): Do not discard unrecognized
12678         SHT_STRTAB sections.
12679
12680 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12681
12682         * script.cc (Lex::can_continue_name): Make '?' allowable in
12683         version-script names.
12684         * testsuite/version_script.map: Change glob pattern to use '?'
12685
12686 2008-06-30  Manish Singh  <yosh@gimp.org>
12687
12688         PR 6585
12689         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12690         Correct typo.
12691
12692 2008-06-30  Ian Lance Taylor  <iant@google.com>
12693
12694         PR 6660
12695         PR 6682
12696         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12697         versions]: Don't try to read the value in the contents, since we
12698         don't use it.  Use the template endianness when writing.
12699
12700 2008-06-25  Cary Coutant  <ccoutant@google.com>
12701
12702         * fileread.cc (File_read::make_view): Assert on zero-length view.
12703         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12704         symbol table when there are no symbols to read.
12705
12706 2008-06-23  Craig Silverstein  <csilvers@google.com>
12707
12708         * version.cc (version_string): Bump to 1.7
12709
12710 2008-06-18  Craig Silverstein  <csilvers@google.com>
12711
12712         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12713         constant 0xFFFF to type Valtype.
12714         (Powerpc_relocate_functions::rel16_ha): Likewise.
12715
12716 2008-06-17  Ian Lance Taylor  <iant@google.com>
12717
12718         * output.h (Output_section::Input_section): Initialize p2align_ to
12719         zero for Output_section_data constructors.
12720         (Output_section::Input_section::addralign): If not an input
12721         section, return the alignment of the Output_section_data.
12722         * testsuite/copy_test.cc: New file.
12723         * testsuite/copy_test_1.cc: New file.
12724         * testsuite/copy_test_2.cc: New file.
12725         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12726         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12727         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12728         (copy_test_1_pic.o, copy_test_1.so): New targets.
12729         (copy_test_2_pic.o, copy_test_2.so): New targets.
12730         * testsuite/Makefile.in: Rebuild.
12731
12732         * script-sections.cc (Script_sections::place_orphan): Initialize
12733         local variable exact.
12734
12735 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12736
12737         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12738
12739 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12740             David S. Miller  <davem@davemloft.net>
12741
12742         * powerpc.cc: New file.
12743         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12744         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12745         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12746         * Makefile.in: Rebuild.
12747
12748 2008-06-09  Ian Lance Taylor  <iant@google.com>
12749
12750         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12751         <exception>.
12752         (throwing, orig_terminate): New static variables.
12753         (terminate_handler): New static function.
12754         (t2): Set terminate handler.
12755
12756 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12757
12758         PR 6584
12759         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12760         alignment.
12761
12762 2008-05-30  Cary Coutant  <ccoutant@google.com>
12763
12764         * archive.cc (Archive::include_all_members) Correct to step
12765         over symbol table and extended name table in thin archives.
12766
12767 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12768
12769         PR 6407
12770         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12771         calculation.
12772
12773 2008-05-28  Caleb Howe  <cshowe@google.com>
12774
12775         * reduced_debug_output.cc: New file.
12776         * reduced_debug_output.h: New file.
12777         * options.h (class General_options): Add --strip-debug-non-line.
12778         * options.cc (General_options::finalize): Add strip_debug_non_line
12779         to the strip heirarchy.
12780         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12781         fields.
12782         * layout.cc: Include "reduced_debug_output.h".
12783         (Layout::Layout): Initialize new fields.
12784         (line_only_debug_sections): New static array.
12785         (is_lines_only_debug_sections): New static inline function.
12786         (Layout::include_section): Handle --strip-debug-non-line.
12787         (Layout::make_output_section): If --strip-debug-non-line, build
12788         new output sections for .debug_abbrev and .debug_info.
12789         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12790         gold.  Warn about possible overflow.
12791         (read_signed_LEB_128): Likewise.
12792         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12793         (read_signed_LEB_128): Declare.
12794         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12795         (HFILES): Add reduced_debug_output.h.
12796         * Makefile.in: Rebuild.
12797
12798 2008-05-21  Ian Lance Taylor  <iant@google.com>
12799
12800         * mapfile.cc: New file.
12801         * mapfile.h: New file.
12802         * options.h (class General_options): Add -M/--print-map and -Map.
12803         * options.cc (General_options::finalize): Make -M equivalent to
12804         -Map -.
12805         * main.cc: Include <cstdio> and "mapfile.h".
12806         (main): Open mapfile if requested.
12807         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12808         constructor.  Change caller.
12809         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12810         (queue_middle_tasks): Likewise.
12811         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12812         declarations.
12813         * archive.cc: Include "mapfile.h".
12814         (Archive::add_symbols): Add mapfile parameter.  Change all
12815         callers.  Pass mapfile, symbol, and reason to include_member.
12816         (Archive::include_all_members): Add mapfile parameter.  Change all
12817         callers.
12818         (Archive::include_member): Add mapfile, sym, and why parameters.
12819         Change all callers.  Report inclusion to map file.
12820         * archive.h: Include "fileread.h".
12821         (class Archive): Update declarations.
12822         (Archive::file): New const method.
12823         (class Add_archive_symbols): Add mapfile_ field.  Update
12824         constructor.  Change all callers.
12825         * readsyms.h (class Read_symbols): Likewise.
12826         (class Finish_group): Likewise.
12827         (class Read_script): Likewise.
12828         * common.cc: Include "mapfile.h".
12829         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12830         all callers.
12831         (Symbol_table::do_allocate_commons): Likewise.
12832         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12833         symbol allocation to mapfile.
12834         * common.h (class Allocate_commons_task): Add mapfile_ field.
12835         Update constructor.  Change all callers.
12836         * symtab.h (class Symbol_table): Update declarations.
12837         * layout.cc: Include "mapfile.h".
12838         (Layout_task_runner::run): Print information to mapfile.
12839         (Layout::create_gold_note): Change Output_data_fixed_space to
12840         Output_data_zero_fill.
12841         (Layout::create_build_id): Likewise.
12842         (Layout::print_to_mapfile): New function.
12843         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12844         constructor.  Change caller.
12845         (class Layout): Declare print_to_mapfile.
12846         * output.cc (Output_section::Input_section::print_to_mapfile): New
12847         function.
12848         (Output_section::add_input_section): If producing a map, always
12849         add to input_sections_ list.
12850         (Output_section::do_print_to_mapfile): New function.
12851         (Output_segment::print_sections_to_mapfile): New function.
12852         (Output_segment::print_section_list_to_mapfile): New function.
12853         * output.h: Include "mapfile.h".
12854         (Output_data::print_to_mapfile): New function.
12855         (Output_data::do_print_to_mapfile): New virtual function.
12856         (Output_segment_headers::do_print_to_mapfile): New function.
12857         (Output_file_header::do_print_to_mapfile): New function.
12858         (Output_data_const::do_print_to_mapfile): New function.
12859         (class Output_data_const_buffer): Add map_name_ field.  Update
12860         constructor.  Change all callers.  Add do_print_to_mapfile
12861         function.
12862         (class Output_data_fixed_space): Likewise.
12863         (class Output_data_space): Likewise.
12864         (class Output_data_zero_fill): New class.
12865         (Output_data_strtab::do_print_to_mapfile): New function.
12866         (Output_data_reloc_base::do_print_to_mapfile): New function.
12867         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12868         (Output_data_group::do_print_to_mapfile): New function.
12869         (Output_data_got::do_print_to_mapfile): New function.
12870         (Output_data_dynamic::do_print_to_mapfile): New function.
12871         (Output_symtab_xindex::do_print_to_mapfile): New function.
12872         (class Output_section): Declare do_print_to_mapflie.  Declare
12873         print_to_mapfile in Input_section.
12874         (class Output_segment): Declare new functions.
12875         * object.h (Sized_relobj::symbol_count): New function.
12876         * script-sections.cc
12877         (Output_section_element_dot_assignment::set_section_addresses):
12878         Change Output_data_fixed_space to Output_data_zero_fill.
12879         (Output_data_expression::do_print_to_mapfile): New function.
12880         * script.cc (read_input_script): Add mapfile parameter.  Change
12881         all callers.
12882         * script.h (read_input_script): Update declaration.
12883         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12884         (Eh_frame::do_print_to_mapfile): New function.
12885         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12886         (Output_merge_string::do_print_to_mapfile): New function.
12887         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12888         function.
12889         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12890         function.
12891         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12892         function.
12893         * Makefile.am (CCFILES): Add mapfile.cc.
12894         (HFILES): Add mapfile.h.
12895         * Makefile.in: Rebuild.
12896
12897 2008-05-19  Ian Lance Taylor  <iant@google.com>
12898
12899         * options.h (class General_options): Add -z relro.
12900         * layout.cc (Layout::Layout): Initialize relro_segment_.
12901         (Layout::add_output_section_data): Return the output section.
12902         (Layout::make_output_section): Rcognize relro sections and mark
12903         them appropriately.
12904         (Layout::attach_allocated_section_to_segment): Put relro sections
12905         in a PT_GNU_RELRO segment.
12906         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12907         section as relro.
12908         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12909         PT_TLS segments.
12910         (Layout::linkonce_mapping): Map d.rel.ro.local to
12911         .data.rel.ro.local.
12912         (Layout::output_section_name): Us .data.rel.ro.local for any
12913         section which begins with that.
12914         * layout.h (class Layout): Update add_output_section_data
12915         declaration.  Add relro_segment_ field.
12916         * output.cc (Output_section::Output_section): Initialize is_relro_
12917         and is_relro_local_ fields.
12918         (Output_segment::add_output_section): Group relro sections.
12919         (Output_segment::is_first_section_relro): New function.
12920         (Output_segment::maximum_alignment): If there is a relro section,
12921         align the segment to the common page size.
12922         (Output_segment::set_section_addresses): Track whether we are
12923         looking at relro sections.  If the last section is a relro
12924         section, align to the common page size.
12925         (Output_segment::set_section_list_addresses): Add in_relro
12926         parameter.  Change all callers.  Align to the page size when
12927         moving from relro to non-relro section.
12928         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12929         segment.
12930         * output.h (class Output_section): Add is_relro_ and
12931         is_relro_local_ fields.
12932         (Output_section::is_relro): New function.
12933         (Output_section::set_is_relro): New function.
12934         (Output_section::is_relro_local): New function.
12935         (Output_section::set_is_relro_local): New function.
12936         (class Output_segment): Update declarations.
12937         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12938         * sparc.cc (Target_sparc::got_section): Likewise.
12939         * x86_64.cc (Target_x86_64::got_section): Likewise.
12940         * testsuite/relro_test_main.cc: New file.
12941         * testsuite/relro_test.cc: New file.
12942         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12943         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12944         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12945         (relro_test.so, relro_test_pic.o): New targets.
12946         * testsuite/Makefile.in: Rebuild.
12947
12948 2008-05-16  Ian Lance Taylor  <iant@google.com>
12949
12950         * output.cc (Output_segment::add_output_section): Remove front
12951         parameter.
12952         * output.h (class Output_segment): Remove
12953         add_initial_output_section and overloaded add_output_section.
12954         Update declaration of remaining add_output_section.
12955         * layout.cc (Layout::create_interp): Call add_output_section
12956         rather than add_initial_output_section.
12957         (Layout::finish_dynamic_section): Likewise.
12958
12959         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12960         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12961         know the dynamic type.
12962         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12963         field.  Initialize it in constructor.
12964         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12965         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12966         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12967         reloc.
12968
12969         * output.cc (Output_reloc::get_address): Change return type to
12970         Elf_Addr.
12971         * output.h (class Output_reloc): Update get_address declaration.
12972         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12973         for section addresses.
12974
12975 2008-05-09  Ian Lance Taylor  <iant@google.com>
12976
12977         PR 6493
12978         * gold.cc (gold_nomem): Use return value of write.
12979
12980 2008-05-08  Ian Lance Taylor  <iant@google.com>
12981
12982         * symtab.c (Symbol::init_base_output_data): Add version
12983         parameter.  Change all callers.
12984         (Symbol::init_base_output_segment): Likewise.
12985         (Symbol::init_base_constant): Likewise.
12986         (Symbol::init_base_undefined): Likewise.
12987         (Sized_symbol::init_output_data): Likewise.
12988         (Sized_symbol::init_output_segment): Likewise.
12989         (Sized_symbol::init_constant): Likewise.
12990         (Sized_symbol::init_undefined): Likewise.
12991         (Symbol_table::do_define_in_output_data): If the new symbol has a
12992         version, mark it as the default.
12993         (Symbol_table::do_define_in_output_segment): Likewise.
12994         (Symbol_table::do_define_as_constant): Likewise.
12995         * symtab.h (class Symbol): Update declarations.
12996         (class Sized_symbol): Likewise.
12997         * resolve.cc (Symbol::override_version): New function.
12998         (Symbol::override_base): Call override_version.
12999         (Symbol::override_base_with_special): Likewise.
13000         * testsuite/ver_script_8.script: New file.
13001         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13002         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13003         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13004         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13005
13006 2008-05-06  Ian Lance Taylor  <iant@google.com>
13007
13008         PR 6049
13009         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13010         functions.
13011         (class General_options): Remove existing --undefined, and add
13012         --no-undefined instead.  Add new --undefined as synonym for -u.
13013         * archive.cc (Archive::add_symbols): Check whether symbol was
13014         named with -u.
13015         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13016         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13017         all uses.  Add IS_UNDEFINED.  Update declarations to split
13018         different versions of init_base.  Declare init_base_undefined.
13019         (Symbol::is_defined): Handle IS_UNDEFINED.
13020         (Symbol::is_undefined): Likewise.
13021         (Symbol::is_weak_undefined): Call is_undefined.
13022         (Symbol::is_absolute): Handle IS_CONSTANT.
13023         (class Sized_symbol): Update declarations to split different
13024         versions of init.  Declare init_undefined.
13025         (class Symbol_table): Declare new functions.
13026         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13027         Change all callers.
13028         (Symbol::init_base_output_data): Likewise.
13029         (Symbol::init_base_output_segment): Likewise.
13030         (Symbol::init_base_constant): Likewise.
13031         (Symbol::init_base_undefined): New function.
13032         (Sized_symbol::init_object): Rename from init.  Change all
13033         callers.
13034         (Sized_symbol::init_output_data): Likewise.
13035         (Sized_symbol::init_output_segment): Likewise.
13036         (Sized_symbol::init_constant): Likewise.
13037         (Sized_symbol::init_undefined): New function.
13038         (Symbol_table::add_undefined_symbols_from_command_line): New
13039         function.
13040         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13041         function.
13042         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13043         (Symbol::output_section): Likewise.
13044         (Symbol::set_output_section): Likewise.
13045         (Symbol_table::sized_finalize_symbol): Likewise.
13046         (Symbol_table::sized_write_globals): Likewise.
13047         * resolve.cc (Symbol_table::should_override): Likewise.
13048         (Symbol::override_base_with_special): Likewise.
13049
13050         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13051         symbol, change it to have default visibility.
13052         * testsuite/protected_1.cc: New file.
13053         * testsuite/protected_2.cc: New file.
13054         * testsuite/protected_3.cc: New file.
13055         * testsuite/protected_main_1.cc: New file.
13056         * testsuite/protected_main_2.cc: New file.
13057         * testsuite/protected_main_3.cc: New file.
13058         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13059         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13060         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13061         (protected_1.so): New target.
13062         (protected_1_pic.o, protected_2_pic.o): New targets.
13063         (protected_3_pic.o): New target.
13064         (check_PROGRAMS): Add protected_2.
13065         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13066         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13067         * testsuite/Makefile.in: Rebuild.
13068
13069         * options.h (DEFINE_var): Add set_user_set_##varname__.
13070         (DEFINE_bool_alias): New macro.
13071         (class General_options): Define -Bstatic using DEFINE_bool_alias
13072         rather than DEFINE_special.  Add --undefined as an alias for -z
13073         defs.
13074         * options.cc (General_options::parse_Bstatic): Remove.
13075
13076         * options.h (class General_options): Add --fatal-warnings.
13077         * main.cc (main): Implement --fatal-warnings.
13078         * errors.h (Errors::warning_count): New function.
13079
13080         * options.h (class General_options): Add -Bsymbolic-functions.
13081         * symtab.h (Symbol::is_preemptible): Check for
13082         -Bsymbolic-functions.
13083
13084 2008-05-05  Ian Lance Taylor  <iant@google.com>
13085
13086         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13087         as noVARNAME rather than no-VARNAME.
13088         (class General_options): Add option -z combreloc.
13089         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13090         get_address.
13091         (Output_reloc::sort_before) [SHT_REL]: New function.
13092         (Output_reloc::sort_before) [SHT_RELA]: New function.
13093         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13094         Sort_relocs_comparison.
13095         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13096         parameter.  Change all callers.
13097         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13098         sort_relocs parameter.  Change all callers.
13099         * output.cc (Output_reloc::get_address): New function, broken out
13100         of write_rel.
13101         (Output_reloc::write_rel): Call it.
13102         (Output_reloc::compare): New function.
13103         (Output_data_reloc_base::do_write): Optionally sort relocs.
13104
13105         * configure.ac: If targ_extra_obj is set, link it in.
13106         * configure.tgt: Initialize all variables.
13107         (x86_64*): Set targ_extra_obj and targ_extra_size.
13108         * configure: Rebuild.
13109
13110         * object.cc (Sized_relobj::include_section_group): Adjust section
13111         indexes read from group data.  Build vector to pass to
13112         layout_group.
13113         * layout.cc (Layout::layout_group): Add flags and shndxes
13114         parameters.  Remove contents parameter.  Change caller.  Update
13115         explicit instantiations.
13116         * layout.h (class Layout): Update layout_group declaration.
13117         * output.cc (Output_data_group::Output_data_group): Add flags and
13118         input_shndxes parameters.  Remove contents parameter.  Change
13119         caller.
13120         (Output_data_group::do_write): Change input_sections_ to
13121         input_shndxes_.
13122         * output.h (class Output_data_group): Update constructor
13123         declaration.  Rename input_sections_ to input_shndxes_.
13124         * testsuite/many_sections_test.cc: Add template.
13125
13126 2008-04-30  Cary Coutant  <ccoutant@google.com>
13127
13128         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13129
13130         * layout.cc (Layout::include_section): Refactored check for debug
13131         info section.
13132         (Layout::add_comdat): Add new parameters.  Change type
13133         of signature parameter.  Add object and shndx to signatures table.
13134         (Layout::find_kept_object): New function.
13135         * layout.h: Include <cstring>.
13136         (Layout::is_debug_info_section): New function.
13137         (Layout::add_comdat): Add new parameters.
13138         (Layout::find_kept_object): New function.
13139         (Layout::Kept_section): New struct.
13140         (Layout::Signatures): Change type of map range.
13141         * object.cc (Relobj::output_section_address): New function.
13142         (Sized_relobj::include_section_group): Add new parameters.  Change
13143         calls to Layout::add_comdat.  Change to build table of kept comdat
13144         groups and table mapping discarded sections to kept sections.
13145         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13146         (Sized_relobj::do_layout): Change calls to include_section_group and
13147         include_linkonce_section.
13148         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13149         value to zero when section is discarded.
13150         (Sized_relobj::map_to_kept_section): New function.
13151         * object.h (Relobj::output_section_address): New function.
13152         (Relobj::Comdat_group): New type.
13153         (Relobj::find_comdat_group): New function.
13154         (Relobj::Comdat_group_table): New type.
13155         (Relobj::Kept_comdat_section): New type.
13156         (Relobj::Kept_comdat_section_table): New type.
13157         (Relobj::add_comdat_group): New function.
13158         (Relobj::set_kept_comdat_section): New function.
13159         (Relobj::get_kept_comdat_section): New function.
13160         (Relobj::comdat_groups_): New field.
13161         (Relobj::kept_comdat_sections_): New field.
13162         (Symbol_value::input_value): Update comment.
13163         (Sized_relobj::map_to_kept_section) New function.
13164         (Sized_relobj::include_linkonce_section): Add new parameter.
13165         * target-reloc.h (Comdat_behavior): New type.
13166         (get_comdat_behavior): New function.
13167         (relocate_section): Add code to map a discarded section to the
13168         corresponding kept section when applying a relocation.
13169
13170 2008-04-30  Craig Silverstein  <csilvers@google.com>
13171
13172         * dwarf_reader.cc (next_generation_count): New static var.
13173         (Addr2line_cache_entry): New struct.
13174         (addr2line_cache): New static var.
13175         (Dwarf_line_info::one_addr2line): Added caching.
13176         (Dwarf_line_info::clear_addr2line_cache): New function.
13177         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13178         cache-size parameter.
13179         (Dwarf_line_info::one_addr2line_cache): New function.
13180         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13181         new cache-size argument to one_addr2line(), and clear cache.
13182
13183 2008-04-28  Cary Coutant  <ccoutant@google.com>
13184
13185         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13186         R_386_PC8 relocations.
13187
13188 2008-04-23  Ian Lance Taylor  <iant@google.com>
13189
13190         * object.cc (Sized_relobj::include_section_group): Check for
13191         invalid section group.
13192
13193         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13194         header size.
13195
13196         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13197         than read for file header.
13198         * archive.cc (Archive::include_member): Likewise.
13199
13200 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13201
13202         * aclocal.m4: Regenerate.
13203         * configure: Regenerate.
13204
13205 2008-04-19  Ian Lance Taylor  <iant@google.com>
13206
13207         * version.cc (version_string): Bump to 1.6.
13208
13209         * testsuite/Makefile.am (many_sections_r_test): New target.
13210         (many_sections_r_test_SOURCES): Remove.
13211         (many_sections_r_test_DEPENDENCIES): Remove.
13212         (many_sections_r_test_LDFLAGS): Remove.
13213         (many_sections_r_test_LDADD): Remove.
13214
13215         * object.cc (Sized_relobj::do_add_symbols): Always pass
13216         local_symbol_count_ to add_from_relobj.
13217
13218         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13219         every thousand variables.
13220         * testsuite/Makefile.in: Rebuild.
13221
13222         * object.cc (Xindex::initialize_symtab_xindex): New function.
13223         (Xindex::read_symtab_xindex): New function.
13224         (Xindex::sym_xindex_to_shndx): New function.
13225         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13226         available.
13227         (Sized_relobj::do_initialize_xindex): New function.
13228         (Sized_relobj::do_read_symbols): Adjust section links.
13229         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13230         parameter.  Change all callers.
13231         (Sized_relobj::include_section_group): Adjust section links and
13232         symbol section indexes.
13233         (Sized_relobj::do_layout): Adjust section links.
13234         (Sized_relobj::do_count_local_symbols): Adjust section links and
13235         symbol section indexes.
13236         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13237         ordinary and special symbols.
13238         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13239         dynsym_xindex parameters.  Change all callers.  Adjust section
13240         links.  Use SHN_XINDEX when needed.
13241         (Sized_relobj::get_symbol_location_info): Adjust section links.
13242         Don't get fooled by special symbols.
13243         * object.h (class Xindex): Define.
13244         (class Object): Add xindex_ parameter.  Declare virtual functoin
13245         do_initialize_xindex.
13246         (Object::adjust_sym_shndx): New function.
13247         (Object::set_xindex): New protected function.
13248         (class Symbol_value): Add is_ordinary_shndx_ field.
13249         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13250         (Symbol_value::value): Assert ordinary section.
13251         (Symbol_value::initialize_input_to_output_map): Likewise.
13252         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13253         Change all callers.
13254         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13255         all callers.
13256         (class Sized_relobj): Update declarations.
13257         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13258         parameter.  Change all callers.
13259         (Sized_relobj::adjust_shndx): New function.
13260         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13261         field.
13262         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13263         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13264         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13265         (Sized_dynobj::read_dynsym_section): Adjust section links.
13266         (Sized_dynobj::read_dynamic): Likewise.
13267         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13268         section links.
13269         (Sized_dynobj::do_initialize_xindex): New function.
13270         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13271         do_initialize_xindex.
13272         (Sized_dynobj::adjust_shndx): New function.
13273         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13274         dynsym_xindex_ fields.
13275         (Layout::finalize): Add a call to set_section_indexes before
13276         creating the symtab sections.
13277         (Layout::set_section_indexes): Don't do anything if the section
13278         already has a section index.
13279         (Layout::create_symtab_sections): Add shnum parameter.  Change
13280         caller.  Create .symtab_shndx section if needed.
13281         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13282         caller.
13283         (Layout::allocated_output_section_count): New function.
13284         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13285         needed.
13286         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13287         fields.  Update declarations.
13288         (Layout::symtab_xindex): New function.
13289         (Layout::dynsym_xindex): New function.
13290         (class Write_symbols_task): Add layout_ field.
13291         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13292         Change caller.
13293         * output.cc (Output_section_headers::Output_section_headers): Add
13294         shstrtab_section parameter.  Change all callers.
13295         (Output_section_headers::do_sized_write): Store overflow values
13296         for section count and section string table section index in
13297         section header zero.
13298         (Output_file_header::do_sized_write): Check for overflow of
13299         section count and section string table section index.
13300         (Output_symtab_xindex::do_write): New function.
13301         (Output_symtab_xindex::endian_do_write): New function.
13302         * output.h (class Output_section_headers): Add shstrtab_section_.
13303         Update declarations.
13304         (class Output_symtab_xindex): Define.
13305         (Output_section::has_out_shndx): New function.
13306         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13307         field.
13308         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13309         Change all callers.
13310         (Sized_symbol::init): Likewise.
13311         (Symbol::output_section): Check for ordinary symbol.
13312         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13313         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13314         callers.
13315         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13316         Change all callers.  Simplify handling of symbols from sections
13317         not included in the link.
13318         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13319         distinction.
13320         (Weak_alias_sorter::operator()): Assert that symbols are
13321         ordinary.
13322         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13323         distinction.
13324         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13325         parameters.  Change all callers.
13326         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13327         symbol distinction.  Use SHN_XINDEX when needed.
13328         (Symbol_table::write_section_symbol): Add symtab_xindex
13329         parameter.  Change all callers.
13330         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13331         SHN_XINDEX when needed.
13332         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13333         declarations.
13334         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13335         (Symbol::is_defined): Check is_ordinary.
13336         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13337         (Symbol::is_absolute, Symbol::is_common): Likewise.
13338         (class Sized_symbol): Update declarations.
13339         (class Symbol_table): Update declarations.
13340         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13341         parameters.  Change all callers.
13342         (Sized_symbol::override): Likewise.
13343         (Symbol_table::override): Likewise.
13344         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13345         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13346         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13347         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13348         to be in an ordinary section.
13349         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13350         object and is_ordinary parameters.  Change all callers.
13351         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13352         Change all callers.  Don't add undefined or non-ordinary symbols
13353         to reloc_map_.
13354         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13355         Change all callers.
13356         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13357         declarations.
13358         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13359         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13360         (Sized_relobj::relocate_sections): Likewise.
13361         * target-reloc.h (scan_relocs): Adjust section symbol index.
13362         (scan_relocatable_relocs): Likewise.
13363         * i386.cc (Scan::local): Check for ordinary symbols.
13364         * sparc.cc (Scan::local): Likewise.
13365         * x86_64.cc (Scan::local): Likewise.
13366         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13367         to symbol_section_and_value.
13368         * testsuite/many_sections_test.cc: New file.
13369         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13370         (check_PROGRAMS): Add many_sections_test.
13371         (many_sections_test_SOURCES): Define.
13372         (many_sections_test_DEPENDENCIES): Define.
13373         (many_sections_test_LDFLAGS): Define.
13374         (BUILT_SOURCES): Add many_sections_define.h.
13375         (many_sections_define.h): New target.
13376         (BUILT_SOURCES): Add many_sections_check.h.
13377         (many_sections_check.h): New target.
13378         (check_PROGRAMS): Add many_sections_r_test.
13379         (many_sections_r_test_SOURCES): Define.
13380         (many_sections_r_test_DEPENDENCIES): Define.
13381         (many_sections_r_test_LDFLAGS): Define.
13382         (many_sections_r_test_LDADD): Define.
13383         (many_sections_r_test.o): New target.
13384         * testsuite/Makefile.in: Rebuild.
13385
13386 2008-04-17  Cary Coutant  <ccoutant@google.com>
13387
13388         * errors.cc (Errors::info): New function.
13389         (gold_info): New function.
13390         * errors.h (Errors::info): New function.
13391         * gold.h (gold_info): New function.
13392         * object.cc (Input_objects::add_object): Print trace output.
13393         * options.cc (options::parse_set): New function.
13394         (General_options::parse_wrap): Deleted.
13395         (General_options::General_options): Deleted initializer.
13396         * options.h (options::String_set): New typedef.
13397         (options::parse_set): New function.
13398         (DEFINE_set): New macro.
13399         (General_options::wrap): Changed to use DEFINE_set. Changed
13400         callers of any_wrap_symbols and is_wrap_symbol.
13401         (General_options::trace, General_options::trace_symbol):
13402         New options.
13403         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13404         (General_options::wrap_symbols_): Deleted.
13405         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13406
13407 2008-04-17  David S. Miller  <davem@davemloft.net>
13408
13409         * options.cc (General_options::parse_V): New function.
13410         * options.h: Add entries for -V and -Qy.
13411
13412 2008-04-17  Ian Lance Taylor  <iant@google.com>
13413
13414         * common.cc (Symbol_table::allocate_commons): Remove options
13415         parameter.  Change caller.
13416         (Symbol_table::do_allocate_commons): Remove options parameter.
13417         Change caller.  Just call do_allocate_commons_list twice.
13418         (Symbol_table::do_allocate_commons_list): New function, broken out
13419         of do_allocate_commons.
13420         * common.h (class Allocate_commons_task): Remove options_ field.
13421         Update constructor.
13422         * symtab.cc (Symbol_table::Symbol_table): Initialize
13423         tls_commons_.
13424         (Symbol_table::add_from_object): Put TLS common symbols on
13425         tls_commons_ list.
13426         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13427         which are IN_OUTPUT_DATA.
13428         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13429         allocate_commons and do_allocate_commons declarations.  Declare
13430         do_allocate_commons_list.
13431         * gold.cc (queue_middle_tasks): Update creation of
13432         Allocate_commons_task to not pass options.
13433         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13434         (TLS_TEST_C_FLAGS): New variable.
13435         (tls_test_c_pic.o): New target.
13436         (tls_test_shared.so): Link in tls_test_c_pic.o.
13437         (tls_test_c_pic_ie.o): New target.
13438         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13439         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13440         (tls_test_c.o): New target.
13441         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13442         (tls_pic_test_LDADD): Likewise.
13443         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13444         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13445         (tls_test_c_gnu2.o): New target.
13446         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13447         tls_test_c_gnu2.o.
13448         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13449         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13450         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13451         * testsuite/tls_test.cc: Include "config.h".
13452         (t_last): Call t11_last.
13453         * testsuite/tls_test.h (t11, t11_last): Declare.
13454         * testsuite/tls_test_c.c: New file.
13455         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13456         * configure.ac: Check for OpenMP support.
13457         * configure, config.in, Makefile.in: Rebuild.
13458         * testsuite/Makefile.in: Rebuild.
13459
13460 2008-04-16  Cary Coutant  <ccoutant@google.com>
13461
13462         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13463         (Target_i386::tls_base_symbol_defined_): New field.
13464         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13465         (Target_i386::Scan::global): Likewise.
13466         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13467         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13468         (Target_x86_64::tls_base_symbol_defined_): New field.
13469         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13470         (Target_x86_64::Scan::global): Likewise.
13471
13472 2008-04-16  Cary Coutant  <ccoutant@google.com>
13473
13474         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13475         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13476         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13477         building shared libraries.
13478         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13479         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13480         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13481         * testsuite/Makefile.in: Rebuild.
13482         * testsuite/weak_undef.h: New file.
13483         * testsuite/weak_undef_file1.cc: Add extra test cases.
13484         * testsuite/weak_undef_file2.cc: Likewise.
13485         * testsuite/weak_undef_test.cc: Likewise.
13486
13487 2008-04-16  David S. Miller  <davem@davemloft.net>
13488
13489         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13490         Add issued_non_pic_error_ field.  Declare check_non_pic.
13491         (Target_sparc::Scan::check_non_pic): New function.
13492         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13493         (Target_sparc::Scan::global): Likewise.
13494
13495         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13496         * configure: Rebuild.
13497
13498         * options.h (DEFINE_enable): New macro.
13499         (new_dtags): New enable option.
13500         (initfirst, interpose, loadfltr, nodefaultlib,
13501         nodelete, nodlopen, nodump): New -z options.
13502         * layout.cc (Layout:finish_dynamic_section): If new
13503         dtags enabled, emit DT_RUNPATH.  Also, emit a
13504         DT_FLAGS_1 containing any specified -z flags.
13505
13506 2008-04-16  Ian Lance Taylor  <iant@google.com>
13507
13508         * copy-relocs.cc: New file.
13509         * copy-relocs.h: New file.
13510         * reloc.cc: Remove Copy_relocs code.
13511         * reloc.h: Likewise.
13512         * reloc-types.h (struct Reloc_types) [both versions]: Add
13513         get_reloc_addend_noerror.
13514         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13515         variants of add_global which take an addend which must be zero.
13516         * i386.cc: Include "copy-relocs.h".
13517         (class Target_i386): Change type of copy_relocs_ to variable,
13518         update initializer.
13519         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13520         Change all callers.
13521         (Target_i386::do_finalize_sections): Change handling of
13522         copy_relocs_.
13523         * sparc.cc: Include "copy-relocs.h".
13524         (class Target_sparc): Change type of copy_relocs_ to variable,
13525         update initializer.
13526         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13527         Change all callers.
13528         (Target_sparc::do_finalize_sections): Change handling of
13529         copy_relocs_.
13530         * x86_64.cc: Include "copy-relocs.h".
13531         (class Target_x86_64): Change type of copy_relocs_ to variable,
13532         update initializer.
13533         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13534         class.  Change all callers.
13535         (Target_x86_64::do_finalize_sections): Change handling of
13536         copy_relocs_.
13537         * Makefile.am (CCFILES): Add copy-relocs.cc.
13538         (HFILES): Add copy-relocs.h.
13539
13540         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13541
13542         * testsuite/script_test_4.sh: Permit leading zeroes.
13543
13544 2008-04-15  Ian Lance Taylor  <iant@google.com>
13545
13546         * script-sections.cc (Script_sections::create_segments): Use
13547         header_size_adjustment even when there is enough room for the
13548         headers.
13549         * testsuite/script_test_4.sh: New file.
13550         * testsuite/script_test_4.t: New file.
13551         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13552         (check_DATA): Add script_test_4.stdout.
13553         (MOSTLYCLEANFILES): Likewise.
13554         (script_test_4): New target.
13555         (script_test_4.stdout): New target.
13556         * testsuite/Makefile.in: Rebuild.
13557
13558         * sparc.cc: Add definitions for Output_data_plt_sparc class
13559         constants.
13560
13561 2008-04-14  David S. Miller  <davem@davemloft.net>
13562
13563         * sparc.cc: New file.
13564         * Makefile.am (TARGETSOURCES): Add sparc.cc
13565         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13566         * configure.tgt: Document targ_extra_size and
13567         targ_extra_big_endian.  Add entries for sparc-* and
13568         sparc64-*.
13569         * configure.ac: Handle targ_extra_size and
13570         targ_extra_big_endian.
13571         * Makefile.in: Rebuild.
13572         * configure: Likewise.
13573         * po/POTFILES.in: Likewise.
13574         * po/gold.pot: Likewise.
13575
13576 2008-04-14  Ian Lance Taylor  <iant@google.com>
13577
13578         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13579         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13580         in the name/type/flags to section mapping.  Don't call
13581         allocate_output_section.
13582         (Layout::choose_output_section): Change parameter from adjust_name
13583         to is_input_section.  Don't permit input sections after sections
13584         are attached to segments.  Don't call allocate_output_section.
13585         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13586         not write_enable_output_section.
13587         (Layout::make_output_section): Don't push to
13588         unattached_section_list_ nor call attach_to_segment.  Call
13589         attach_section_to_segment if sections are attached.
13590         (Layout::attach_sections_to_segments): New function.
13591         (Layout::attach_section_to_segment): New function.
13592         (Layout::attach_allocated_section_to_segment): Rename from
13593         attach_to_segment.  Remove flags parameter.
13594         (Layout::allocate_output_section): Remove function.
13595         (Layout::write_enable_output_section): Remove function.
13596         * layout.h (class Layout): Update for above changes.  Add new
13597         field sections_are_attached_.
13598         * output.h (Output_section::update_flags_for_input_section): New
13599         function.
13600         * output.cc (Output_section::add_input_section): Call
13601         update_flags_for_input_section.
13602         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13603
13604 2008-04-11  Cary Coutant  <ccoutant@google.com>
13605
13606         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13607         thought unnecessary.
13608         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13609
13610 2008-04-11  Ian Lance Taylor  <iant@google.com>
13611
13612         * output.h (class Output_section_data): Remove inline definition
13613         of set_addralign.
13614         * output.cc (Output_section_data::set_addralign): New function.
13615
13616 2008-04-11  Cary Coutant  <ccoutant@google.com>
13617
13618         Add support for TLS descriptors for i386 and x86_64.
13619         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13620         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13621         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13622         GOT_TYPE_TLS_DESC.
13623         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13624         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13625         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13626         relocations.
13627         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13628         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13629         Fix problem with initial-exec relocations.
13630         (Target_i386::Relocate::relocate_tls): Likewise.
13631         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13632         relaxation.
13633         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13634         support for section-plus-offset dynamic table entries.
13635         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13636         (Output_data_dynamic::Dynamic_entry): Add support for
13637         section-plus-offset dynamic table entries.
13638         (Output_data_dynamic::Classification): Likewise.
13639         (Output_data_dynamic::classification_): Renamed offset_.
13640         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13641         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13642         (Target_x86_64::make_plt_section): New function.
13643         (Target_x86_64::reserve_tlsdesc_entries): New function.
13644         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13645         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13646         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13647         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13648         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13649         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13650         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13651         add extra PLT entry for TLS descriptors.
13652         (Output_data_plt_x86_64::got_): New field.
13653         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13654         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13655         fields.
13656         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13657         descriptors.
13658         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13659         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13660         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13661         R_386_TLS_DESC_CALL relocations.
13662         (Target_x86_64::Scan::global): Likewise.
13663         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13664         for TLS descriptors.
13665         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13666         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13667         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13668         GD-to-IE relaxation.
13669         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13670         and TLS_DESCRIPTORS.
13671         * Makefile.in: Rebuild.
13672         * configure: Rebuild.
13673         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13674         (tls_test_shared2.so): New target.
13675         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13676         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13677         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13678         (tls_shared_gd_to_ie_test_LDADD): New variable.
13679         (tls_shared_gnu2_gd_to_ie_test): New target.
13680         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13681         New targets.
13682         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13683         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13684         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13685         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13686         (tls_shared_gnu2_test): New target.
13687         (tls_test_gnu2_shared.so): New target.
13688         (tls_shared_gnu2_test_SOURCES): New variable.
13689         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13690         (tls_shared_gnu2_test_LDFLAGS): New variable.
13691         (tls_shared_gnu2_test_LDADD): New variable.
13692         * testsuite/Makefile.in: Rebuild.
13693         * testsuite/Makefile.
13694
13695 2008-04-11  Ian Lance Taylor  <iant@google.com>
13696
13697         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13698         justsyms.t.
13699         * testsuite/Makefile.in: Rebuild.
13700
13701         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13702         long.
13703         * testsuite/script_test_2.cc (main): Adjust test.
13704
13705 2008-04-11  David S. Miller  <davem@davemloft.net>
13706             Ian Lance Taylor  <iant@google.com>
13707
13708         * options.h (General_options): Add entries for '-Y' and
13709         '-relax'.
13710         * options.cc (General_options:finalize): If -Y was used, add those
13711         entries to the library path instead of the default "/lib" and
13712         "/usr/lib".
13713
13714 2008-04-11  David S. Miller  <davem@davemloft.net>
13715
13716         * testsuite/justsyms.t: Start at 0x100.
13717         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13718         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13719         long.
13720         * testsuite/script_test_2.cc: Adjust string and section length
13721         checks.
13722
13723 2008-04-09  Ian Lance Taylor  <iant@google.com>
13724
13725         PR gold/5996
13726         * script-sections.cc (Sections_element::allocate_to_segment): Add
13727         orphan parameter.
13728         (Output_section_definition::allocate_to_segment): Likewise.
13729         (Orphan_output_section::allocate_to_segment): Likewise.
13730         (Script_sections::attach_sections_using_phdrs_clause): Don't
13731         propagate non-PT_LOAD segments to orphan sections.
13732         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13733         readelf rather than objdump.
13734         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13735         .interp section and PT_INTERP segment are the same size.
13736         * testsuite/Makefile.in: Rebuild.
13737
13738         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13739         aliases for symbols defined in the same object.
13740         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13741         (weak_alias_test_SOURCES): New variable.
13742         (weak_alias_test_DEPENDENCIES): New variable.
13743         (weak_alias_test_LDFLAGS): New variable.
13744         (weak_alias_test_LDADD): New variable.
13745         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13746         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13747         (weak_alias_test_3.o): New target.
13748         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13749         * testsuite/weak_alias_test_main.cc: New file.
13750         * testsuite/weak_alias_test_1.cc: New file.
13751         * testsuite/weak_alias_test_2.cc: New file.
13752         * testsuite/weak_alias_test_3.cc: New file.
13753
13754 2008-04-08  Ian Lance Taylor  <iant@google.com>
13755
13756         * options.h (class General_options): Add --noinhibit-exec option.
13757         * main.cc (main): Check --noinhibit-exec.
13758
13759         * options.h (class General_options): Define --wrap as a special
13760         option.  Add wrap_symbols_ field.
13761         (General_options::any_wrap_symbols): New function.
13762         (General_options::is_wrap_symbol): New function.
13763         * options.cc (General_options::parse_wrap): New function.
13764         (General_options::General_options): Initialize wrap_symbols_.
13765         * symtab.cc (Symbol_table::wrap_symbol): New function.
13766         (Symbol_table::add_from_object): Handle --wrap.
13767         * symtab.h (class Symbol_table): Declare wrap_symbol.
13768         * target.h (Target::wrap_char): New function.
13769         (Target::Target_info): Add wrap_char field.
13770         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13771         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13772         * testsuite/testfile.cc (Target_test::test_target_info):
13773         Likewise.
13774
13775         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13776         there is one.
13777
13778         * layout.h (class Layout): Add added_eh_frame_data_ field.
13779         * layout.cc (Layout::Layout): Initialize new field.
13780         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13781         output section until we find a section we merged successfully.
13782         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13783         that the size be non-zero.
13784
13785         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13786         qualifier.
13787
13788 2008-04-08  Craig Silverstein  <csilvers@google.com>
13789
13790         * configure.ac: Export new conditional variable HAVE_ZLIB.
13791         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13792         on HAVE_ZLIB.
13793         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13794         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13795
13796 2008-04-07  Ian Lance Taylor  <iant@google.com>
13797
13798         * version.cc (version_string): Set to "1.5".
13799
13800         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13801         Add issued_non_pic_error_ field.  Declare check_non_pic.
13802         (Target_x86_64::Scan::check_non_pic): New function.
13803         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13804         (Target_x86_64::Scan::global): Likewise.
13805
13806         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13807         addend parameter.  Change caller.  Handle merge sections.
13808         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13809         Address to Addend.  Don't add in the result of
13810         local_section_offset, pass down the addend and use the returned
13811         value.
13812         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13813         Update declarations of local_section_offset and symbol_value.
13814         * testsuite/two_file_test_1.cc (t18): New function.
13815         * testsuite/two_file_test_2.cc (f18): New function.
13816         * testsuite/two_file_test_main.cc (main): Call t18.
13817         * testsuite/two_file_test.h (t18, f18): Declare.
13818
13819         * configure.ac: Don't test for objdump, c++filt, or readelf.
13820         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13821         conditionals.
13822         (TEST_READELF): New variable.
13823         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13824         (check_PROGRAMS): Add two_file_strip_test.
13825         (two_file_strip_test): New target.
13826         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13827         (two_file_same_shared_strip_test_SOURCES): New variable.
13828         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13829         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13830         (two_file_same_shared_strip_test_LDADD): New variable.
13831         (two_file_shared_strip.so): New target.
13832         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13833         (ver_test_5.syms, ver_test_7.syms): Likewise.
13834         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13835         (strip_test_3.stdout): Use TEST_OBJDUMP.
13836         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13837
13838 2008-04-04  Cary Coutant  <ccoutant@google.com>
13839
13840         * symtab.h (Symbol::is_weak_undefined): New function.
13841         (Symbol::is_strong_undefined): New function.
13842         (Symbol::is_absolute): New function.
13843         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13844         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13845         absolute symbols.
13846         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13847         (weak_undef_test): New target.
13848         * testsuite/Makefile.in: Rebuild.
13849         * testsuite/weak_undef_file1.cc: New file.
13850         * testsuite/weak_undef_file2.cc: New file.
13851         * testsuite/weak_undef_test.cc: New file.
13852
13853 2008-04-03  Craig Silverstein  <csilvers@google.com>
13854
13855         * compressed_output.h (class Output_compressed_section): Use
13856         unsigned buffer.
13857         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13858         add zlib header.
13859         (zlib_compressed_suffix): Removed.
13860         (Output_compressed_section::set_final_data_size): Use unsigned
13861         buffers.
13862         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13863         Fix linker invocation.
13864         (flagstest_o_specialfile_and_compress_debug_sections):
13865         Likewise.
13866         * testsuite/Makefile.in: Regenerated.
13867
13868 2008-04-02  David S. Miller  <davem@davemloft.net>
13869
13870         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13871         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13872
13873 2008-04-02  Craig Silverstein  <csilvers@google.com>
13874
13875         * TODO: New file.
13876
13877 2008-04-02  Ian Lance Taylor  <iant@google.com>
13878
13879         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13880         parameters.  Update for new key type to views_.  Change all
13881         callers.
13882         (File_read::read): Adjust for byteshift in returned view.
13883         (File_read::add_view): New function, broken out of
13884         find_and_make_view.
13885         (File_read::make_view): New function, broken out of
13886         find_and_make_view.
13887         (File_read::find_or_make_view): Add offset and aligned
13888         parameters.  Rewrite accordingly.  Change all callers.
13889         (File_read::get_view): Add offset and aligned parameters.  Adjust
13890         for byteshift in return value.
13891         (File_read::get_lasting_view): Likewise.
13892         * fileread.h (class File_read): Update declarations.
13893         (class File_read::View): Add byteshift_ field.  Add byteshift to
13894         constructor.  Add byteshift method.
13895         * archive.h (Archive::clear_uncached_views): New function.
13896         (Archive::get_view): Add aligned parameter.  Change all callers.
13897         * object.h (Object::get_view): Add aligned parameter.  Change all
13898         callers.
13899         (Object::get_lasting_view): Likewise.
13900
13901         * fileread.cc (File_read::release): Don't call clear_views if
13902         there are multiple objects.
13903         * fileread.h (File_read::clear_uncached_views): New function.
13904         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13905         on the archive.
13906
13907 2008-03-31  Cary Coutant  <ccoutant@google.com>
13908
13909         Add thin archive support.
13910         * archive.cc (Archive::armagt): New const.
13911         (Archive::setup): Remove task parameter and calls to unlock.
13912         (Archive::unlock_nested_archives): New function.
13913         (Archive::read_header): Add nested_off parameter. Change
13914         all callers.
13915         (Archive::interpret_header): Likewise.
13916         (Archive::include_all_members): Change to handle thin
13917         archives.
13918         (Archive::include_member): Likewise.
13919         * archive.h (Archive::Archive): Add new parameters and
13920         initializers.
13921         (Archive::armagt): New const.
13922         (Archive::setup): Remove task parameter.
13923         (Archive::unlock_nested_archives): New function.
13924         (Archive::read_header): Add nested_off parameter.
13925         (Archive::interpret_header): Likewise.
13926         (Archive::Nested_archive_table): New typedef.
13927         (Archive::is_thin_archive_): New field.
13928         (Archive::nested_archives_): New field.
13929         (Archive::options_): New field.
13930         (Archive::dirpath_): New field.
13931         (Archive::task_): New field.
13932         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13933         for thin archives.  Pass additional parameters to
13934         Archive::Archive.  Unlock the archive file after calling
13935         Archive::setup.
13936
13937 2008-03-29  Ian Lance Taylor  <iant@google.com>
13938
13939         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13940         version symbol to be local.
13941         * testsuite/ver_test_4.sh: New file.
13942         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13943         (check_DATA): Add ver_test_4.syms.
13944         (ver_test_4.syms): New target.
13945         * testsuite/Makefile.in: Rebuild.
13946
13947         * output.cc
13948         (Output_section::Input_section_sort_entry::has_priority): New
13949         function.
13950         (Output_section::Input_section_sort_entry::match_file_name): New
13951         function.
13952         (Output_section::Input_section_sort_entry::match_section_name):
13953         Remove.
13954         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13955         Remove.
13956         (Output_section::Input_section_sort_entry::match_section_file):
13957         Remove.
13958         (Output_section::Input_section_sort_compare::operator()): Rewrite
13959         using new Input_section_sort_entry functions.  Sort crtbegin and
13960         crtend first.  Sort sections with no priority before sections with
13961         a priority.
13962         * testsuite/initpri1.c (d3): Check j != 4.
13963         (cd5): New constructor/destructor function.
13964         (main): Check j != 2.
13965
13966         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13967         new symbol when resolving, don't call set_is_default.
13968         * testsuite/ver_test_7.cc: New file.
13969         * testsuite/ver_test_7.sh: New file.
13970         * testsuite/Makefile.am (ver_test_7.so): New target.
13971         (ver_test_7.o): New target.
13972         (check_SCRIPTS): Add ver_test_7.sh.
13973         (check_DATA): Add ver_test_7.syms.
13974         (ver_test_7.syms): New target.
13975
13976 2008-03-28  Ian Lance Taylor  <iant@google.com>
13977
13978         * layout.cc (Layout::layout): If we see an input section with a
13979         name that needs sorting, set the must_sort flag for the output
13980         section.
13981         (Layout::make_output_section): If the name of the output section
13982         indicates that it might require sorting, set the may_sort flag.
13983         * output.h (Output_section::may_sort_attached_input_sections): New
13984         function.
13985         (Output_section::set_may_sort_attached_input_sections): New
13986         function.
13987         (Output_section::must_sort_attached_input_sections): New
13988         function.
13989         (Output_section::set_must_sort_attached_input_sections): New
13990         function.
13991         (class Output_section): Declare Input_section_sort_entry.  Define
13992         Input_section_sort_compare.  Declare
13993         sort_attached_input_sections.  Add new fields:
13994         may_sort_attached_input_sections_,
13995         must_sort_attached_input_sections_,
13996         attached_input_sections_are_sorted_.
13997         * output.cc (Output_section::Output_section): Initialize new
13998         fields.
13999         (Output_section::add_input_section): Add an entry to
14000         input_sections_ if may_sort or must_sort are true.
14001         (Output_section::set_final_data_size): Call
14002         sort_attached_input_sections if necessary.
14003         (Output_section::Input_section_sort_entry): Define new class.
14004         (Output_section::Input_section_sort_compare::operator()): New
14005         function.
14006         (Output_section::sort_attached_input_sections): New function.
14007         * configure.ac: Check whether the compiler supports constructor
14008         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14009         * testsuite/initpri1.c: New file.
14010         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14011         CONSTRUCTOR_PRIORITY.
14012         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14013         (initpri1_LDFLAGS): New variable.
14014         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14015
14016 2008-03-27  Ian Lance Taylor  <iant@google.com>
14017
14018         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14019         * testsuite/common_test_1.c: New file.
14020         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14021         (common_test_1_SOURCES): New variable.
14022         (common_test_1_DEPENDENCIES): New variable.
14023         (common_test_1_LDFLAGS): New variable.
14024
14025         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14026         and commons_ correctly when NAME/VERSION does not override
14027         NAME/NULL.
14028         * testsuite/ver_test_6.c: New file.
14029         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14030         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14031         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14032
14033 2008-03-26  Ian Lance Taylor  <iant@google.com>
14034
14035         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14036         of an undefined symbol from a version script.
14037         * testsuite/Makefile.am (ver_test_5.so): New target.
14038         (ver_test_5.o): New target.
14039         (check_SCRIPTS): Add ver_test_5.sh.
14040         (check_DATA): Add ver_test_5.syms.
14041         (ver_test_5.syms): New target.
14042         * testsuite/ver_test_5.cc: New file.
14043         * testsuite/ver_test_5.script: New file.
14044         * testsuite/ver_test_5.sh: New file.
14045         * Makefile.in, testsuite/Makefile.in: Rebuild.
14046
14047         PR gold/5986
14048         Fix problems building gold with gcc 4.3.0.
14049         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14050         (gold_error_at_location, gold_warning_at_location): Use it.
14051         * configure.ac: Check whether we can compile and use a template
14052         function with a printf attribute.
14053         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14054         when jumping over bytes.
14055         * object.cc: Instantiate Object::read_section_data.
14056         * debug.h: Include <cstring>
14057         * dwarf_reader.cc: Include <algorithm>
14058         * main.cc: Include <cstring>.
14059         * options.cc: Include <cstring>.
14060         * output.cc: Include <cstring>.
14061         * script.cc: Include <cstring>.
14062         * script.h: Include <string>.
14063         * symtab.cc: Include <cstring> and <algorithm>.
14064         * target-select.cc: Include <cstring>.
14065         * version.cc: Include <string>.
14066         * testsuite/testmain.cc: Include <cstdlib>.
14067         * configure, config.in: Rebuild.
14068
14069 2008-03-25  Ian Lance Taylor  <iant@google.com>
14070
14071         * options.cc: Include "../bfd/bfdver.h".
14072         (options::help): Print bug reporting address.
14073
14074         * version.cc (print_version): Adjust output for current value of
14075         BFD_VERSION_STRING.
14076
14077         * NEWS: New file.
14078
14079         * options.cc (options::help): Print list of supported targets.
14080         * target-select.h: Include <vector>.
14081         (class Target_selector): Make machine_, size_, and is_big_endian_
14082         fields const.  Add bfd_name_ and instantiated_target_ fields.
14083         (Target_selector::Target_selector): Add bfd_name parameter.
14084         (Target_selector::recognize): Make non-virtual, call
14085         do_recognize.
14086         (Target_selector::recognize_by_name): Make non-virtual, call
14087         do_recognize_by_name.
14088         (Target_selector::supported_names): New function.
14089         (Target_selector::bfd_name): New function.
14090         (Target_selector::do_instantiate_target): New pure virtual
14091         function.
14092         (Target_selector::do_recognize): New virtual function.
14093         (Target_selector::do_recognize_by_name): New virtual function.
14094         (Target_selector::instantiate_target): New private function.
14095         (supported_target_names): Declare.
14096         * target-select.cc (Target_selector::Target_selector): Update for
14097         new parameter and fields.
14098         (select_target_by_name): Check that the name matches before
14099         calling recognize_by_name.
14100         (supported_target_names): New function.
14101         * i386.cc (class Target_selector_i386): Update Target_selector
14102         constructor call.  Remove recognize and recognize_by_name.  Add
14103         do_instantiate_target.
14104         * x86_64.cc (class Target_selector_x86_64): Likewise.
14105         * testsuite/testfile.cc (class Target_selector_test): Update for
14106         changes to Target_selector.
14107
14108         * README: Rewrite, with some notes on unsupported features.
14109
14110 2008-03-24  Cary Coutant  <ccoutant@google.com>
14111
14112         * i386.cc (Target_i386::Got_type): New enum declaration.
14113         (Target_i386::Scan::local): Updated callers of Output_data_got
14114         member functions.
14115         (Target_i386::Scan::global): Likewise.
14116         (Target_i386::Relocate::relocate): Likewise.
14117         (Target_i386::Relocate::relocate_tls): Likewise.
14118         * object.h (Got_offset_list): New class.
14119         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14120         (Sized_relobj::local_got_offset): Likewise.
14121         (Sized_relobj::set_local_got_offset): Likewise.
14122         (Sized_relobj::local_has_tls_got_offset): Removed.
14123         (Sized_relobj::local_tls_got_offset): Removed.
14124         (Sized_relobj::set_local_tls_got_offset): Removed.
14125         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14126         * output.cc (Output_data_got::add_global): Added got_type parameter.
14127         (Output_data_got::add_global_with_rel): Likewise.
14128         (Output_data_got::add_global_with_rela): Likewise.
14129         (Output_data_got::add_global_pair_with_rel): New function.
14130         (Output_data_got::add_global_pair_with_rela): New function.
14131         (Output_data_got::add_local): Added got_type parameter.
14132         (Output_data_got::add_local_with_rel): Likewise.
14133         (Output_data_got::add_local_with_rela): Likewise.
14134         (Output_data_got::add_local_pair_with_rel): New function.
14135         (Output_data_got::add_local_pair_with_rela): New function.
14136         (Output_data_got::add_global_tls): Removed.
14137         (Output_data_got::add_global_tls_with_rel): Removed.
14138         (Output_data_got::add_global_tls_with_rela): Removed.
14139         (Output_data_got::add_local_tls): Removed.
14140         (Output_data_got::add_local_tls_with_rel): Removed.
14141         (Output_data_got::add_local_tls_with_rela): Removed.
14142         * output.h (Output_data_got::add_global): Added got_type parameter.
14143         (Output_data_got::add_global_with_rel): Likewise.
14144         (Output_data_got::add_global_with_rela): Likewise.
14145         (Output_data_got::add_global_pair_with_rel): New function.
14146         (Output_data_got::add_global_pair_with_rela): New function.
14147         (Output_data_got::add_local): Added got_type parameter.
14148         (Output_data_got::add_local_with_rel): Likewise.
14149         (Output_data_got::add_local_with_rela): Likewise.
14150         (Output_data_got::add_local_pair_with_rel): New function.
14151         (Output_data_got::add_local_pair_with_rela): New function.
14152         (Output_data_got::add_global_tls): Removed.
14153         (Output_data_got::add_global_tls_with_rel): Removed.
14154         (Output_data_got::add_global_tls_with_rela): Removed.
14155         (Output_data_got::add_local_tls): Removed.
14156         (Output_data_got::add_local_tls_with_rel): Removed.
14157         (Output_data_got::add_local_tls_with_rela): Removed.
14158         * resolve.cc (Symbol::override_base_with_special): Removed
14159         reference to has_got_offset_ field.
14160         * symtab.cc (Symbol::init_fields): Replaced initialization
14161         of got_offset_ with got_offsets_.  Removed initialization
14162         of has_got_offset_
14163         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14164         (Symbol::got_offset): Likewise.
14165         (Symbol::set_got_offset): Likewise.
14166         (Symbol::has_tls_got_offset): Removed.
14167         (Symbol::tls_got_offset): Removed.
14168         (Symbol::set_tls_got_offset): Removed.
14169         (Symbol::got_offset_): Removed.
14170         (Symbol::tls_mod_got_offset_): Removed.
14171         (Symbol::tls_pair_got_offset_): Removed.
14172         (Symbol::got_offsets_): New field.
14173         (Symbol::has_got_offset): Removed.
14174         (Symbol::has_tls_mod_got_offset): Removed.
14175         (Symbol::has_tls_pair_got_offset): Removed.
14176         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14177         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14178         member functions.
14179         (Target_x86_64::Scan::global): Likewise.
14180         (Target_x86_64::Relocate::relocate): Likewise.
14181         (Target_x86_64::Relocate::relocate_tls): Likewise.
14182
14183 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14184
14185         * yyscript.y: Fix spelling error in comment.
14186
14187 2008-03-24  Ian Lance Taylor  <iant@google.com>
14188
14189         * options.h (class General_options): Define build_id option.
14190         * layout.h (class Layout): Declare write_build_id, create_note,
14191         create_build_id.  Add build_id_note_ member.
14192         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14193         "libiberty.h", "md5.h", "sha1.h".
14194         (Layout::Layout): Initialize eh_frame_data_,
14195         eh_frame_hdr_section_, and build_id_note_.
14196         (Layout::finalize): Call create_build_id.
14197         (Layout::create_note): New function, broken out of
14198         Layout::create_gold_note.
14199         (Layout::create_gold_note): Call create_note.
14200         (Layout::create_build_id): New function.
14201         (Layout::write_build_id): New function.
14202         (Close_task_runner::run): Call write_build_id.
14203
14204         * x86_64.cc: Correct license to GPLv3.
14205
14206 2008-03-23  Ian Lance Taylor  <iant@google.com>
14207
14208         * options.cc: Include "demangle.h".
14209         (parse_optional_string): New function.
14210         (parse_long_option): Handle takes_optional_argument.
14211         (parse_short_option): Update dash_z initializer.  Handle
14212         takes_optional_argument.
14213         (General_options::General_options): Initialize do_demangle_.
14214         (General_options::finalize): Set do_demangle_.  Handle demangling
14215         style.
14216         * options.h (parse_optional_string): Declare.
14217         (struct One_option): Add optional_arg field.  Update constructor.
14218         Update call constructor calls.  Add takes_optional_argument
14219         function.
14220         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14221         (DEFINE_optional_string): Define.
14222         (General_options::demangle): Change from DEFINE_bool to
14223         DEFINE_optional_string.
14224         (General_options::no_demangle): New function.
14225         (General_options::do_demangle): New function.
14226         (General_options::set_do_demangle): New function.
14227         (General_options::execstack_status_): Move definition to end of
14228         class definition.
14229         (General_options::static_): Likewise.
14230         (General_options::do_demangle_): New field.
14231         * object.cc (big_endian>::get_symbol_location_info): Call
14232         Options::do_demangle, not Options::demangle.
14233         * symtab.cc (demangle): Likewise.
14234
14235 2008-03-22  Ian Lance Taylor  <iant@google.com>
14236
14237         * gold.h: Include <cstddef> and <sys/types.h>
14238         * options.h: Include <cstring>.
14239
14240 2008-03-21  Ian Lance Taylor  <iant@google.com>
14241
14242         * Added source code to GNU binutils.
14243 \f
14244 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14245
14246 Copying and distribution of this file, with or without modification,
14247 are permitted in any medium without royalty provided the copyright
14248 notice and this notice are preserved.
14249
14250 Local Variables:
14251 mode: change-log
14252 left-margin: 8
14253 fill-column: 74
14254 version-control: never
14255 End: