Add -fuse-ld= for GCC linker option compatibility
[platform/upstream/binutils.git] / gold / ChangeLog
1 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2
3         * options.h (General_options): Add -fuse-ld= for GCC linker
4         option compatibility.
5
6 2013-01-04  Cary Coutant  <ccoutant@google.com>
7
8         * configure.ac: Fix typo restoring CXXFLAGS.
9         * configure: Regenerate.
10
11 2013-01-04  Cary Coutant  <ccoutant@google.com>
12
13         * testsuite/Makefile.am (CXXLINK_S): New macro.
14         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
15         * testsuite/Makefile.in: Regenerate.
16
17 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
18
19         * version.cc (print_version): Update copyright year to 2013.
20
21 2012-12-20  Ian Lance Taylor  <iant@google.com>
22
23         * layout.cc (Layout::special_ordering_of_input_section): New
24         function.
25         (Layout::layout): If input section requires special ordering, must
26         sort input sections.
27         (Layout::make_output_section): May sort .text input sections.
28         (Layout::is_section_name_prefix_grouped): Remove.
29         * layout.h (class Layout): Declare
30         special_ordering_of_input_section.  Don't declare
31         is_section_name_prefix_grouped.
32         * output.cc (Output_section::add_input_section): Revert last
33         change.
34         (Output_section::Input_section_sort::match_file_name): Don't crash
35         if called on output section data.
36         (Output_section::Input_section_sort_compare): Sort based on
37         special ordering.
38         (Output_section::Input_section_sort_section_order_index_compare):
39         Revert last patch.
40         (Output_section::sort_attached_input_sections): Likewise.
41
42 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
43
44         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
45         * layout.h (Layout::is_section_name_prefix_grouped): New function.
46         * output.cc (Output_section::add_input_section): Check if section
47         name contains special prefix.  Keep input sections to sort such
48         sections.
49         (Output_section::Input_section_sort_section_order_index_compare
50          ::operator()): Group sections according to prefixes.
51         (Output_section::sort_attached_input_sections): Add condition to
52         Input_section_entry constructor call.
53         * testsuite/Makefile.am (text_section_grouping): New test.
54         * testsuite/Makefile.in: Regenerate.
55         * testsuite/text_section_grouping.cc: New file.
56         * testsuite/text_section_grouping.sh: New file.
57
58 2012-12-17  Nick Clifton  <nickc@redhat.com>
59
60         * Makefile.am: Add copyright notice.
61         * NEWS: Likewise.
62         * README: Likewise.
63         * configure.ac: Likewise.
64         * ftruncate.c: Likewise.
65         * Makefile.in: Regenerate.
66
67 2012-12-14  Cary Coutant  <ccoutant@google.com>
68
69         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
70         --no-as-needed flag.
71         (exception_separate_shared_12_test): Likewise.
72         (incremental_copy_test): Likewise.
73         * testsuite/Makefile.in: Regenerate.
74
75 2012-12-14  Cary Coutant  <ccoutant@google.com>
76
77         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
78         (Dwp_output_file::Dwp_index::enter_set): Add assert.
79
80 2012-12-12  Alan Modra  <amodra@gmail.com>
81
82         * powerpc.cc (class Track_tls): New.
83         (class Relocate, class Scan): Inherit Track_tls.
84         (Target_powerpc::Scan::local, global): Track tls optimization
85         and avoid creating plt entry for __tls_get_addr if all uses
86         are optimized away.
87         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
88
89 2012-12-12  Alan Modra  <amodra@gmail.com>
90
91         * options.h (General_options): Add --toc-sort/--no-toc-sort.
92         Replace no_toc_optimize with toc_optimize.
93         * output.h (Output_section::input_sections): Provide non-const variant.
94         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
95         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
96         accessors.
97         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
98         (class Sort_toc_sections): New.
99         (Target_powerpc::do_finalize_sections): Sort toc sections.
100         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
101
102 2012-12-10  Roland McGrath  <mcgrathr@google.com>
103
104         * testsuite/binary_unittest.cc (read_all): New function.
105         (Sized_binary_test): Use it instead of ::read.
106         * fileread.cc (do_read): Don't assume pread always reads the whole
107         amount in a single call.
108
109 2012-12-10  Alan Modra  <amodra@gmail.com>
110
111         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
112         Set EM_PPC64 or EM_PPC here.
113         (Target_selector_powerpc::do_recognize): Delete.
114
115 2012-12-10  Alan Modra  <amodra@gmail.com>
116
117         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
118         stub_table_.
119         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
120
121 2012-12-07  Roland McGrath  <mcgrathr@google.com>
122
123         * testsuite/binary_unittest.cc (Sized_binary_test):
124         Use open_descriptor rather than ::open.
125
126 2012-12-07  Alan Modra  <amodra@gmail.com>
127
128         * powerpc.cc (Stub_table::do_write): Delete redundant Address
129         typedef and invalid_address constant.
130         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
131         instantiate constants.
132
133 2012-12-06  Roland McGrath  <mcgrathr@google.com>
134
135         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
136         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
137         * aclocal.m4: Regenerate.
138         * configure: Regenerate.
139         * Makefile.in: Regenerate.
140         * testsuite/Makefile.in: Regenerate.
141
142 2012-12-07  Alan Modra  <amodra@gmail.com>
143
144         * options.h (General_options): Add no_toc_optimize.
145         * powerpc.cc (ok_lo_toc_insn): New function.
146         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
147
148 2012-12-06  Alan Modra  <amodra@gmail.com>
149
150         * options.h (General_options): Add plt_align, plt_static_chain,
151         plt_thread_safe.  Update stub_group_size help text.
152         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
153         for new plt_thread_safe_ var.
154         (use_plt_offset): Correct comments.
155         (Target_powerpc::do_relax): Look for thread creation symbols to
156         determine default plt_thread_safe value.  Clear plt call stubs
157         as well as branch stubs each iteration.
158         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
159         insn constants.
160         (l, hi, ha, write_insn): Move earlier.
161         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
162         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
163         plt stubs too.
164         (Stub_table::update_size): Adjust.
165         (Stub_table::prev_size, set_prev_size): Delete.
166         (Stub_table::stub_align): Let --plt-align affect result.
167         (Stub_table::plt_call_size): Calculate sizes for various stubs.
168         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
169         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
170         (Stub_table::do_write): Support more stub variants.
171
172 2012-12-04  Alan Modra  <amodra@gmail.com>
173
174         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
175         (Target_powerpc::do_define_standard_symbols): New function.
176
177 2012-12-03  Alan Modra  <amodra@gmail.com>
178
179         * output.h: Formatting, whitespace.
180
181 2012-12-03  Alan Modra  <amodra@gmail.com>
182
183         * layout.h (Layout::get_executable_sections): Declare.
184         * layout.cc (Layout::get_executable_sections): New function.
185         * arm.cc (Target_arm::group_sections): Use it.
186         (Arm_output_section::group_sections): Delete now redundant test.
187         * output.cc (Output_reloc::Output_reloc): Add is_relative.
188         param to handle relative relocs.
189         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
190         (Output_data_reloc::add_absolute): Adjust.
191         (Output_data_reloc::add_relative): New function.
192         (Output_data::reset_data_size): New function.
193         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
194         (Output_section::set_addralign): New function.
195         (Output_section::checkpoint_set_addralign): New function.
196         (Output_section::clear_section_offsets_need_adjustment): New function.
197         (Output_section::input_sections): Make public.
198         * powerpc.cc (class Output_data_brlt_powerpc): New.
199         (class Stub_table, class Stub_control): New.
200         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
201         stub_table_, set_stub_table, stub_table): New vectors and accessor
202         functions.
203         (Target_powerpc::do_may_relax, do_relax, push_branch,
204         new_stub_table, stub_tables, brlt_section, group_sections,
205         add_branch_lookup_table, find_branch_lookup_table,
206         write_branch_lookup_table, make_brlt_section): New functions.
207         (Target_powerpc::struct Sort_sections, class Branch_info): New.
208         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
209         branch_info_): New vars.
210         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
211         make call stubs here.
212         (Output_data_glink): Remove all call stub handling from this class.
213         (Target_powerpc::Scan::local, global): Save interesting branch
214         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
215         (Target_powerpc::do_finalize_sections): Only make reg save/restore
216         functions on final link.
217         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
218         Handle long branch destinations too.
219         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
220         do_plt_address_for_local): Adjust lookup of plt call stubs.
221
222 2012-11-30  Alan Modra  <amodra@gmail.com>
223
224         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
225         relocs against protected symbols when building 32-bit shared libs.
226
227 2012-11-30  Alan Modra  <amodra@gmail.com>
228
229         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
230         param.  Call got_section() to make .got.  Update all callers
231         and their callers and so on.
232
233 2012-11-30  Alan Modra  <amodra@gmail.com>
234
235         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
236         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
237         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
238         value if it already exists.
239
240 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
241
242         PR gold/14858
243         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
244
245 2012-11-14  Roland McGrath  <mcgrathr@google.com>
246
247         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
248         than bfc instruction for data sandboxing.
249
250 2012-11-08  Alan Modra  <amodra@gmail.com>
251
252         * po/POTFILES.in: Regenerate.
253
254 2012-11-05  Alan Modra  <amodra@gmail.com>
255
256         * configure.ac: Apply 2012-09-10 change to config.in here.
257         * configure: Regenerate.
258
259 2012-11-05  Alan Modra  <amodra@gmail.com>
260
261         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
262         (struct Opd_ent): Use "Address" rather than "Offset".
263         (Output_data_got_powerpc::got_base_offset): Return Valtype.
264         (Target_powerpc::got_section): Make public.
265         (Target_powerpc::scan_relocs): Move code setting symbols..
266         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
267         Create _SDA_BASE_ only when referenced.
268
269 2012-11-02  Roland McGrath  <mcgrathr@google.com>
270
271         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
272         from last change.
273
274 2012-11-01  Roland McGrath  <mcgrathr@google.com>
275
276         * target.h (Sized_target::relocate_relocs): Use Elf_Off
277         for offset_in_output_section parameter.
278         (Sized_target::relocate_special_relocatable): Likewise.
279         * arm.cc (Target_arm::relocate_relocs): Likewise.
280         (Target_arm::relocate_special_relocatable): Likewise.
281         * i386.cc (Target_i386::relocate_relocs): Likewise.
282         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
283         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
284         * target-reloc.h (relocate_relocs): Likewise.
285         * testsuite/testfile.cc (Target_test): Likewise.
286         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
287         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
288
289         * system.h: Move inclusion of <clocale> to after <libintl.h> in
290         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
291
292         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
293         parameter, which is unused in the [!F_SETFD] case.
294
295         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
296         SYMNDX to off_t before comparing it to this->data_size().
297         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
298         * incremental.cc (Output_section_incremental_inputs::do_write):
299         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
300
301         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
302
303 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
304
305         * gold.cc (Target_arm::do_adjust_elf_header): Add the
306         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
307         in EABI_VER5.
308
309 2012-10-29  Cary Coutant  <ccoutant@google.com>
310
311         * dwp.cc (usage): Add file and exit status parameters;
312         add --help and --version options.
313         (print_version): New function.
314         (main): Add --help and --version options.
315
316 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
317
318         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
319         final_layout_sequence.txt.
320         * testsuite/Makefile.in: Regenerated.
321
322 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
323
324         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
325         COMPILE generated by automake.
326         (LINK1): Likewise.
327         (CXXCOMPILE1): Likewise.
328         (CXXLINK1): Likewise.
329         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
330         (LINK): Likewise.
331         (CXXCOMPILE): Likewise.
332         (CXXLINK): Likewise.
333         * testsuite/Makefile.in: Regenerated.
334
335 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
336
337         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
338         on bad fwrite return.
339
340 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
341
342         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
343         on val.
344
345 2012-10-23  Cary Coutant  <ccoutant@google.com>
346
347         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
348         * testsuite/Makefile.in: Regenerate.
349         * testsuite/dwp_test.h: New source file.
350         * testsuite/dwp_test_1.cc: New source file.
351         * testsuite/dwp_test_1.s: New source file.
352         * testsuite/dwp_test_1.sh: New source file.
353         * testsuite/dwp_test_1b.cc: New source file.
354         * testsuite/dwp_test_1b.s: New source file.
355         * testsuite/dwp_test_2.cc: New source file.
356         * testsuite/dwp_test_2.s: New source file.
357         * testsuite/dwp_test_2.sh: New source file.
358         * testsuite/dwp_test_main.cc: New source file.
359         * testsuite/dwp_test_main.s: New source file.
360
361 2012-10-23  Cary Coutant  <ccoutant@google.com>
362
363         * dwp.h: New header file.
364         * dwp.cc: New source file.
365         * gold.h: Move shared declarations to system.h.
366         * system.h: New header file.
367         * Makefile.am: Add dwp.
368         * Makefile.in: Regenerate.
369
370 2012-10-23  Cary Coutant  <ccoutant@google.com>
371
372         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
373         Dwarf_info_reader::read_from_pointer.
374         (Dwarf_pubnames_table::read_header): Likewise.
375         (Dwarf_pubnames_table::next_name): Likewise.
376         (Dwarf_die::read_attributes): Likewise.
377         (Dwarf_die::skip_attributes): Likewise.
378         (Dwarf_info_reader::read_from_pointer): New function template.
379         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
380         (Dwarf_pubnames_table): Likewise.
381         (Dwarf_info_reader::read_from_pointer): New function template.
382         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
383         Dwarf_pubnames_table ctor.
384
385 2012-10-23  Cary Coutant  <ccoutant@google.com>
386
387         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
388         abbrev_shndx.
389         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
390         abbrev_shndx_.
391         (Dwarf_info_reader::set_abbrev_shndx): New method.
392         (Dwarf_info_reader::abbrev_shndx_): New data member.
393
394 2012-10-23  Cary Coutant  <ccoutant@google.com>
395
396         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
397         from object, not parameters.
398         (Dwarf_info_reader::parse): Likewise.
399         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
400         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
401         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
402         methods.
403
404 2012-10-23  Cary Coutant  <ccoutant@google.com>
405
406         * fileread.cc (Input_file::Input_file): New constructor.
407         * fileread.h (class Input_file): Add new constructor.
408
409 2012-10-18  Alan Modra  <amodra@gmail.com>
410
411         PR gold/14727
412         * object.cc (Relobj::is_section_name_included): Also match
413         .sdata personality section.
414
415 2012-10-18  Alan Modra  <amodra@gmail.com>
416
417         * target-reloc.h (class Default_comdat_behavior): New, package up..
418         (get_comdat_behaviour): ..this.
419         (relocate_section): Add Relocate_comdat_behavior template arg,
420         adjust code to suit.
421         * arm.cc (Target_arm::relocate_section): Adjust to suit.
422         (Target_arm::scan_reloc_section): Likewise.
423         * i386.cc (Target_i386::relocate_section): Likewise.
424         * sparc.cc (Target_sparc::relocate_section): Likewise.
425         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
426         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
427         * powerpc.cc (class Relocate_comdat_behavior): New.
428         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
429         gold::relocate_section with new template arg.
430
431 2012-10-18  Alan Modra  <amodra@gmail.com>
432
433         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
434         dynamic relocs for GOT_TPREL got entries, without symbol if
435         resolving locally.
436         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
437         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
438         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
439
440 2012-10-17  Alan Modra  <amodra@gmail.com>
441
442         PR gold/14726
443         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
444
445 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
446
447         * layout.cc (Layout::include_section): Keep sections marked
448         SHF_EXCLUDE when doing relocatable links.
449
450 2012-10-16  Alan Modra  <amodra@gmail.com>
451
452         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
453         (Target_powerpc::do_finalize_sections): Call it.
454         (Output_data_save_res): New class and supporting functions.
455         (Target_powerpc::symval_for_branch): Only look up .opd entry for
456         normal symbols defined in object files.
457
458 2012-10-12  Alan Modra  <amodra@gmail.com>
459
460         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
461         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
462         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
463         section if scan_opd_relocs not yet called.
464         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
465
466 2012-10-12  Alan Modra  <amodra@gmail.com>
467
468         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
469         add_local_ifunc_entry): Revert last change.
470         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
471
472 2012-10-05  Alan Modra  <amodra@gmail.com>
473
474         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
475         do_plt_address_for_global): New functions.
476         (Output_data_got_powerpc::do_write): Don't segfault when linking
477         statically.
478         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
479         add_local_ifunc_entry): Return true on adding entry..
480         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
481         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
482         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
483         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
484         set up symbols here.
485         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
486         syms here.  Do so even when no .iplt.  Don't segfault when linking
487         statically.
488         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
489         new variants without reloc param.
490         (Glink_sym_ent::Glink_sym_ent): Likewise.
491         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
492         reloc when refs will resolve to plt call stub.
493         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
494         R_PPC_PLTREL24 to resolve locally.
495         (Target_powerpc::Scan::global): Correct ifunc handling.
496         (Target_powerpc::Relocate::relocate): Correct local sym glink
497         lookup.  Don't destroy "value" when we have a plt call stub,
498         and when checking plt call validity.
499         (Target_powerpc::do_dynsym_value): Simplify.
500
501 2012-10-05  Alan Modra  <amodra@gmail.com>
502
503         * i386.cc (Output_data_plt_i386::address_for_global,
504         address_for_local): Add plt offset to returned value.  Adjust uses.
505         * sparc.cc (Output_data_plt_sparc::address_for_global,
506         address_for_local): Likewise.
507         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
508         address_for_local): Likewise.
509         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
510         address_for_local): Likewise.
511         * target.h (Target::plt_address_for_global, plt_address_for_local):
512         Update comment.
513         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
514         (Output_data_got::Got_entry::write): Nor here.
515         * output.h: Comment fix.
516
517 2012-10-02  Jiong Wang  <jiwang@tilera.com>
518
519         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
520         global_offset_table_ value for larget got.
521         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
522
523 2012-09-29  Alan Modra  <amodra@gmail.com>
524
525         * powerpc.cc (Target_powerpc::iplt_): New output section.
526         (Target_powerpc::iplt_section, make_iplt_section,
527         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
528         (Target_powerpc::make_plt_entry): Handle ifunc syms.
529         Target_powerpc::plt_entry_count): Count iplt entries too.
530         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
531         reloc section in constructor.  New params.
532         (Target_powerpc::make_plt_section): Create reloc section here instead.
533         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
534         functions.
535         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
536         (Output_data_glink::add_entry, find_entry): New functions to
537         deal with local syms.
538         (Glink_sym_ent): Add support for local syms.
539         (Output_data_glink::do_write): Handle ifunc plt entries.
540         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
541         (Target_powerpc::Scan::local, global): Handle ifunc syms.
542         (Target_powerpc::Relocate::relocate): Likewise.
543         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
544
545 2012-09-25  Alan Modra  <amodra@gmail.com>
546
547         * object.h (Sized_relobj_file::adjust_local_symbol,
548         do_adjust_local_symbol): New functions.
549         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
550         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
551         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
552         and irregular opd entry spacing.
553         (Powerpc_relobj::do_read_relocs): Add opd size checks.
554         (Global_symbol_visitor_opd): New functor.
555         (Target_powerpc::do_finalize_sections): Omit global symbols defined
556         on deleted opd entries.
557
558 2012-09-15  Jiong Wang  <jiwang@tilera.com>
559
560         * tilegx.cc: New file.
561         * Makefile.am (TARGETSOURCES): Add tilegx.cc
562         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
563         * configure.tgt: Add entries for tilegx*.
564         * configure.ac: Likewise.
565         * Makefile.in: Rebuild.
566         * configure: Likewise.
567         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
568         tilegx.
569
570 2012-09-13  Alan Modra  <amodra@gmail.com>
571
572         * target-reloc.h (scan_relocs): Call scan.local for relocs
573         against symbols in discarded sections.  Pass is_discarded
574         param.
575         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
576         Add is_discarded param.
577         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
578         is_discarded to flag opd entry as discarded.  Don't emit dyn
579         relocs on such entries.
580         (Target_powerpc::Scan::global): Similarly detect and handle
581         such opd entries.
582         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
583         opd_ent_.  Update all uses.
584         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
585         (Target_powerpc::relocate_section): Zero out discarded opd
586         entry relocs.
587
588 2012-09-12  Ian Lance Taylor  <iant@google.com>
589
590         PR gold/14570
591         * output.cc: Rename Output_data_got template parameter from size
592         to got_size for all functions.  Compile all variants of
593         Output_data_got.
594         (Output_data_got::Got_entry::write): Correct use of size for
595         symbol value.  Use local_is_tls rather than casting to
596         Sized_relobj_file.
597         * object.h (class Object): Add local_is_tls and do_local_is_tls.
598         (class Sized_relobj_file): Add do_local_is_tls.
599         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
600
601 2012-09-11  Alan Modra  <amodra@gmail.com>
602
603         PR gold/14566
604         * layout.cc (Layout::set_segment_offsets): When using
605         common-page-size alignment, ensure we are on a new max-page-size
606         page.
607         * output.cc (Output_segment::set_section_addresses): Use
608         abi_pagesize, not common_pagesize for relro boundary.
609         (Output_segment::set_offset): Likewise.
610
611 2012-09-11  Alan Modra  <amodra@gmail.com>
612
613         * output.h (Output_data_got::add_global_tls, add_local_tls,
614         add_local_tls_pair): New functions.
615         (Output_data_got::add_local_pair_with_rel): Remove second
616         reloc param.  Expand comment.
617         (Output_data_got::Got_entry): Rename use_plt_offset_ to
618         use_plt_or_tls_offset_, similarly for constructor param.
619         (Output_data_got::Got_entry::write): Add got_index param.
620         * output.cc (Output_data_got::add_global_tls, add_local_tls,
621         add_local_tls_pair): New functions.
622         (Output_data_got::Got_entry::write): Handle tls symbols
623         with use_plt_or_tls_offset_ set specially.
624         (Output_data_got::add_local_pair_with_rel): Only one reloc.
625         (Output_data_got::do_write): Replace iterator with index, pass
626         index to entry write function.
627         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
628         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
629         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
630         call.
631         * i386.cc (Target_i386::Scan::local): Likewise.
632         * sparc.cc (Target_sparc::Scan::local): Likewise.
633         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
634         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
635         do_tls_offset_for_global): New functions.
636         (Target_powerpc::Scan::local): Correct TLS relocations and got
637         entry values.
638         (Target_powerpc::Scan::global): Don't emit unnecessary
639         dynamic relocations on TLS GOT entries.
640
641 2012-09-10  Matthias Klose  <doko@ubuntu.com>
642
643         * config.in: Disable sanity check for kfreebsd.
644
645 2012-09-10  Sterling Augustine  <saugustine@google.com>
646
647         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
648         (Gdb_index::pubtypes_read): New parameter.
649         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
650         to calls.
651         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
652         pubtypes_object_.
653
654 2012-09-09  Alan Modra  <amodra@gmail.com>
655
656         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
657         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
658         * gc.h (gc_process_relocs): Call target gc_add_reference.
659         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
660         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
661         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
662         unnecessary cast.
663         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
664         to cater for when we don't need code offset.  Update use.
665         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
666         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
667         set_opd_valid): New functions.
668         (Target_powerpc::do_gc_add_reference): New function.
669         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
670         stashed refs.
671         (Target_powerpc::do_gc_mark_symbol): New function.
672
673 2012-09-06  Cary Coutant  <ccoutant@google.com>
674
675         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
676         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
677         (Dwarf_die::skip_attributes): Likewise.
678         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
679         * testsuite/gdb_index_test.cc (inline_func_1): New function.
680         (main): Call it.
681         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
682
683 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
684
685         * testsuite/script_test_3.t: Add .got.plt output section
686         statement.
687         * testsuite/script_test_4.t: Likewise.
688
689 2012-09-05  Alan Modra  <amodra@gmail.com>
690
691         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
692         update all uses and lose "enum" when using type.
693
694 2012-09-05  Alan Modra  <amodra@gmail.com>
695
696         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
697         * configure: Regenerate.
698         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
699         (plugin_final_layout.stdout): Likewise.
700         (memory_test): Set page sizes to 0x1000.
701         * testsuite/Makefile.in: Regenerate.
702         * testsuite/discard_locals_test.sh: Add FIXME comment.
703         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
704         * testsuite/pr14265.t: Add .got output section statement.
705         * testsuite/script_test_2.t: Likewise.
706         * testsuite/script_test_3.t: Likewise.
707         * testsuite/script_test_4.t: Likewise.
708         * testsuite/script_test_5.t: Likewise.
709         * testsuite/script_test_6.t: Likewise.
710         * testsuite/script_test_7.t: Likewise.
711         * testsuite/script_test_9.t: Likewise.
712
713 2012-09-05  Alan Modra  <amodra@gmail.com>
714
715         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
716         (Powerpc_relocate_functions::Status): New typedef.
717         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
718         (Target_powerpc::Scan::local): Handle REL64.
719         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
720         for REL32 and REL64.
721         (Target_powerpc::symval_for_branch): New function, extracted from..
722         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
723         checks.  Report overflow errors.
724
725 2012-09-05  Alan Modra  <amodra@gmail.com>
726
727         * object.h (Sized_relobj_file::emit_relocs): Delete.
728         (Sized_relobj_file::emit_relocs_reltype): Delete.
729         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
730         relocate_relocs for --emit-relocs.
731         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
732         * output.h: Update comment.
733         (Output_segment::first_section): New function.
734         (Output_segment::first_section_load_address): Use first_section.
735         * output.cc (Output_segment::first_section): New function extracted..
736         (Output_segment::first_section_load_address): ..from here.  Delete.
737         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
738         * target.h (Sized_target::relocate_for_relocatable): Likewise.
739         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
740         adjust call to target.h function.
741         * i386.cc (Target_i386): Likewise.
742         * sparc.cc (Target_sparc): Likewise.
743         * x86_64.cc (Target_x86_64): Likewise.
744         * powerpc.cc (Target_powerpc): Likewise.
745         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
746         first tls section has section symbol for optimised local dynamic
747         output relocs.
748         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
749         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
750         optimised tls code.
751         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
752         Rename to relocate_relocs.  Update error message.
753
754 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
755
756         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
757         --just-symbols.
758
759 2012-08-31  Alan Modra  <amodra@gmail.com>
760
761         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
762         (Powerpc_relobj::toc_base_offset): New stub function.
763         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
764         got_mod_index_offset to tlsld_got_offset.  Update all refs.
765         (Target_powerpc::Relocate::enum skip_tls): New.
766         (Target_powerpc::call_tls_get_addr_): New var.
767         (Target_powerpc::is_branch_reloc): Move to file scope.
768         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
769         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
770         New functions.
771         (Target_powerpc::enum Got_type): Delete old values, add new ones.
772         (powerpc_info): Correct common_pagesize for ppc64.
773         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
774         (Powerpc_relocate_functions): Add overflow check enums and functions.
775         Add non-shift version of rela, rela_ua.  Delete all rel public
776         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
777         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
778         addr16_ha3, addr14 functions.
779         (Output_data_got_powerpc::add_constant_pair): New function.
780         (Output_data_got_powerpc::got_base_offset): Likewise.
781         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
782         (instruction constants): Sort, add some more.
783         (Output_data_glink::do_write): Add and use Address typedef.  Use
784         object->toc_base_offset() stub for 64-bit.
785         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
786         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
787         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
788         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
789         Always treat .opd relocs as against locally defined symbol.
790         Correct condition for RELATIVE relocs.
791         (Target_powerpc::do_finalize_sections): Test for NULL sections.
792         (Target_powerpc::Relocate::relocate): Use plt call stub as value
793         for 32-bit syms with a plt entry.  Correct ppc64 toc base
794         calculations.  Handle TLS relocs, and more.  Add overflow
795         checking and adjust for Powerpc_relocate_functions changes.
796         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
797         Reinstate --emit-relocs code with FIXME.
798
799 2012-08-30  Alan Modra  <amodra@gmail.com>
800
801         * layout.cc (Layout::set_segment_offsets): Set p_align to
802         abi_pagesize, not common_pagesize.
803         (Layout::relaxation_loop_body): Similarly use abi_pagesize
804         to determine whether file header can go in segment.
805
806 2012-08-30  Alan Modra  <amodra@gmail.com>
807
808         * output.h (Output_reloc::Output_reloc <output section>): Add
809         is_relative param.  Adjust calls.
810         (Output_reloc::add_output_section_relative): New functions.
811         * output.cc (Output_reloc::Output_reloc <output section>): Handle
812         is_relative.
813         (Output_reloc::symbol_value): Handle SECTION_CODE.
814
815 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
816
817         * gold.cc (queue_middle_tasks): Call layout again when unique
818         segments for sections is desired.
819         * layout.cc (Layout::Layout): Initialize new members.
820         (Layout::get_output_section_flags): New function.
821         (Layout::choose_output_section): Call get_output_section_flags.
822         (Layout::layout): Make output section for mapping to a unique segment.
823         (Layout::insert_section_segment_map): New function.
824         (Layout::attach_allocated_section_to_segment): Make unique segment for
825         output sections marked so.
826         (Layout::segment_precedes): Check for unique segments when sorting.
827         * layout.h (Layout::Unique_segment_info): New struct.
828         (Layout::Section_segment_map): New typedef.
829         (Layout::insert_section_segment_map): New function.
830         (Layout::get_output_section_flags): New function.
831         (Layout::is_unique_segment_for_sections_specified): New function.
832         (Layout::set_unique_segment_for_sections_specified): New function.
833         (Layout::unique_segment_for_sections_specified_): New member.
834         (Layout::section_segment_map_): New member.
835         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
836         Rename is_gc_pass_one to is_pass_one.
837         Rename is_gc_pass_two to is_pass_two.
838         Rename is_gc_or_icf to is_two_pass.
839         Check for which pass based on whether symbols data is present.
840         Make it two pass when unique segments for sections is desired.
841         * output.cc (Output_section::Output_section): Initialize new
842         members.
843         * output.h (Output_section::is_unique_segment): New function.
844         (Output_section::set_is_unique_segment): New function.
845         (Output_section::is_unique_segment_): New member.
846         (Output_section::extra_segment_flags): New function.
847         (Output_section::set_extra_segment_flags): New function.
848         (Output_section::extra_segment_flags_): New member.
849         (Output_section::segment_alignment): New function.
850         (Output_section::set_segment_alignment): New function.
851         (Output_section::segment_alignment_): New member.
852         (Output_segment::Output_segment): Initialize is_unique_segment_.
853         (Output_segment::is_unique_segment): New function.
854         (Output_segment::set_is_unique_segment): New function.
855         (Output_segment::is_unique_segment_): New member.
856         * plugin.cc (allow_unique_segment_for_sections): New function.
857         (unique_segment_for_sections): New function.
858         (Plugin::load): Add new functions to transfer vector.
859         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
860         * Makefile.in: Regenerate.
861         * testsuite/plugin_final_layout.sh: Check if unique segment
862         functionality works.
863         * testsuite/plugin_section_order.c (onload): Check if new interfaces
864         are available.
865         (allow_unique_segment_for_sections): New global.
866         (unique_segment_for_sections): New global.
867         (claim_file_hook): Call allow_unique_segment_for_sections.
868         (all_symbols_read_hook): Call unique_segment_for_sections.
869
870 2012-08-22  Cary Coutant  <ccoutant@google.com>
871
872         * layout.cc (Layout::include_section): Don't assert on GROUP
873         sections with --emit-relocs.
874
875 2012-08-21  Cary Coutant  <ccoutant@google.com>
876
877         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
878         if --export-dynamic-symbol names an undef symbol.
879
880 2012-08-18  Alan Modra  <amodra@gmail.com>
881
882         * powerpc.cc: Formatting and white space.
883         (Powerpc_relobj): Rename got2_section_ to special_.
884         Add opd_ent_shndx_ and opd_ent_off_ vectors.
885         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
886         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
887         (Target_powerpc): Add Address typedef and invalid_address.  Use
888         throughout.
889         (Target_powerpc::is_branch_reloc): New function.
890         (Powerpc_relocate_functions): Add Address typedef, use throughout.
891         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
892         for dst_mask, value and addend.
893         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
894         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
895         (Output_data_glink::do_write): Correct toc base.  Don't try to use
896         uint16_t for 24-bit offset.  Use get_output_section_offset and
897         check return.
898         (Target_powerpc::Scan::local): Handle more relocs.
899         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
900         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
901         Plug in toc restoring insn after plt calls.  Translate branches
902         to function descriptor symbols to corresponding entry point.
903         (Target_powerpc::relocate_for_relocatable): Check return from
904         get_output_section_offset.
905         * symtab.h: Comment typo.
906
907 2012-08-14  Ian Lance Taylor  <iant@google.com>
908
909         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
910         unsupported_relocal_local to call unsupported_reloc_global.
911
912 2012-08-14  Nick Clifton  <nickc@redhat.com>
913
914         PR ld/14265
915         * script-sections.cc (Sections_element::output_section_name): Add
916         keep return parameter.
917         (Output_section_element::match_name): Add keep return parameter.
918         Return the value of the keep_ member.
919         * script-sections.h (class Output_section): Update
920         output_section_name prototype.
921         * layout.cc (Layout::keep_input_section): New public member
922         function.
923         (Layout::choose_output_section): Pass keep parameter to
924         output_section_name.
925         * layout.h (class Layout): Add keep_input_section.
926         * object.cc (Sized_relobj_file::do_layout): Check for kept input
927         sections.
928         * testsuite/Makefile.am: Add a test.
929         * testsuite/Makefile.in: Regenerate.
930         * testsuite/pr14265.c: Source file for the test.
931         * testsuite/pr14265.t: Linker script for the test.
932         * testsuite/pr14265.sh: Shell script for the test.
933
934 2012-08-14  Alan Modra  <amodra@gmail.com>
935
936         * target.h (Target::output_section_name): New function.
937         (Target::do_output_section_name): New function.
938         * layout.cc (Layout::choose_output_section): Call the above.
939         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
940
941 2012-08-14  Alan Modra  <amodra@gmail.com>
942
943         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
944         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
945         for replace_constant call.
946         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
947         (Output_data_glink::do_print_to_mapfile): New function.
948         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
949         (Target_powerpc::Relocate::relocate): Likewise.
950
951 2012-08-14  Alan Modra  <amodra@gmail.com>
952
953         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
954         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
955         (Output_data_glink::add_entry,find_entry): Remove shndx param.
956         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
957         all references to shndx_.  Handle special case for R_PPC_PLTREL24
958         here.
959         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
960         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
961         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
962         here.
963         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
964         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
965
966 2012-08-12  Alan Modra  <amodra@gmail.com>
967
968         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
969         (glink insn constants): Use uint32_t.
970         (Output_data_glink::add_entry): Use insert, not [] operator.
971
972 2012-08-11  Alan Modra  <amodra@gmail.com>
973
974         * object.h (Sized_relobj_file::find_shdr): New function.
975         (Sized_relobj_file::find_special_sections): New function.
976         * object.cc (Sized_relobj_file::find_shdr): New function.
977         (Sized_relobj_file::find_eh_frame): Use find_shdr.
978         (Sized_relobj_file::find_special_sections): New function, split out..
979         (Sized_relobj_file::do_read_symbols): ..from here.
980         * output.h (Output_data_got::replace_constant): New function.
981         (Output_data_got::num_entries): New function.
982         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
983         (Output_data_got::got_offset): Protected rather than private.
984         (Output_data_got::replace_got_entry): New function.
985         * output.cc (Output_data_got::replace_got_entry): New function.
986         * powerpc.cc (class Powerpc_relobj): New.
987         (class Powerpc_relocate_functions): Delete all psymval variants or
988         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
989         Implement _ha functions using corresponding _hi function.
990         (Powerpc_relobj::find_special_sections): New function.
991         (Target_powerpc::do_make_elf_object): New function.
992         (class Output_data_got_powerpc): New.
993         (class Output_data_glink): New.
994         (class Powerpc_scan_relocatable_reloc): New.
995         Many more changes througout file.
996
997 2012-08-09  Nick Clifton  <nickc@redhat.com>
998
999         * po/vi.po: Updated Vietnamese translation.
1000
1001 2012-08-07  Ian Lance Taylor  <iant@google.com>
1002
1003         * layout.cc (Layout::add_target_dynamic_tags): If
1004         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1005         plt_rel.
1006
1007 2012-07-30  Nick Clifton  <nickc@redhat.com>
1008
1009         * po/gold.pot: Updated template.
1010         * po/es.po: Updated Spanish translation.
1011
1012 2012-07-18  Cary Coutant  <ccoutant@google.com>
1013
1014         PR gold/14344
1015         * configure.ac: Add check for -gpubnames support.
1016         * configure: Regenerate.
1017         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1018         support; force -gno-pubnames.
1019         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1020         support.
1021         (gdb_index_test_4): New test.
1022         * testsuite/Makefile.in: Regenerate.
1023         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1024         * testsuite/gdb_index_test_2.sh: Likewise.
1025         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1026         * testsuite/gdb_index_test_4.sh: New script.
1027         * testsuite/gdb_index_test_comm.sh: New script with common code;
1028         don't look for space after colon.
1029
1030 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1031
1032         * gold.cc (queue_middle_tasks): Update function order only after
1033         deferred objects due to plugins are processed.
1034
1035 2012-07-11  Ian Lance Taylor  <iant@google.com>
1036
1037         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1038         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1039         (Target_arm::scan_reloc_for_stub): Likewise.
1040         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1041         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1042         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1043         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1044         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1045
1046 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1047             Ian Lance Taylor  <iant@google.com>
1048
1049         PR gold/14309
1050         * configure.ac: Test whether std::tr1::hash<off_t> works.
1051         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1052         needed.
1053         * output.h (class Output_fill): Add virtual destructor.
1054         * configure, config.in: Rebuild.
1055
1056 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1057
1058         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1059
1060 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1061
1062         * plugin.cc (Plugin::load): Handle position independent executables.
1063
1064 2012-06-06  Cary Coutant  <ccoutant@google.com>
1065
1066         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1067         add .debug_macro.
1068         (lines_only_debug_sections): Likewise.
1069         (gdb_fast_lookup_sections): New static array.
1070         (is_gdb_debug_section): Rename formal parameter.
1071         (is_lines_only_debug_section): Likewise.
1072         (is_gdb_fast_lookup_section): New function.
1073         (Layout::include_section): Check for ".zdebug_" prefix; pass
1074         section name suffix to is_gdb_debug_section, et al.; check for
1075         fast-lookup sections when building .gdb_index.
1076         * options.h (--strip-debug-gdb): Update GDB version number.
1077
1078 2012-06-06  Cary Coutant  <ccoutant@google.com>
1079
1080         * configure.ac: Add check for fallocate.
1081         * configure: Regenerate.
1082         * config.in: Regenerate.
1083
1084         * options.h (class General_options): Add --mmap-output-file and
1085         --posix-fallocate options.
1086         * output.cc: (posix_fallocate): Remove; replace with...
1087         (gold_fallocate): New function.
1088         (Output_file::map_no_anonymous): Call gold_fallocate.
1089         (Output_file::map): Check --mmap-output-file option.
1090
1091 2012-06-05  Jing Yu  <jingyu@google.com>
1092
1093         * gold.h (textdomain): Add do {} to empty while(0).
1094         (bindtextdomain): Likewise.
1095
1096 2012-06-04  Cary Coutant  <ccoutant@google.com>
1097
1098         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1099         has_dynsym_index.
1100
1101 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1102
1103         * symtab.cc (Symbol_table::define_special_symbol):
1104         Initialize *poldsym to prevent uninitialized variable errors.
1105
1106 2012-05-23  Cary Coutant  <ccoutant@google.com>
1107
1108         * layout.cc (Layout::section_name_mapping): Add rules to handle
1109         exact match on .data.rel.ro.local or .data.rel.ro.
1110         (Layout::output_section_name): Check for exact matches.
1111
1112 2012-05-23  Cary Coutant  <ccoutant@google.com>
1113
1114         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1115         more carefully.
1116
1117 2012-05-22  Cary Coutant  <ccoutant@google.com>
1118
1119         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1120         object before exporting symbol.
1121
1122 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1123
1124         * testsuite/tls_test.cc: Include "config.h" first.
1125         * testsuite/tls_test_c.c: Likewise.
1126
1127 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1128             Nick Clifton  <nickc@redhat.com>
1129
1130         PR 14072
1131         * configure.in: Add check that sysdep.h has been included before
1132         any system header files.
1133         * configure: Regenerate.
1134         * config.in: Regenerate.
1135
1136 2012-05-14  Cary Coutant  <ccoutant@google.com>
1137
1138         * layout.cc (Layout::make_output_section): Mark .tdata section
1139         as RELRO.
1140         * testsuite/relro_test.cc: Add a TLS variable.
1141
1142 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1143
1144         PR gold/14091
1145         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1146         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1147         R_X86_64_64.
1148
1149 2012-05-08  Cary Coutant  <ccoutant@google.com>
1150
1151         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1152         (lines_only_debug_sections): Likewise.
1153
1154 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1155
1156         * nacl.cc: New file.
1157         * nacl.h: New file.
1158         * Makefile.am (CCFILES, HFILES): Add them.
1159         * Makefile.in: Regenerate.
1160         * i386.cc (Output_data_plt_i386_nacl): New class.
1161         (Output_data_plt_i386_nacl_exec): New class.
1162         (Output_data_plt_i386_nacl_dyn): New class.
1163         (Target_i386_nacl): New class.
1164         (Target_selector_i386_nacl): New class.
1165         (target_selector_i386): Use it instead of Target_selector_i386.
1166         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1167         (Target_x86_64_nacl): New class.
1168         (Target_selector_x86_64_nacl): New class.
1169         (target_selector_x86_64, target_selector_x32): Use it instead of
1170         Target_selector_x86_64.
1171         * arm.cc (Output_data_plt_arm_nacl): New class.
1172         (Target_arm_nacl): New class.
1173         (Target_selector_arm_nacl): New class.
1174         (target_selector_arm, target_selector_armbe): Use it instead of
1175         Target_selector_arm.
1176
1177         * target-select.cc (select_target): Take new Input_file* and off_t
1178         arguments, pass them on to recognize method of selector.
1179         * object.cc (make_elf_sized_object): Update caller.
1180         * parameters.cc (parameters_force_valid_target): Likewise.
1181         * incremental.cc (make_sized_incremental_binary): Likewise.
1182         * target-select.h: Update decl.
1183         (Target_selector::recognize): Take new Input_file* argument,
1184         pass it on to do_recognize.
1185         (Target_selector::do_recognize): Take new Input_file* argument.
1186         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1187         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1188         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1189         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1190
1191         * target.h (Target::Target_info): New members isolate_execinstr
1192         and rosegment_gap.
1193         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1194         * arm.cc (Target_arm::arm_info): Update initializer.
1195         * i386.cc (Target_i386::i386_info): Likewise.
1196         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1197         * sparc.cc (Target_sparc::sparc_info): Likewise.
1198         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1199         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1200         * layout.cc (Layout::attach_allocated_section_to_segment):
1201         Take new const Target* argument.  If target->isolate_execinstr(), act
1202         like --rosegment.
1203         (Layout::find_first_load_seg): Take new const Target* argument;
1204         if target->isolate_execinstr(), reject PF_X segments.
1205         (Layout::relaxation_loop_body): Update caller.
1206         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1207         reset file offset to zero when we hit LOAD_SEG, and then do a second
1208         loop over the segments before LOAD_SEG to reassign offsets after
1209         addresses have been determined.  Handle target->rosegment_gap().
1210         (Layout::attach_section_to_segment): Take new const Target* argument;
1211         pass it to attach_allocated_section_to_segment.
1212         (Layout::make_output_section): Update caller.
1213         (Layout::attach_sections_to_segments): Take new const Target* argument;
1214         pass it to attach_section_to_segment.
1215         * gold.cc (queue_middle_tasks): Update caller.
1216         * layout.h (Layout): Update method decls with new arguments.
1217
1218         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1219         Target_info pointer to use.
1220         (Target_arm::do_make_data_plt): New virtual method.
1221         (Target_arm::make_data_plt): New method that calls it.
1222         (Target_arm::make_plt_entry): Use it.
1223         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1224         for the section alignment.
1225         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1226         method.
1227         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1228         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1229         method.
1230         (Output_data_plt_arm::get_plt_entry_size): Call it.
1231         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1232         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1233         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1234         method.
1235         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1236         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1237         method instead of sizeof(plt_entry).
1238         (Output_data_plt_arm::add_entry): Likewise.
1239         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1240         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1241         than static method.
1242         (Target_arm::plt_entry_size): Likewise.
1243         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1244         Move to ...
1245         (Output_data_plt_arm_standard): ... here, new class.
1246         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1247         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1248         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1249
1250         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1251         Take additional argument for the PLT entry size.
1252         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1253         Use get_plt_entry_size method rather than plt_entry_size variable.
1254         (Output_data_plt_x86_64::reserve_slot): Likewise.
1255         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1256         (Output_data_plt_x86_64::add_entry): Likewise.
1257         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1258         (Output_data_plt_x86_64::address_for_global): Likewise.
1259         (Output_data_plt_x86_64::address_for_local): Likewise.
1260         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1261         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1262         Make method non-static.
1263         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1264         method.
1265         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1266         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1267         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1268         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1269         virtual method.
1270         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1271         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1272         virtual method.
1273         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1274         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1275         virtual method.
1276         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1277         (Output_data_plt_x86_64::plt_entry_size)
1278         (Output_data_plt_x86_64::first_plt_entry)
1279         (Output_data_plt_x86_64::plt_entry)
1280         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1281         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1282         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1283         (Output_data_plt_x86_64_standard): ... here, new class.
1284         (Target_x86_64::Target_x86_64): Take optional argument for the
1285         Target_info pointer to use.
1286         (Target_x86_64::do_make_data_plt): New virtual method.
1287         (Target_x86_64::make_data_plt): New method to call it.
1288         (Target_x86_64::init_got_plt_for_update): Use that.
1289         Call this->plt_->add_eh_frame method here.
1290         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1291         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1292         rather than static method.
1293         (Target_x86_64::plt_entry_size): Likewise.
1294         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1295         rather than plt_entry_size variable.  Move guts of PLT filling to...
1296         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1297         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1298         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1299
1300         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1301         additional argument for the section alignment.
1302         Don't do add_eh_frame_for_plt here.
1303         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1304         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1305         variable.
1306         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1307         method.
1308         (Output_data_plt_i386::get_plt_entry_size): Call it.
1309         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1310         (Output_data_plt_i386::add_eh_frame): New method to call it.
1311         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1312         method.
1313         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1314         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1315         method.
1316         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1317         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1318         method instead of plt_entry_size.
1319         (Output_data_plt_i386::plt_entry_size)
1320         (Output_data_plt_i386::plt_eh_frame_fde_size)
1321         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1322         (Output_data_plt_i386_standard): ... here, new class.
1323         (Output_data_plt_i386_exec): New class.
1324         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1325         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1326         (Output_data_plt_i386::exec_plt_entry): Move to ...
1327         (Output_data_plt_i386_exec::plt_entry): ... here.
1328         (Output_data_plt_i386_dyn): New class.
1329         (Output_data_plt_i386::first_plt_entry): Move to ...
1330         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1331         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1332         (Output_data_plt_i386_dyn::plt_entry): ... here.
1333         (Target_i386::Target_i386): Take optional argument for the Target_info
1334         pointer to use.
1335         (Target_i386::do_make_data_plt): New virtual method.
1336         (Target_i386::make_data_plt): New method to call it.
1337         (Target_i386::make_plt_section): Use that.
1338         Call this->plt_->add_eh_frame method here.
1339         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1340         rather than plt_entry_size variable.
1341         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1342         (Output_data_plt_i386::address_for_local): Likewise.
1343         (Output_data_plt_i386::do_write): Likewise.
1344         Move guts of PLT filling to...
1345         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1346         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1347         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1348         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1349
1350 2012-05-01  Cary Coutant  <ccoutant@google.com>
1351
1352         * dwarf_reader.cc (Dwarf_die::read_attributes)
1353         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1354         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1355         * reduced_debug_output.cc
1356         (Output_reduced_debug_info_section::get_die_end): Remove
1357         DW_FORM_GNU_ref_index.  Add default case.
1358
1359 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1360
1361         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1362         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1363         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1364         DW_AT_high_pc as offset from DW_AT_low_pc.
1365
1366         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1367         * testsuite/Makefile.in: Regenerate.
1368         * testsuite/gdb_index_test_3.c: New test source file.
1369         * testsuite/gdb_index_test_3.sh: New test source file.
1370
1371 2012-04-25  Ian Lance Taylor  <iant@google.com>
1372
1373         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1374         pointer.
1375         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1376         as a class, not a struct.
1377         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1378         (Target_arm::apply_cortex_a8_workaround): Likewise.
1379         * gc.h: Declare Reloc_types as a struct, not a class.
1380         * object.h: Declare Symbols_data as a struct.
1381         * reloc.h: Declare Read_relocs_data as a struct.
1382         * target.h: Declare Relocate_info as a struct.
1383
1384 2012-04-24  David S. Miller  <davem@davemloft.net>
1385
1386         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1387         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1388         and R_SPARC_WPLT30.
1389
1390 2012-04-24  Cary Coutant  <ccoutant@google.com>
1391
1392         * incremental-dump.cc (find_input_containing_global): Replace
1393         magic number with symbolic constant.
1394         (dump_incremental_inputs): Update version number.
1395         * incremental.cc (Output_section_incremental_inputs): Update version
1396         number; import symbolic constants from Incremental_inputs_reader.
1397         (Incremental_inputs::create_data_sections): Align relocations
1398         section correctly for 64-bit targets.
1399         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1400         constants; add padding.
1401         (Output_section_incremental_inputs::write_header): Add assert for
1402         header_size.
1403         (Output_section_incremental_inputs::write_input_files): Add assert
1404         for input_entry_size.
1405         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1406         add assert for object_info_size, input_section_entry_size,
1407         global_sym_entry_size.
1408         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1409         for data structure sizes; use them.
1410         (Incremental_input_entry_reader): Import symbolic constants from
1411         Incremental_inputs_reader; use them.
1412
1413 2012-04-23  David S. Miller  <davem@davemloft.net>
1414
1415         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1416         and elf_flags_set_.
1417         (Target_sparc::Target_sparc): Initialize new fields.
1418         (Target_sparc::do_make_elf_object): New function.
1419         (Target_sparc::do_adjust_elf_header): New function.
1420
1421 2012-04-23  Cary Coutant  <ccoutant@google.com>
1422
1423         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1424         CU range table of gdb index.
1425
1426 2012-04-20  David S. Miller  <davem@davemloft.net>
1427
1428         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1429         instead of false.
1430
1431 2012-04-16  David S. Miller  <davem@davemloft.net>
1432
1433         * sparc.cc (Target_sparc::got_address): New function.
1434         (Sparc_relocate_functions::gdop_hix22): New function.
1435         (Sparc_relocate_functions::gdop_lox10): New function.
1436         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1437         relocs.
1438         (Target_sparc::Scan::local): Likewise if the global symbol is not
1439         preemptible and is not IFUNC.
1440         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1441         transformations for local and non-preemptible non-IFUNC global
1442         symbols.
1443
1444         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1445         writing out 64-bit part of ranges.
1446
1447         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1448         -fpic and -fpie respectively.
1449         * Makefile.in: Regenerate.
1450
1451         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1452         (Target_sparc::Target_sparc): Initialize new field.
1453         (Target_sparc::do_plt_section_for_global): New function.
1454         (Target_sparc::do_plt_section_for_local): New function.
1455         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1456         (Target_sparc::make_plt_section): New function, broken out of
1457         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1458         (Target_sparc::make_plt_entry): Call make_plt_section.
1459         (Target_sparc::make_local_ifunc_plt_entry): New function.
1460         (Target_sparc::rela_ifunc_section): New function.
1461         (Target_sparc::plt_section): Remove const.
1462         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1463         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1464         and ifunc_count_ fields.
1465         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1466         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1467         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1468         (Output_data_plt_sparc::rela_ifunc): New function.
1469         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1470         (Output_data_plt_sparc::has_ifunc_section): New function.
1471         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1472         (Output_data_plt_sparc::address_for_global): New function.
1473         (Output_data_plt_sparc::address_for_local): New function.
1474         (Output_data_plt_sparc::plt_index_to_offset): New function.
1475         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1476         and entry_count.
1477         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1478         entry_count.
1479         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1480         R_SPARC_JMP_IREL to switch.
1481         (Target_sparc::Scan::check_non_pic): Likewise.
1482         (Target_sparc::Scan::local): Handle IFUNC symbols.
1483         (Target_sparc::Scan::local): Likewise.
1484         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1485         and plt_address_for_local.
1486         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1487         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1488
1489         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1490         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1491         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1492         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1493         global relocs too.
1494         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1495         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1496         calls.
1497         * sparc.cc (Target_sparc::Scan::global): Likewise.
1498         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1499
1500 2012-04-16  Cary Coutant  <ccoutant@google.com>
1501
1502         * archive.cc (Library_base::should_include_member): Check for
1503         --export-dynamic-symbol.
1504         * options.h (class General_options): Add --export-dynamic-symbol.
1505         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1506         --export-dynamic-symbol.
1507         (Symbol_table::gc_mark_undef_symbols): Likewise.
1508         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1509
1510 2012-04-12  David S. Miller  <davem@davemloft.net>
1511
1512         * sparc.cc (Reloc::wdisp10): New relocation method.
1513         (Reloc::h34): Likewise.
1514         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1515         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1516         R_SPARC_WDISP10.
1517         (Target_sparc::Scan::local): Likewise.
1518         (Target_sparc::Scan::global): Likewise.
1519         (Target_sparc::Relocate::relocate): Likewise.
1520
1521 2012-04-09  Cary Coutant  <ccoutant@google.com>
1522
1523         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1524         low_pc == 0.
1525
1526 2012-04-06  Ian Lance Taylor  <iant@google.com>
1527
1528         * timer.cc: #include <unistd.h>.
1529
1530 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1531
1532         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1533         * config.in: Regenerate.
1534         * configure: Regenerate.
1535
1536 2012-04-05  Nick Clifton  <nickc@redhat.com>
1537
1538         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1539         (AM_LC_MESSAGES): Add.
1540         * aclocal.m4: Regenerate.
1541         * config.in: Regenerate.
1542         * configure: Regenerate.
1543
1544 2012-03-21  Cary Coutant  <ccoutant@google.com>
1545
1546         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1547         * Makefile.in: Regenerate.
1548         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1549         (Sized_elf_reloc_mapper::symbol_section): New function.
1550         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1551         (make_elf_reloc_mapper): New function.
1552         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1553         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1554         (Dwarf_abbrev_table::do_get_abbrev): New function.
1555         (Dwarf_ranges_table::read_ranges_table): New function.
1556         (Dwarf_ranges_table::read_range_list): New function.
1557         (Dwarf_pubnames_table::read_section): New function.
1558         (Dwarf_pubnames_table::read_header): New function.
1559         (Dwarf_pubnames_table::next_name): New function.
1560         (Dwarf_die::Dwarf_die): New function.
1561         (Dwarf_die::read_attributes): New function.
1562         (Dwarf_die::skip_attributes): New function.
1563         (Dwarf_die::set_name): New function.
1564         (Dwarf_die::set_linkage_name): New function.
1565         (Dwarf_die::attribute): New function.
1566         (Dwarf_die::string_attribute): New function.
1567         (Dwarf_die::int_attribute): New function.
1568         (Dwarf_die::uint_attribute): New function.
1569         (Dwarf_die::ref_attribute): New function.
1570         (Dwarf_die::child_offset): New function.
1571         (Dwarf_die::sibling_offset): New function.
1572         (Dwarf_info_reader::check_buffer): New function.
1573         (Dwarf_info_reader::parse): New function.
1574         (Dwarf_info_reader::do_parse): New function.
1575         (Dwarf_info_reader::do_read_string_table): New function.
1576         (Dwarf_info_reader::lookup_reloc): New function.
1577         (Dwarf_info_reader::get_string): New function.
1578         (Dwarf_info_reader::visit_compilation_unit): New function.
1579         (Dwarf_info_reader::visit_type_unit): New function.
1580         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1581         Sized_elf_reloc_mapper.
1582         (Sized_dwarf_line_info::symbol_section): Remove function.
1583         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1584         (Sized_dwarf_line_info::read_line_mappings): Remove object
1585         parameter, adjust callers.
1586         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1587         * dwarf_reader.h: Include <sys/types.h>.
1588         (class Track_relocs): Remove forward declaration.
1589         (class Elf_reloc_mapper): New class.
1590         (class Sized_elf_reloc_mapper): New class.
1591         (class Dwarf_abbrev_table): New class.
1592         (class Dwarf_range_list): New class.
1593         (class Dwarf_ranges_table): New class.
1594         (class Dwarf_pubnames_table): New class.
1595         (class Dwarf_die): New class.
1596         (class Dwarf_info_reader): New class.
1597         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1598         (Sized_dwarf_line_info::symbol_section): Remove member function.
1599         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1600         base class.
1601         * gdb-index.cc: New source file.
1602         * gdb-index.h: New source file.
1603         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1604         and .debug_types sections, call Layout::add_to_gdb_index.
1605         (Sized_relobj_incr::do_section_name): Implement.
1606         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1607         return type; Implement.
1608         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1609         return type.
1610         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1611         parameter list and return type.
1612         (Sized_incr_dynobj::do_section_contents): Likewise.
1613         * layout.cc: Include gdb-index.h.
1614         (Layout::Layout): Initialize gdb_index_data_.
1615         (Layout::init_fixed_output_section): Check for .gdb_index section.
1616         (Layout::add_to_gdb_index): New function. Instantiate.
1617         * layout.h: Add forward declaration for class Gdb_index.
1618         (Layout::add_to_gdb_index): New member function.
1619         (Layout::gdb_index_data_): New data member.
1620         * main.cc: Include gdb-index.h.
1621         (main): Print statistics for gdb index.
1622         * object.cc (Object::section_contents): Move code into
1623         do_section_contents.
1624         (need_decompressed_section): Check for sections needed when building
1625         gdb index.
1626         (build_compressed_section_map): Likewise.
1627         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1628         gdb index.
1629         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1630         sections; call Layout::add_to_gdb_index.
1631         (Sized_relobj_file::do_decompressed_section_contents): Call
1632         do_section_contents directly.
1633         * object.h (Object::do_section_contents): Adjust parameter list and
1634         return type.
1635         (Object::do_decompressed_section_contents): Call do_section_contents
1636         directly.
1637         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1638         return type.
1639         * options.h (class General_options): Add --gdb-index option.
1640         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1641         list and return type.
1642         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1643         * reloc.h (Track_relocs::checkpoint): New function.
1644         (Track_relocs::reset): New function.
1645
1646         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1647         New test cases.
1648         * testsuite/Makefile.in: Regenerate.
1649         * testsuite/gdb_index_test.cc: New test source file.
1650         * testsuite/gdb_index_test_1.sh: New test source file.
1651         * testsuite/gdb_index_test_2.sh: New test source file.
1652
1653 2012-03-19  Doug Kwan  <dougkwan@google.com>
1654
1655         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1656         (Target_arm::do_finalize_sections): Remove code which defines
1657         __exidx_start and __exidx_end.  Make symbol table parameter
1658         anonymous as it is not used.
1659         * gold.cc (queue_middle_tasks): Call target hook to define any
1660         target-specific symbols.
1661         * target.h (Target::define_standard_symbols): New method.
1662         (Target::do_define_standard_symbols): Same.
1663         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1664         * testsuite/Makefile.in: Regenerate.
1665         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1666         and __exidx_end.
1667         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1668         relocations are generated for __exidx_start and __exidx_end.
1669
1670 2012-03-16  Doug Kwan  <dougkwan@google.com>
1671
1672         * testsuite/Makefile.am: Disable test initpri3b.
1673         * testsuite/Makefile.in: Regenerate.
1674
1675 2012-03-15  Doug Kwan  <dougkwan@google.com>
1676
1677         * arm.cc (Target_arm::got_section): Make .got section read-only
1678         if -z now is given.
1679
1680 2012-03-15  Ian Lance Taylor  <iant@google.com>
1681
1682         PR gold/13850
1683         * layout.cc (Layout::make_output_section): Correctly mark
1684         SHT_INIT_ARRAY, et. al., as relro.
1685
1686 2012-03-14  Doug Kwan  <dougkwan@google.com>
1687
1688         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1689         dynamic relocations for protected symbols in shared objects.
1690
1691 2012-03-13  Ian Lance Taylor  <iant@google.com>
1692
1693         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1694         keep the larger alignment.
1695
1696 2012-03-12  Cary Coutant  <ccoutant@google.com>
1697
1698         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1699         handling of DW_LNE_define_file.
1700
1701 2012-03-12  Cary Coutant  <ccoutant@google.com>
1702
1703         * reduced_debug_output.cc
1704         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1705         codes to switch.
1706
1707 2012-02-29  Cary Coutant  <ccoutant@google.com>
1708
1709         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1710
1711 2012-02-29  Cary Coutant  <ccoutant@google.com>
1712
1713         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1714         Call Object::decompressed_section_contents.
1715         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1716         New dtor.
1717         (Sized_dwarf_line_info::buffer_start_): New data member.
1718         * merge.cc (Output_merge_data::do_add_input_section): Call
1719         Object::decompressed_section_contents.
1720         (Output_merge_string::do_add_input_section): Likewise.
1721         * object.cc (need_decompressed_section): New function.
1722         (build_compressed_section_map): Decompress sections needed later.
1723         (Sized_relobj_file::do_decompressed_section_contents): New function.
1724         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1725         * object.h (Object::decompressed_section_contents): New function.
1726         (Object::discard_decompressed_sections): New function.
1727         (Object::do_decompressed_section_contents): New function.
1728         (Object::do_discard_decompressed_sections): New function.
1729         (Compressed_section_info): New type.
1730         (Compressed_section_map): Include decompressed section contents.
1731         (Sized_relobj_file::do_decompressed_section_contents): New function.
1732         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1733
1734 2012-02-16  Cary Coutant  <ccoutant@google.com>
1735
1736         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1737         * testsuite/Makefile.in: Regenerate.
1738
1739 2012-02-14  Cary Coutant  <ccoutant@google.com>
1740
1741         * options.cc (General_options::finalize): Disallow -pie and -static.
1742
1743 2012-02-03  Doug Kwan  <dougkwan@google.com>
1744
1745         * arm.cc (Arm_relocate_functions::abs8,
1746         Arm_relocate_functions::abs16): Use
1747         Bits::has_signed_unsigned_overflow32.
1748         (Arm_relocate_functions::thm_abs8): Correct range of
1749         overflow check.
1750         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1751         in assertions.
1752
1753 2012-02-02  Doug Kwan  <dougkwan@google.com>
1754
1755         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1756         position independent outputs, not just shared objects.
1757
1758 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1759
1760         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1761         * configure: Regenerated.
1762
1763 2012-01-27  Ian Lance Taylor  <iant@google.com>
1764
1765         * reloc.h (Bits): New class with static functions, copied from
1766         namespace utils in arm.cc.
1767         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1768         instead.
1769
1770 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1771
1772         * incremental.cc (write_info_blocks): Correct relocation offset.
1773
1774 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1775
1776         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1777         (Relocate::tls_gd_to_le): Likewise.
1778
1779 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1780
1781         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1782
1783 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1784
1785         * configure.ac: Check if -mcmodel=medium works.
1786         * configure: Regenerated.
1787
1788 2012-01-24  Cary Coutant  <ccoutant@google.com>
1789
1790         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1791         definition and ...
1792         (read_unsigned_LEB_128_x): ... this new function.
1793         (read_signed_LEB_128): Replaced with inline definition and ...
1794         (read_signed_LEB_128_x): ... this new function.
1795         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1796         (read_unsigned_LEB_128): Add inline definition.
1797         (read_signed_LEB_128_x): New function.
1798         (read_signed_LEB_128): Add inline definition.
1799         * testsuite/Makefile.am (leb128_unittest): New unit test.
1800         * testsuite/Makefile.in: Regenerate.
1801         * testsuite/leb128_unittest.cc: New unit test.
1802
1803 2012-01-23  Ian Lance Taylor  <iant@google.com>
1804
1805         PR gold/13617
1806         * i386.cc (Target_i386::do_code_fill): When using a jmp
1807         instruction, pad with nop instructions.
1808         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1809
1810 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1811
1812         * x86_64.cc (gc_process_relocs): Add typename on types used in
1813         template.
1814         (scan_relocs): Likewise.
1815         (relocate_section): Likewise.
1816         (apply_relocation): Likewise.
1817
1818 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1819
1820         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1821         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1822         under x32.
1823
1824 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1825
1826         * x86_64.cc: Initial support for x32.
1827
1828 2012-01-03  Cary Coutant  <ccoutant@google.com>
1829
1830         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1831         Use abstract base class for GOT.
1832         * gold/output.h (class Output_data_got_base): New abstract base class.
1833         (class Output_data_got): Derive from new base class, adjust ctors.
1834         (Output_data_got::reserve_slot): Make virtual; rename to
1835         do_reserve_slot; Adjust callers.
1836         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1837         pointer to abstract base class.
1838         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1839
1840 2011-12-18  Ian Lance Taylor  <iant@google.com>
1841
1842         * object.h (Relobj::local_symbol_value): New function.
1843         (Relobj::local_plt_offset): New function.
1844         (Relobj::local_has_got_offset): New function.
1845         (Relobj::local_got_offset): New function.
1846         (Relobj::set_local_got_offset): New function.
1847         (Relobj::do_local_symbol_value): New pure virtual function.
1848         (Relobj::do_local_plt_offset): Likewise.
1849         (Relobj::do_local_has_got_offset): Likewise.
1850         (Relobj::do_local_got_offset): Likewise.
1851         (Relobj::do_set_local_got_offset): Likewise.
1852         (Sized_relobj::do_local_has_got_offset): Rename from
1853         local_has_got_offset.
1854         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1855         (Sized_relobj::do_set_local_got_offset): Rename from
1856         set_local_got_offset.
1857         (Sized_relobj_file::do_local_plt_offset): Rename from
1858         local_plt_offset.
1859         (Sized_relobj_file::do_local_symbol_value): New function.
1860         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1861         local_plt_offset.
1862         * output.cc (Output_data_got::Got_entry::write): Change object to
1863         Relobj.  Use local_symbol_value.
1864         (Output_data_got::add_global_with_rel): Change rel_dyn to
1865         Output_data_reloc_generic*.  Use add_global_generic.
1866         (Output_data_got::add_global_with_rela): Remove.  Change all
1867         callers to use add_global_with_rel.
1868         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1869         Output_data_reloc_generic*.  Use add_global_generic.
1870         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1871         callers to use add_global_pair_with_rel.
1872         (Output_data_got::add_local): Change object to Relobj*.
1873         (Output_data_got::add_local_plt): Likewise.
1874         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1875         change rel_dyn to Output_data_reloc_generic*.  Use
1876         add_local_generic.
1877         (Output_data_got::add_local_with_rela): Remove.  Change all
1878         callers to use all_local_with_rel.
1879         (Output_data_got::add_local_pair_with_rel): Change object to
1880         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1881         add_output_section_generic.
1882         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1883         callers to use add_local_pair_with_rel.
1884         (Output_data_got::reserve_local): Change object to Relobj*.
1885         * output.h: (class Output_data_reloc_generic): Add pure virtual
1886         declarations for add_global_generic, add_local_generic,
1887         add_output_section_generic.
1888         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1889         functions for Output_data_reloc_generic.  Update declarations for
1890         changes listed in output.cc.
1891         (class Output_data_got): Change template parameter to got_size.
1892         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1893         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1894         function.
1895         (Sized_relobj_incr::do_local_plt_offset): New function.
1896         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1897         add_global_generic.
1898
1899 2011-12-17  Cary Coutant  <ccoutant@google.com>
1900
1901         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1902         * resolve.cc (Symbol_table::resolve): Likewise.
1903         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1904         arrays.
1905         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1906
1907 2011-12-16  Ian Lance Taylor  <iant@google.com>
1908
1909         * output.h (Output_data_reloc_generic::add): Only call
1910         add_dynamic_reloc if this is a dynamic reloc section.
1911
1912 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1913
1914         PR gold/13505
1915         * target-reloc.h (apply_relocation): Replace <64, false> with
1916         <size, big_endian>.
1917
1918 2011-11-25  Nick Clifton  <nickc@redhat.com>
1919
1920         * po/it.po: New Italian translation.
1921
1922 2011-11-17  Sterling Augustine  <saugustine@google.com>
1923
1924         * script.cc (script_include_directive): Implement.
1925         (read_script_file): New local variables name and search_path. Update
1926         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1927         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1928         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1929
1930 2011-11-11  Sterling Augustine  <saugustine@google.com>
1931
1932         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1933         (file_or_sections_cmd): Likewise.
1934
1935 2011-11-11  Doug Kwan  <dougkwan@google.com>
1936
1937         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1938         if --just-symbols is given.
1939
1940 2011-11-10  Doug Kwan  <dougkwan@google.com>
1941
1942         PR gold/13362
1943         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1944         when processing data relocs.
1945         * reloc.h (Relocate_functions::rel_unaligned): New method.
1946         (Relocate_functions::pcrel_unaligned): Ditto.
1947         (Relocate_functions::rel32_unaligned): Ditto.
1948         (Relocate_functions::pcrel32_unaligned): Ditto.
1949
1950 2011-11-09  Doug Kwan  <dougkwan@google.com>
1951
1952         PR gold/13362
1953         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1954         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1955         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1956         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1957         (Relocate_functions::rel_unaligned): New.
1958         (Relocate_functions::rel32_unaligned): New.
1959         * target-reloc.h (relocate_for_relocatable): Add code to handle
1960         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1961         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1962         arm_unaligned_reloc_r): New targets.
1963         * testsuite/Makefile.in: Regenerate.
1964         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1965         linking.
1966
1967 2011-11-02  Ian Lance Taylor  <iant@google.com>
1968
1969         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1970         NATIVE_LINKER.
1971         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1972         * options.cc (General_options::finalize): Use library search path
1973         from configure script if specified.  If not native and no sysroot,
1974         only search TOOLLIBDIR.
1975         * options.h (Search_directory::Search_directory): Change name to
1976         const std::string&.
1977         (General_options::add_to_library_path_with_sysroot): Change arg to
1978         const std::string&.
1979         * configure, Makefile.in, config.in: Rebuild.
1980
1981 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1982
1983         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1984         we are working around the ARM1176 Erratum.
1985         * options.h (General_options::fix_arm1176): Add option.
1986         * testsuite/Makefile.am: Add testcases, and keep current ones
1987         working.
1988         * testsuite/Makefile.in: Regenerate.
1989         * testsuite/arm_fix_1176.s: New file.
1990         * testsuite/arm_fix_1176.sh: Likewise.
1991
1992 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1993
1994         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1995         may_use_blx_.
1996         (Target_arm::may_use_blx): Remove method.
1997         (Target_arm::set_may_use_blx): Likewise.
1998         (Target_arm::may_use_v4t_interworking): New method.
1999         (Target_arm::may_use_v5t_interworking): Likewise.
2000         (Target_arm::may_use_blx_): Remove member variable.
2001         (Arm_relocate_functions::arm_branch_common): Check for v5T
2002         interworking.
2003         (Arm_relocate_functions::thumb_branch_common): Likewise.
2004         (Reloc_stub::stub_type_for_reloc): Likewise.
2005         (Target_arm::do_finalize_sections): Correct interworking checks.
2006         * testsuite/Makefile.am: Add new tests.
2007         * testsuite/Makefile.in: Regenerate.
2008         * testsuite/arm_farcall_arm_arm.s: New test.
2009         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2010         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2011         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2012         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2013         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2014         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2015         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2016
2017 2011-10-31  Cary Coutant  <ccoutant@google.com>
2018
2019         PR gold/13023
2020         * expression.cc (Expression::eval_with_dot): Add
2021         is_section_dot_assignment parameter.
2022         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2023         absolute and assigning to dot within a section.
2024         * script-sections.cc
2025         (Output_section_element_assignment::set_section_addresses): Pass
2026         dot_section to set_if_absolute.
2027         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2028         as is_section_dot_assignment flag to eval_with_dot.
2029         (Output_section_element_dot_assignment::set_section_addresses):
2030         Likewise.
2031         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2032         parameter.  Also set value if relative to dot_section; set the
2033         symbol's output_section.
2034         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2035         parameter.  Adjust all callers.
2036         (Expression::eval_maybe_dot): Likewise.
2037         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2038         Adjust all callers.
2039         * testsuite/script_test_2.t: Test assignment of an absolute value
2040         to dot within an output section element.
2041
2042 2011-10-31  Cary Coutant  <ccoutant@google.com>
2043
2044         * options.h (class General_options): Add --[no-]gnu-unique options.
2045         * symtab.cc (Symbol_table::sized_write_globals): Convert
2046         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2047
2048 2011-10-31  Cary Coutant  <ccoutant@google.com>
2049
2050         PR gold/13359
2051         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2052         unnecessary assertion.
2053         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2054
2055 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2056
2057         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2058         gc_mark_symbol.
2059         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2060         gc_mark_symbol.
2061         Change to just keep the section associated with symbol.
2062         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2063         they are externally visible and --export-dynamic is turned on.
2064         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2065
2066 2011-10-19  Ian Lance Taylor  <iant@google.com>
2067
2068         PR gold/13163
2069         * script-sections.cc
2070         (Output_section_element_dot_assignment::needs_output_section): New
2071         function.
2072
2073 2011-10-19  Ian Lance Taylor  <iant@google.com>
2074
2075         PR gold/13204
2076         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2077         --section-start option was seen.
2078         * options.h (General_options::any_section_start): New function.
2079
2080 2011-10-18  David S. Miller  <davem@davemloft.net>
2081
2082         PR binutils/13301
2083         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2084         member to track relocation locations that have moved during TLS
2085         reloc optimizations.
2086         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2087         (Target_sparc::Relocate::relocate): Adjust view down by 4
2088         bytes if it matches reloc_adjust_addr_.
2089         (Target_sparc::Relocate::relocate_tls): Always move the
2090         __tls_get_addr call delay slot instruction forward 4 bytes when
2091         performing relaxation.
2092
2093 2011-10-18  Cary Coutant  <ccoutant@google.com>
2094
2095         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2096         (Output_file::map_no_anonymous): Check for non-zero
2097         return code from posix_fallocate.
2098
2099 2011-10-17  Cary Coutant  <ccoutant@google.com>
2100
2101         PR gold/13245
2102         * plugin.cc (is_visible_from_outside): Check for symbols
2103         referenced from dynamic objects.
2104         * resolve.cc (Symbol_table::resolve): Don't count references
2105         from dynamic objects as references from real ELF files.
2106         * testsuite/plugin_test_2.sh: Adjust expected result.
2107
2108 2011-10-17  Cary Coutant  <ccoutant@google.com>
2109
2110         * gold.cc: Include timer.h.
2111         (queue_middle_tasks): Stamp time.
2112         (queue_final_tasks): Likewise.
2113         * main.cc (main): Store timer in parameters.  Print timers
2114         for each pass.
2115         * parameters.cc (Parameters::Parameters): Initialize timer_.
2116         (Parameters::set_timer): New function.
2117         (set_parameters_timer): New function.
2118         * parameters.h (Parameters::set_timer): New function.
2119         (Parameters::timer): New function.
2120         (Parameters::timer_): New data member.
2121         (set_parameters_timer): New function.
2122         * timer.cc (Timer::stamp): New function.
2123         (Timer::get_pass_time): New function.
2124         * timer.h (Timer::stamp): New function.
2125         (Timer::get_pass_time): New function.
2126         (Timer::pass_times_): New data member.
2127
2128 2011-10-17  Cary Coutant  <ccoutant@google.com>
2129
2130         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2131         task for members of lib groups.
2132
2133 2011-10-17  Cary Coutant  <ccoutant@google.com>
2134
2135         PR gold/13288
2136         * fileread.cc (File_read::find_view): Add assert.
2137         (File_read::make_view): Move bounds check (replace with assert)...
2138         (File_read::find_or_make_view): ... to here.
2139
2140 2011-10-12  Cary Coutant  <ccoutant@google.com>
2141
2142         * output.cc (Output_file::open_base_file): Handle case where
2143         ::read returns less than requested size.
2144
2145 2011-10-10  Cary Coutant  <ccoutant@google.com>
2146
2147         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2148         Initialize defined_count_.
2149         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2150         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2151         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2152         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2153         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2154         * incremental.h (Sized_relobj_incr::defined_count_): New data
2155         member.
2156         (Sized_incr_dynobj::defined_count_): New data member.
2157         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2158         Return zeroes instead of internal error.
2159
2160 2011-10-10  Cary Coutant  <ccoutant@google.com>
2161
2162         PR gold/13249
2163         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2164         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2165         * output.h (class Output_reloc): Add use_plt_offset flag.
2166         (Output_reloc::type_): Adjust size of bit field.
2167         (Output_reloc::use_plt_offset_): New bit field.
2168         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2169         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2170         flag.  Adjust all callers.
2171         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2172         creating RELATIVE relocations.
2173
2174 2011-10-10  Nick Clifton  <nickc@redhat.com>
2175
2176         * po/es.po: Updated Spanish translation.
2177         * po/fi.po: Updated Finnish translation.
2178
2179 2011-10-03   Diego Novillo  <dnovillo@google.com>
2180
2181         * options.cc (parse_uint): Fix dereference of RETVAL.
2182
2183 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2184
2185         * layout.h (section_order_map_): New member.
2186         (get_section_order_map): New member function.
2187         * output.cc (Output_section::add_input_section): Check for patterns
2188         only when --section-ordering-file is specified.
2189         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2190         output_sections have been formed.
2191         * layout.cc (Layout_Layout): Initialize section_order_map_.
2192         * plugin.cc (update_section_order): Store order in order_map. Do not
2193         update the order.
2194         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2195         * testsuite/Makefile.in: Regenerate.
2196         * testsuite/plugin_section_order.c: New file.
2197         * testsuite/plugin_final_layout.cc: New file.
2198         * testsuite/plugin_final_layout.sh: New file.
2199
2200 2011-09-29  Cary Coutant  <ccoutant@google.com>
2201
2202         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2203         Check for NULL.
2204         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2205         symbols during incremental update.
2206         (Symbol_table::add_from_dynobj): Likewise.
2207
2208 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2209             Ian Lance Taylor  <iant@google.com>
2210
2211         * symtab.cc (Symbol_table::define_special_symbol): Always
2212         canonicalize version string.
2213
2214 2011-09-26  Cary Coutant  <ccoutant@google.com>
2215
2216         * gold.cc (queue_initial_tasks): Move option checks ...
2217         * options.cc (General_options::finalize): ... to here. Disable
2218         some options; make others fatal.
2219
2220 2011-09-26  Cary Coutant  <ccoutant@google.com>
2221
2222         gcc PR lto/47247
2223         * plugin.cc (get_symbols_v2): New function.
2224         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2225         (is_referenced_from_outside): New function.
2226         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2227         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2228         (get_symbols): Pass version parameter.
2229         (get_symbols_v2): New function.
2230         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2231         parameter.
2232         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2233         (onload): Add LDPT_GET_SYMBOLS_V2.
2234         (all_symbols_read_hook): Use get_symbols_v2; check for
2235         LDPR_PREVAILING_DEF_IRONLY_EXP.
2236         * testsuite/plugin_test_3.sh: Update expected results.
2237
2238 2011-09-23  Simon Baldwin  <simonb@google.com>
2239
2240         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2241         configuration options.
2242         * configure: Regenerate.
2243         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2244         * Makefile.in: Regenerate.
2245         * testsuite/Makefile.in: Regenerate.
2246
2247 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2248
2249         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2250
2251 2011-09-19  Cary Coutant  <ccoutant@google.com>
2252
2253         * incremental.cc (can_incremental_update): Fix typo in comment.
2254         * incremental.h (can_incremental_update): Likewise.
2255
2256 2011-09-18  Cary Coutant  <ccoutant@google.com>
2257
2258         * incremental.cc (can_incremental_update): New function.
2259         * incremental.h (can_incremental_update): New function.
2260         * layout.cc (Layout::init_fixed_output_section): Call it.
2261         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2262         * object.cc (Sized_relobj_file::do_layout): Call
2263         can_incremental_update.
2264
2265 2011-09-13  Cary Coutant  <ccoutant@google.com>
2266
2267         * configure.ac: Check for glibc support for gnu_indirect_function
2268         support with static linking, setting automake conditional
2269         IFUNC_STATIC.
2270         * Makefile.in: Regenerate.
2271         * configure: Regenerate.
2272
2273         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2274         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2275         for IFUNC_STATIC.
2276         * testsuite/Makefile.in: Regenerate.
2277
2278 2011-09-13  Cary Coutant  <ccoutant@google.com>
2279
2280         * incremental.cc (Sized_relobj_incr::do_layout): Call
2281         report_comdat_group for kept comdat sections.
2282         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2283         * testsuite/Makefile.in: Regenerate.
2284         * testsuite/incr_comdat_test_1.cc: New source file.
2285         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2286         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2287         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2288
2289 2011-09-13  Ian Lance Taylor  <iant@google.com>
2290
2291         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2292         variable external_symbols_offset.
2293
2294 2011-09-12  Ian Lance Taylor  <iant@google.com>
2295
2296         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2297         triggered if object has no symbols.
2298
2299 2011-09-09  David S. Miller  <davem@davemloft.net>
2300
2301         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2302         (Output_fill_debug_line::do_write): Likewise.
2303
2304 2011-08-29  Cary Coutant  <ccoutant@google.com>
2305
2306         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2307         casts to match formatting specs.
2308         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2309
2310 2011-08-26  Cary Coutant  <ccoutant@google.com>
2311
2312         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2313         remaining hole size when allocating.
2314         (Layout::make_output_section): Set fill methods for debug sections.
2315         * layout.h (Free_list::Free_list_node): Move from private to
2316         public.
2317         (Free_list::set_min_hole_size): New function.
2318         (Free_list::begin, Free_list::end): New functions.
2319         (Free_list::min_hole_): New data member.
2320         * output.cc: Include dwarf.h.
2321         (Output_fill_debug_info::do_minimum_hole_size): New function.
2322         (Output_fill_debug_info::do_write): New function.
2323         (Output_fill_debug_line::do_minimum_hole_size): New function.
2324         (Output_fill_debug_line::do_write): New function.
2325         (Output_section::Output_section): Initialize new data member.
2326         (Output_section::set_final_data_size): Ensure patch space is larger
2327         than minimum hole size.
2328         (Output_section::do_write): Fill holes in debug sections.
2329         * output.h (Output_fill): New class.
2330         (Output_fill_debug_info): New class.
2331         (Output_fill_debug_line): New class.
2332         (Output_section::set_free_space_fill): New function.
2333         (Output_section::free_space_fill_): New data member.
2334         * testsuite/Makefile.am (incremental_test_3): Add
2335         --incremental-patch option.
2336         (incremental_test_4): Likewise.
2337         (incremental_test_5): Likewise.
2338         (incremental_test_6): Likewise.
2339         (incremental_copy_test): Likewise.
2340         (incremental_common_test_1): Likewise.
2341         * testsuite/Makefile.in: Regenerate.
2342
2343 2011-08-26  Nick Clifton  <nickc@redhat.com>
2344
2345         * po/es.po: Updated Spanish translation.
2346
2347 2011-08-01  Cary Coutant  <ccoutant@google.com>
2348
2349         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2350         * gold/testsuite/Makefile.in: Regenerate.
2351         * gold/testsuite/justsyms_exec.c: New source file.
2352         * gold/testsuite/justsyms_lib.c: New source file.
2353
2354 2011-08-01  Cary Coutant  <ccoutant@google.com>
2355
2356         * layout.cc (Layout::set_segment_offsets): Don't realign text
2357         segment if -Ttext was specified.
2358         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2359         file type.
2360         * object.h (Sized_relobj_file::e_type): New function.
2361         (Sized_relobj_file::e_type_): New data member.
2362         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2363         base address for ET_EXEC files.
2364         * target.cc (Target::do_make_elf_object_implementation): Allow
2365         ET_EXEC files with --just-symbols option.
2366
2367 2011-07-28  Cary Coutant  <ccoutant@google.com>
2368
2369         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2370         Add thread_number parameter.
2371         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2372         * workqueue-threads.cc
2373         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2374         current thread if its thread number is greater than desired thread
2375         count.
2376         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2377         Add thread_number parameter.
2378         (Workqueue::should_cancel_thread): Likewise.
2379         (Workqueue::find_runnable_or_wait): Pass thread_number to
2380         should_cancel_thread.
2381         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2382         parameter.
2383
2384 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2385
2386         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2387         only after checking if it cannot be forced local.
2388         * symtab.h (is_externally_visible): Check if the symbol is not forced
2389         local.
2390
2391 2011-07-15  Ian Lance Taylor  <iant@google.com>
2392
2393         * options.h (class General_options): Add --print-output-format.
2394         Move -EL next to -EB, for  better --help output.
2395         * target-select.cc: Include <cstdio>, "options.h", and
2396         "parameters.h".
2397         (Target_selector::do_target_bfd_name): New function.
2398         (print_output_format): New function.
2399         * target-select.h (class Target_selector): Update declarations.
2400         (Target_selector::target_bfd_name): New function.
2401         (print_output_format): Declare.
2402         * main.cc: Include "target-select.h".
2403         (main): Handle --print-output-format.
2404         * gold.cc: Include "target-select.h".
2405         (queue_initial_tasks): Handle --print-output-format when there are
2406         no input files.
2407         * parameters.cc (parameters_force_valid_target): Give a better
2408         error message if -EB/-EL does not match target.
2409         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2410         function.
2411
2412 2011-07-15  Ian Lance Taylor  <iant@google.com>
2413
2414         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2415         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2416         (Output_data_plt_i386::do_write): Write address of .dynamic
2417         section to first entry in .got.plt section.
2418         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2419         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2420         Initialize layout_.
2421         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2422         section to first entry in .got.plt section.
2423         * layout.h (Layout::dynamic_section): New function.
2424
2425 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2426
2427         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2428         to claim_file call.
2429         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2430         input_section_position_, and input_section_glob_.
2431         (read_layout_from_file): Call function section_ordering_specified.
2432         * layout.h (is_section_ordering_specified): New function.
2433         (section_ordering_specified): New function.
2434         (section_ordering_specified_): New boolean member.
2435         * main.cc(main): Call load_plugins after layout object is defined.
2436         * output.cc (Output_section::add_input_section): Use
2437         function section_ordering_specified to check if section ordering is
2438         needed.
2439         * output.cc (Output_section::add_relaxed_input_section): Use
2440         function section_ordering_specified to check if section ordering is
2441         needed.
2442         (Output_section::update_section_layout): New function.
2443         (Output_section::sort_attached_input_sections): Check if input section
2444         must be reordered.
2445         * output.h (Output_section::update_section_layout): New function.
2446         * plugin.cc (get_section_count): New function.
2447         (get_section_type): New function.
2448         (get_section_name): New function.
2449         (get_section_contents): New function.
2450         (update_section_order): New function.
2451         (allow_section_ordering): New function.
2452         (Plugin::load): Add the new interfaces to the transfer vector.
2453         (Plugin_manager::load_plugins): New parameter.
2454         (Plugin_manager::all_symbols_read): New parameter.
2455         (Plugin_manager::claim_file): New parameter. Save the elf object for
2456         unclaimed objects.
2457         (Plugin_manager::get_elf_object): New function.
2458         (Plugin_manager::get_view): Change to directly use the bool to check
2459         if get_view is called from claim_file_hook.
2460         * plugin.h (input_objects): New function
2461         (Plugin__manager::load_plugins): New parameter.
2462         (Plugin_manager::claim_file): New parameter.
2463         (Plugin_manager::get_elf_object): New function.
2464         (Plugin_manager::in_claim_file_handler): New function.
2465         (Plugin_manager::in_claim_file_handler_): New member.
2466         (layout): New function.
2467         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2468         handler with an extra parameter. Make the elf object before calling
2469         claim_file handler.
2470         * testsuite/plugin_test.c (get_section_count): New function pointer.
2471         (get_section_type): New function pointer.
2472         (get_section_name): New function pointer.
2473         (get_section_contents): New function pointer.
2474         (update_section_order): New function pointer.
2475         (allow_section_ordering): New function pointer.
2476         (onload): Check if the new interfaces exist.
2477
2478 2011-07-13  Ian Lance Taylor  <iant@google.com>
2479
2480         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2481         relro section.
2482         * x86_64.cc (Target_x86_64::got_section): Likewise.
2483         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2484         (relro_now_test_SOURCES): New variable.
2485         (relro_now_test_DEPENDENCIES): New variable.
2486         (relro_now_test_LDFLAGS): New variable.
2487         (relro_now_test_LDADD): New variable.
2488         (relro_now_test.so): New target.
2489         * testsuite/Makefile.in: Rebuild.
2490
2491 2011-07-12  Ian Lance Taylor  <iant@google.com>
2492
2493         PR gold/12980
2494         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2495         GLOB_DAT relocation rather than a RELATIVE relocation for a
2496         protected symbol when creating a shared library.
2497         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2498         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2499         * testsuite/protected_main_1.cc (main): Test that protected
2500         function has same address.
2501
2502 2011-07-11  Ian Lance Taylor  <iant@google.com>
2503
2504         PR gold/12979
2505         * options.h (class General_options): Add -Bgroup.
2506         * options.cc (General_options::finalize): If -Bgroup is set,
2507         default to --unresolved-symbols=report-all.
2508         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2509         * target-reloc.h (issue_undefined_symbol_error): Handle
2510         --unresolved-symbols=report-all.
2511
2512 2011-07-08  Ian Lance Taylor  <iant@google.com>
2513
2514         PR gold/11985
2515         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2516         if linker script discards key sections.
2517         (Layout::create_dynamic_symtab): Likewise.
2518         (Layout::assign_local_dynsym_offsets): Likewise.
2519         (Layout::sized_create_version_sections): Likewise.
2520         (Layout::create_interp): Likewise.
2521         (Layout::finish_dynamic_section): Likewise.
2522         (Layout::set_dynamic_symbol_size): Likewise.
2523
2524 2011-07-08  Ian Lance Taylor  <iant@google.com>
2525
2526         PR gold/12386
2527         * options.h (class General_options): Add --unresolved-symbols.
2528         * target-reloc.h (issue_undefined_symbol_error): Check
2529         --unresolved-symbols.  Add comments.
2530
2531 2011-07-08  Ian Lance Taylor  <iant@google.com>
2532
2533         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2534         expression more complex.
2535
2536 2011-07-08  Ian Lance Taylor  <iant@google.com>
2537
2538         PR gold/11317
2539         * target-reloc.h (issue_undefined_symbol_error): New inline
2540         function, broken out of relocate_section.
2541         (relocate_section): Call issue_undefined_symbol_error.
2542         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2543         there is no TLS segment if we are about to issue an undefined
2544         symbol error.
2545         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2546
2547 2011-07-08  Ian Lance Taylor  <iant@google.com>
2548
2549         PR gold/12279
2550         * resolve.cc (Symbol_table::should_override): Add fromtype
2551         parameter.  Change all callers.  Give error when linking together
2552         TLS and non-TLS symbol.
2553         (Symbol_table::should_override_with_special): Add fromtype
2554         parameter.  Change all callers.
2555         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2556         there is no TLS segment if we have reported some errors.
2557         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2558
2559 2011-07-08  Ian Lance Taylor  <iant@google.com>
2560
2561         PR gold/12372
2562         * target.h (Target::plt_address_for_global): New function.
2563         (Target::plt_address_for_local): New function.
2564         (Target::plt_section_for_global): Remove.
2565         (Target::plt_section_for_local): Remove.
2566         (Target::do_plt_address_for_global): New virtual function.
2567         (Target::do_plt_address_for_local): New virtual function.
2568         (Target::do_plt_section_for_global): Remove.
2569         (Target::do_plt_section_for_local): Remove.
2570         (Target::register_global_plt_entry): Add Symbol_table and Layout
2571         parameters.
2572         * output.cc (Output_data_got::Got_entry::write): Use
2573         plt_address_for_global and plt_address_for_local.
2574         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2575         address of output section.
2576         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2577         got_irelative_, and irelative_count_ fields.  Update
2578         declarations.
2579         (Output_data_plt_i386::has_irelative_section): New function.
2580         (Output_data_plt_i386::entry_count): Add irelative_count_.
2581         (Output_data_plt_i386::set_final_data_size): Likewise.
2582         (class Target_i386): Add got_irelative_ and rel_irelative_
2583         fields.  Update declarations.
2584         (Target_i386::Target_i386): Initialize new fields.
2585         (Target_i386::do_plt_address_for_global): New function replacing
2586         do_plt_section_for_global.
2587         (Target_i386::do_plt_address_for_local): New function replacing
2588         do_plt_section_for_local.
2589         (Target_i386::got_section): Create got_irelative_.
2590         (Target_i386::rel_irelative_section): New function.
2591         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2592         fields.  Don't define __rel_iplt_{start,end}.
2593         (Output_data_plt_i386::add_entry): Add symtab and layout
2594         parameters.  Change all callers.  Use different PLT and GOT for
2595         IFUNC symbols.
2596         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2597         layout parameters.  Change all callers.  Use different PLT and
2598         GOT.
2599         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2600         (Output_data_plt_i386::rel_irelative): New function.
2601         (Output_data_plt_i386::address_for_global): New function.
2602         (Output_data_plt_i386::address_for_local): New function.
2603         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2604         IRELATIVE GOT when changing IFUNC GOT entries.
2605         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2606         reloc.
2607         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2608         if we didn't create an IRELATIVE GOT.
2609         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2610         plt_address_for_local.
2611         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2612         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2613         got_irelative_, and irelative_count_ fields.  Update
2614         declarations.
2615         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2616         Initialize new fields.  Remove symtab parameter.  Change all
2617         callers.
2618         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2619         irelative_count_.
2620         (Output_data_plt_x86_64::has_irelative_section): New function.
2621         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2622         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2623         fields.  Update declarations.
2624         (Target_x86_64::Target_x86_64): Initialize new fields.
2625         (Target_x86_64::do_plt_address_for_global): New function replacing
2626         do_plt_section_for_global.
2627         (Target_x86_64::do_plt_address_for_local): New function replacing
2628         do_plt_section_for_local.
2629         (Target_x86_64::got_section): Create got_irelative_.
2630         (Target_x86_64::rela_irelative_section): New function.
2631         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2632         all callers.  Don't create __rel_iplt_{start,end}.
2633         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2634         parameters.  Change all callers.  Use different PLT and GOT for
2635         IFUNC symbols.
2636         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2637         layout parameters.  Change all callers.  Use different PLT and
2638         GOT.
2639         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2640         parameters.  Change all callers.  Use different PLT and GOT for
2641         IFUNC symbols.
2642         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2643         (Output_data_plt_x86_64::rela_irelative): New function.
2644         (Output_data_plt_x86_64::address_for_global): New function.
2645         (Output_data_plt_x86_64::address_for_local): New function.
2646         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2647         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2648         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2649         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2650         parameters.
2651         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2652         reloc.
2653         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2654         symbols if we didn't create an IRELATIVE GOT.
2655         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2656         plt_address_for_local.
2657         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2658         * testsuite/ifuncvar1.c: New test file.
2659         * testsuite/ifuncvar2.c: New test file.
2660         * testsuite/ifuncvar3.c: New test file.
2661         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2662         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2663         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2664         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2665         * testsuite/Makefile.in: Rebuild.
2666
2667 2011-07-07  Cary Coutant  <ccoutant@google.com>
2668
2669         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2670         (two_file_test_1_ndebug.o): Likewise.
2671         (two_file_test_1b_ndebug.o): Likewise.
2672         (two_file_test_2_ndebug.o): Likewise.
2673         (two_file_test_main_ndebug.o): Likewise.
2674         (incremental_test_2): Link with no-debug versions.
2675
2676 2011-07-06  Cary Coutant  <ccoutant@google.com>
2677
2678         * gold/incremental.cc
2679         (Output_section_incremental_inputs::write_info_blocks): Check for
2680         hidden and internal symbols.
2681
2682 2011-07-06  Cary Coutant  <ccoutant@google.com>
2683
2684         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2685         Check disposition for startup file.
2686         (Incremental_inputs::report_command_line): Ignore
2687         --incremental-startup-unchanged option.
2688         * options.cc (General_options::parse_incremental_startup_unchanged):
2689         New function.
2690         (General_options::General_options): Initialize new data member.
2691         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2692         (General_options): Add --incremental-startup-unchanged option.
2693         (General_options::incremental_startup_disposition): New function.
2694         (General_options::incremental_startup_disposition_): New data member.
2695
2696 2011-07-06  Cary Coutant  <ccoutant@google.com>
2697
2698         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2699         input file index to Script_info ctor.
2700         (Sized_incremental_binary::do_file_has_changed): Find the
2701         command-line argument for files named in scripts.
2702         * incremental.h (Script_info::Script_info): New ctor
2703         with input file index.
2704         (Script_info::input_file_index): New function.
2705         (Script_info::input_file_index_): New data member.
2706         (Incremental_binary::get_library): Add const.
2707         (Incremental_binary::get_script_info): Add const.
2708         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2709         * testsuite/Makefile.am (incremental_test_5): New test case.
2710         (incremental_test_6): New test case.
2711         * testsuite/Makefile.in: Regenerate.
2712
2713 2011-07-06  Cary Coutant  <ccoutant@google.com>
2714
2715         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2716         debug output when command lines differ.
2717
2718 2011-07-06  Cary Coutant  <ccoutant@google.com>
2719
2720         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2721         --incremental-patch option.
2722         * layout.cc (Free_list::allocate): Extend allocation beyond original
2723         end if enabled.
2724         (Layout::make_output_section): Mark sections that should get
2725         patch space.
2726         * options.cc (parse_percent): New function.
2727         * options.h (parse_percent): New function.
2728         (DEFINE_percent): New macro.
2729         (General_options): Add --incremental-patch option.
2730         * output.cc (Output_section::Output_section): Initialize new data
2731         members.
2732         (Output_section::add_input_section): Print section name when out
2733         of patch space.
2734         (Output_section::add_output_section_data): Likewise.
2735         (Output_section::set_final_data_size): Add patch space when
2736         doing --incremental-full.
2737         (Output_section::do_reset_address_and_file_offset): Remove patch
2738         space.
2739         (Output_segment::set_section_list_addresses): Print debug output
2740         only if --incremental-update.
2741         * output.h (Output_section::set_is_patch_space_allowed): New function.
2742         (Output_section::is_patch_space_allowed_): New data member.
2743         (Output_section::patch_space_): New data member.
2744         * parameters.cc (Parameters::incremental_full): New function.
2745         * parameters.h (Parameters::incremental_full): New function
2746         * testsuite/Makefile.am (incremental_test_2): Add test for
2747         --incremental-patch option.
2748         * testsuite/Makefile.in: Regenerate.
2749         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2750         (t18): Remove function body.
2751
2752 2011-07-05  Doug Kwan  <dougkwan@google.com>
2753
2754         PR gold/12771
2755         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2756         Arm_Address type for relocation result.
2757         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2758         overflow check.
2759         (Arm_relocate_functions::abs32): Use unaligned access.
2760         (Arm_relocate_functions::rel32): Ditto.
2761         (Arm_relocate_functions::prel31): Ditto.
2762         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2763         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2764         static data relocations.
2765         * testsuite/Makefile.in: Regnerate.
2766         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2767
2768 2011-07-05  Ian Lance Taylor  <iant@google.com>
2769
2770         PR gold/12392
2771         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2772         symbols if necessary.
2773         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2774
2775 2011-07-05  Ian Lance Taylor  <iant@google.com>
2776
2777         PR gold/12952
2778         * resolve.cc (Symbol::override_base_with_special): Simply override
2779         version with special symbol version, ignoring previous version.
2780
2781 2011-07-05  Ian Lance Taylor  <iant@google.com>
2782
2783         * object.cc (Sized_relobj_file::include_section_group): Add
2784         information to comment about signature location.
2785
2786 2011-07-02  Ian Lance Taylor  <iant@google.com>
2787
2788         PR gold/12957
2789         * options.h (class General_options): Add -f and -F.
2790         * options.cc (General_options::finalize): Fatal error if -f/-F
2791         are used without -shared.
2792         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2793
2794 2011-07-02  Ian Lance Taylor  <iant@google.com>
2795
2796         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2797
2798 2011-07-01  Ian Lance Taylor  <iant@google.com>
2799
2800         PR gold/12525
2801         PR gold/12952
2802         * resolve.cc (Symbol::override_base_with_special): Don't override
2803         the version if the overriding symbol has a different name.
2804         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2805         all callers.  If we give an error about an undefined version,
2806         define the base version if necessary.
2807         * dynobj.h (class Versions): Update declaration.
2808         * testsuite/weak_alias_test_5.cc: New file.
2809         * testsuite/weak_alias_test.script: New file.
2810         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2811         and versioned_alias have the right value, and call t2.
2812         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2813         weak_alias_test_5.so.
2814         (weak_alias_test_LDADD): Likewise.
2815         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2816         * testsuite/Makefile.in: Rebuild.
2817
2818 2011-07-01  Ian Lance Taylor  <iant@google.com>
2819
2820         PR gold/12525
2821         * options.h (class General_options): Support -z notext.
2822         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2823         -Wl,-z,notext.
2824         (two_file_shared_nonpic.so): Likewise.
2825         (two_file_shared_mixed.so): Likewise.
2826         (two_file_shared_mixed_1.so): Likewise.
2827         (weak_undef_lib_nonpic.so): Likewise.
2828         (alt/weak_undef_lib_nonpic.so): Likewise.
2829         (tls_test_shared_nonpic.so): Likewise.
2830         * testsuite/Makefile.in: Rebuild.
2831
2832 2011-07-01  Ian Lance Taylor  <iant@google.com>
2833
2834         PR gold/12525
2835         * configure.ac: Test whether static linking works, setting
2836         the automake conditional HAVE_STATIC.
2837         * testsuite/Makefile.am: Disable tests using -static if
2838         HAVE_STATIC is not true.
2839         * configure, testsuite/Makefile.in: Rebuild.
2840
2841 2011-07-01  Ian Lance Taylor  <iant@google.com>
2842
2843         PR gold/12525
2844         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2845         Assert if we see DW_EH_PE_indirect.
2846         * target.h (Target::ehframe_datarel_base): New function.
2847         (Target::do_ehframe_datarel_base): New target function.
2848         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2849         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2850         function.
2851
2852 2011-07-01  Ian Lance Taylor  <iant@google.com>
2853
2854         PR gold/12571
2855         * options.h (class General_options): Add
2856         --ld-generated-unwind-info.
2857         * ehframe.cc (Fde::write): Add address parameter.  Change all
2858         callers.  If associated with PLT, fill in address and size.
2859         (Cie::set_output_offset): Only add merge mapping if there is an
2860         object.
2861         (Cie::write): Add address parameter.  Change all callers.
2862         (Eh_frame::add_ehframe_for_plt): New function.
2863         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2864         input_offset_ fields into union u_, with new plt field.
2865         (Fde::Fde): Adjust for new union field.
2866         (Fde::Fde) [Output_data version]: New constructor.
2867         (Fde::add_mapping): Only add merge mapping if there is an object.
2868         (class Cie): Update declarations.
2869         (class Eh_frame): Declare add_ehframe_for_plt.
2870         * layout.cc (Layout::layout_eh_frame): Break out code into
2871         make_eh_frame_section, and call it.
2872         (Layout::make_eh_frame_section): New function.
2873         (Layout::add_eh_frame_for_plt): New function.
2874         * layout.h (class Layout): Update declarations.
2875         * merge.cc (Merge_map::add_mapping): Add assertion.
2876         * i386.cc: Include "dwarf.h".
2877         (class Output_data_plt_i386): Make first_plt_entry,
2878         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2879         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2880         and plt_eh_frame_fde.
2881         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2882         boundary.  Call add_eh_frame_for_plt if appropriate.
2883         * x86_64.cc: Include "dwarf.h".
2884         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2885         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2886         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2887         and plt_eh_frame_fde.
2888         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2889         appropriate.
2890
2891 2011-06-29  Ian Lance Taylor  <iant@google.com>
2892
2893         PR gold/12629
2894         * object.cc (Sized_relobj_file::layout_section): Change shdr
2895         parameter to be const.
2896         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2897         out of do_layout.
2898         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2899         appropriate.  Call layout_eh_frame_section.
2900         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2901         sections.
2902         * object.h (class Sized_relobj_file): Update declarations.
2903
2904 2011-06-29  Ian Lance Taylor  <iant@google.com>
2905
2906         PR gold/12652
2907         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2908         modifier.
2909         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2910
2911 2011-06-29  Ian Lance Taylor  <iant@google.com>
2912
2913         PR gold/12675
2914         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2915         SHT_X86_64_UNWIND.
2916         * layout.cc (Layout::layout_eh_frame): Likewise.
2917
2918 2011-06-29  Ian Lance Taylor  <iant@google.com>
2919
2920         PR gold/12695
2921         * layout.cc (Layout::symtab_section_shndx): New function.
2922         * layout.h (class Layout): Declare symtab_section_shndx.
2923         * output.cc (Output_section::write_header): Call it.
2924
2925 2011-06-29  Ian Lance Taylor  <iant@google.com>
2926
2927         PR gold/12818
2928         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2929         symbols which are not used in a relocation.
2930
2931 2011-06-28  Ian Lance Taylor  <iant@google.com>
2932
2933         PR gold/12898
2934         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2935         script create indistinguishable segments.
2936         (Layout::set_segment_offsets): Use stable_sort when sorting
2937         segments.  Pass this to Compare_segments constructor.
2938         * layout.h (class Layout): Make segment_precedes non-static.
2939         (class Compare_segments): Change from struct to class.  Add
2940         layout_ field.  Add constructor.
2941         * script-sections.cc
2942         (Script_sections::attach_sections_using_phdrs_clause): Rename
2943         local orphan to is_orphan.  Don't report failure to put empty
2944         section in segment.  On attachment failure, report name of
2945         section, and attach to first PT_LOAD segment.
2946
2947 2011-06-28  Ian Lance Taylor  <iant@google.com>
2948
2949         PR gold/12934
2950         * target-select.cc (Target_selector::Target_selector): Add
2951         emulation parameter.  Change all callers.
2952         (select_target_by_bfd_name): Rename from select_target_by_name.
2953         Change all callers.
2954         (select_target_by_emulation): New function.
2955         (supported_emulation_names): New function.
2956         * target-select.h (class Target_selector): Add emulation_ field.
2957         Update declarations.
2958         (Target_selector::recognize_by_bfd_name): Rename from
2959         recognize_by_name.  Change all callers.
2960         (Target_selector::supported_bfd_names): Rename from
2961         supported_names.  Change all callers.
2962         (Target_selector::recognize_by_emulation): New function.
2963         (Target_selector::supported_emulations): New function.
2964         (Target_selector::emulation): New function.
2965         (Target_selector::do_recognize_by_bfd_name): Rename from
2966         do_recognize_by_name.  Change all callers.
2967         (Target_selector::do_supported_bfd_names): Rename from
2968         do_supported_names.  Change all callers.
2969         (Target_selector::do_recognize_by_emulation): New function.
2970         (Target_selector::do_supported_emulations): New function.
2971         (select_target_by_bfd_name): Change name in declaration.
2972         (select_target_by_emulation): Declare.
2973         (supported_emulation_names): Declare.
2974         * parameters.cc (parameters_force_valid_target): Try to find
2975         target based on emulation from -m option.
2976         * options.h (class General_options): Change doc string for -m.
2977         * options.cc (help): Print emulations.
2978         (General_options::parse_V): Likewise.
2979         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2980         Add emulation parameter.  Change all callers.
2981
2982 2011-06-28  Ian Lance Taylor  <iant@google.com>
2983
2984         * target.h (class Target): Add osabi_ field.
2985         (Target::osabi): New function.
2986         (Target::set_osabi): New function.
2987         (Target::Target): Initialize osabi_.
2988         (Target::do_adjust_elf_header): Make pure virtual.
2989         (Sized_target::do_adjust_elf_header): Declare.
2990         * target.cc (Sized_target::do_adjust_elf_header): New function.
2991         (class Sized_target): Instantiate all versions.
2992         * freebsd.h (class Target_freebsd): Remove.
2993         (Target_selector_freebsd::do_recognize): Call set_osabi on
2994         Target.
2995         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2996         (Target_selector_freebsd::set_osabi): Remove.
2997         * i386.cc (class Target_i386): Inherit from Sized_target rather
2998         than Target_freebsd.
2999         * x86_64.cc (class Target_x86_64): Likewise.
3000
3001 2011-06-28  Ian Lance Taylor  <iant@google.com>
3002
3003         * target.h (Target::can_check_for_function_pointers): Rewrite.
3004         Make non-virtual.
3005         (Target::can_icf_inline_merge_sections): Likewise.
3006         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3007         (Target::Target_info): Add can_icf_inline_merge_sections field.
3008         (Target::do_can_check_for_function_pointers): New virtual
3009         function.
3010         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3011         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3012         from can_check_for_function_pointers, move in file.
3013         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3014         section_may_have_icf_unsafe_poineters, move in file.
3015         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3016         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3017         Rename from can_check_for_function_pointers, move in file.
3018         (Target_i386::can_icf_inline_merge_sections): Remove.
3019         (Target_i386::i386_info): Initialize
3020         can_icf_inline_merge_sections.
3021         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3022         Initialize can_icf_inline_merge_sections.
3023         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3024         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3025         Rename from can_check_for_function_pointers, move in file.
3026         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3027         (Target_x86_64::x86_64_info): Initialize
3028         can_icf_inline_merge_sections.
3029         * testsuite/testfile.cc (Target_test::test_target_info):
3030         Likewise.
3031         * icf.cc (get_section_contents): Correct formatting.
3032
3033 2011-06-27  Ian Lance Taylor  <iant@google.com>
3034
3035         * symtab.cc (Symbol::versioned_name): New function.
3036         (Symbol_table::add_to_final_symtab): Use versioned_name when
3037         appropriate.
3038         (Symbol_table::sized_write_symbol): Likewise.
3039         * symtab.h (class Symbol): Declare versioned_name.
3040         * stringpool.h (class Stringpool_template): Add variant of add
3041         which takes a std::basic_string.
3042         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3043         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3044         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3045         (ver_test_12.o): New target.
3046         * testsuite/Makefile.in: Rebuild.
3047
3048 2011-06-27  Doug Kwan  <dougkwan@google.com>
3049
3050         * arm.cc (Arm_relocate_functions::thm_jump8,
3051         Arm_relocate_functions::thm_jump11): Use a wider signed
3052         type to compute offset.
3053         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3054         arm_thm_jump8.
3055         * testsuite/Makefile.in: Regenerate.
3056         * testsuite/arm_branch_in_range.sh: Check test results of
3057         arm_thm_jump11 and arm_thm_jump8.
3058         * testsuite/arm_thm_jump11.s: New test source file.
3059         * testsuite/arm_thm_jump11.t: New linker script.
3060         * testsuite/arm_thm_jump8.s: New test source file.
3061         * testsuite/arm_thm_jump8.t: New linker script.
3062
3063 2011-06-24  Ian Lance Taylor  <iant@google.com>
3064
3065         * layout.cc: Include "object.h".
3066         (ctors_sections_in_init_array): New static variable.
3067         (Layout::is_ctors_in_init_array): New function.
3068         (Layout::layout): Add entry to ctors_sections_in_init_array if
3069         appropriate.
3070         * layout.h (class Layout): Declare is_ctors_in_init_array.
3071         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3072         is_ctors_reverse_view is set.
3073         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3074         all callers.  Set is_ctors_reverse_view field of View_size.
3075         (Sized_relobj_file::reverse_words): New function.
3076         * object.h (Sized_relobj_file::View_size): Add
3077         is_ctors_reverse_view field.
3078         (class Sized_relobj_file): Update declarations.
3079         * testsuite/initpri3.c: New test.
3080         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3081         initpri3b.
3082         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3083         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3084         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3085         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3086         * testsuite/Makefile.in: Rebuild.
3087
3088 2011-06-24  Cary Coutant  <ccoutant@google.com>
3089
3090         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3091         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3092         (debug_msg_cdebug.err): New targets.
3093         * testsuite/Makefile.in: Regenerate.
3094         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3095         Fix checks for link with shared library.
3096
3097 2011-06-24  Doug Kwan  <dougkwan@google.com>
3098
3099         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3100         skip empty text sections.
3101         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3102
3103 2011-06-22  Ian Lance Taylor  <iant@google.com>
3104
3105         PR gold/12910
3106         * options.h (class General_options): Add --ctors-in-init-array.
3107         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3108         friends as SHT_PROGBITS for merging sections.
3109         (Layout::layout): Remove special handling of .init_array and
3110         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3111         and .dtors if ctors_in_init_array.
3112         (Layout::make_output_section): Force correct section types for
3113         .init_array and friends.  Don't sort if doing relocatable link,
3114         Don't sort .ctors and .dtors if ctors_in_init_array.
3115         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3116         (Layout::output_section_name): Add relobj parameter.  Change all
3117         callers.  Handle .ctors. and .dtors. in code rather than table.
3118         Handle .ctors and .dtors if ctors_in_init_array.
3119         (Layout::match_file_name): New function, moved from output.cc.
3120         * layout.h (class Layout): Update declarations.
3121         * output.cc: Include "layout.h".
3122         (Input_section_sort_entry::get_priority): New function.
3123         (Input_section_sort_entry::match_file_name): Just call
3124         Layout::match_file_name.
3125         (Output_section::Input_section_sort_init_fini_compare::operator()):
3126         Handle .ctors and .dtors.  Sort by explicit priority rather than
3127         by name.
3128         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3129         * testsuite/initpri2.c: New test.
3130         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3131         (check_PROGRAMS): Add initpri2.
3132         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3133         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3134         * configure, testsuite/Makefile.in: Rebuild.
3135
3136 2011-06-19  Ian Lance Taylor  <iant@google.com>
3137
3138         PR gold/12880
3139         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3140         .interp section to a PT_INTERP segment even if we have seen a
3141         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3142         clause in a linker script.
3143         (Layout::finalize): Don't create a .interp section if we've
3144         already create a PT_INTERP segment.
3145         (Layout::create_interp): Always call choose_output_section (revert
3146         patch of 2011-06-17).  Don't create PT_INTERP segment.
3147         * script-sections.cc
3148         (Script_sections::create_note_and_tls_segments): Add a .interp
3149         section to a PT_INTERP segment even if we have seen a
3150         --dynamic-linker option.
3151
3152 2011-06-18  Ian Lance Taylor  <iant@google.com>
3153
3154         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3155         merely because a non-PT_LOAD segment has a dynamic reloc.
3156
3157 2011-06-18  Ian Lance Taylor  <iant@google.com>
3158
3159         * layout.cc (Layout::finish_dynamic_section): Don't create
3160         DT_FLAGS entry if not needed.
3161
3162 2011-06-18  Ian Lance Taylor  <iant@google.com>
3163
3164         PR gold/12745
3165         * layout.cc (Layout::layout_eh_frame): Correct handling of
3166         writable .eh_frame section.
3167
3168 2011-06-17  Ian Lance Taylor  <iant@google.com>
3169
3170         PR gold/12893
3171         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3172         symbol is redefined with the exact same object and value.
3173
3174 2011-06-17  Ian Lance Taylor  <iant@google.com>
3175
3176         PR gold/12880
3177         * layout.h (class Layout): Add interp_segment_ field.
3178         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3179         (Layout::attach_allocated_section_to_segment): If making shared
3180         library, put .interp section in PT_INTERP segment.
3181         (Layout::finalize): Also call create_interp if -dynamic-linker
3182         option was used.
3183         (Layout::create_interp): Assert that there is no PT_INTERP
3184         segment.  If not using a SECTIONS clause, use make_output_section.
3185         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3186         * script-sections.cc
3187         (Script_sections::create_note_and_tls_segments): If making shared
3188         library, put .interp section in PT_INTERP segment.
3189
3190 2011-06-17  Ian Lance Taylor  <iant@google.com>
3191
3192         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3193         when making a shared library.
3194
3195 2011-06-17  Ian Lance Taylor  <iant@google.com>
3196
3197         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3198         parameter.  Change all callers.  Don't issue warning about PC32
3199         against locally defined symbol.
3200
3201 2011-06-16  Ian Lance Taylor  <iant@google.com>
3202
3203         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3204         occurs in same object.
3205
3206 2011-06-14  Alan Modra  <amodra@gmail.com>
3207
3208         * po/POTFILES.in: Regenerate.
3209
3210 2011-06-09  Ian Lance Taylor  <iant@google.com>
3211
3212         * script-sections.cc
3213         (Orphan_output_section::set_section_addresses): For a relocatable
3214         link set address to 0.
3215
3216 2011-06-09  Cary Coutant  <ccoutant@google.com>
3217
3218         PR gold/12804
3219         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3220         used with --compress-debug-sections.
3221         * gold/object.cc (Sized_relobj_file::do_layout): Report
3222         uncompressed size of compressed input sections.
3223
3224 2011-06-08  Cary Coutant  <ccoutant@google.com>
3225
3226         PR gold/12804
3227         * testsuite/two_file_test_2_v1.cc: Change initialization of
3228         v2 to keep it in .data.
3229
3230 2011-06-07  Cary Coutant  <ccoutant@google.com>
3231
3232         * common.cc (Symbol_table::do_allocate_commons_list): Call
3233         gold_fallback.
3234         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3235         (Errors::fallback): New function.
3236         (gold_fallback): New function.
3237         * errors.h (Errors::fallback): New function.
3238         * gold.cc (gold_exit): Change status parameter to enum; adjust
3239         all callers.
3240         (queue_initial_tasks): Call gold_fallback.
3241         * gold.h: Include cstdlib.
3242         (Exit_status): New enum type.
3243         (gold_exit): Change status parameter to enum.
3244         (gold_fallback): New function.
3245         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3246         (Layout::create_symtab_sections): Likewise.
3247         (Layout::create_shdrs): Likewise.
3248         * main.cc (main): Adjust call to gold_exit.
3249         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3250         (Output_data_got::add_got_entry_pair): Likewise.
3251         (Output_section::add_input_section): Likewise.
3252         (Output_section::add_output_section_data): Likewise.
3253         (Output_segment::set_section_list_addresses): Likewise.
3254         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3255
3256 2011-06-07  Cary Coutant  <ccoutant@google.com>
3257
3258         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3259         for incremental links.
3260         * output.cc (Output_segment::set_section_list_addresses): Remove
3261         FIXME and test for TLS or BSS.
3262
3263 2011-06-07  Cary Coutant  <ccoutant@google.com>
3264
3265         * testsuite/Makefile.am: Add incremental_copy_test,
3266         incremental_common_test_1.
3267         * testsuite/Makefile.in: Regenerate.
3268         * testsuite/common_test_1_v1.c: New source file.
3269         * testsuite/common_test_1_v2.c: New source file.
3270         * testsuite/copy_test_v1.cc: New source file.
3271
3272 2011-06-07  Cary Coutant  <ccoutant@google.com>
3273
3274         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3275         update, allocate common from bss section's free list.
3276         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3277         linker-defined symbols.
3278         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3279         Skip GOT and PLT entries that are no longer referenced.
3280         (Output_section_incremental_inputs::write_info_blocks): Mark
3281         linker-defined symbols.
3282         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3283         * output.cc (Output_section::allocate): New function.
3284         * output.h (Output_section::allocate): New function.
3285         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3286         linker-defined symbols.
3287         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3288         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3289         (Symbol::init_base_output_data): Likewise.
3290         (Symbol::init_base_output_segment): Likewise.
3291         (Symbol::init_base_constant): Likewise.
3292         (Sized_symbol::init_output_data): Likewise.
3293         (Sized_symbol::init_output_segment): Likewise.
3294         (Sized_symbol::init_constant): Likewise.
3295         (Symbol_table::do_define_in_output_data): Likewise.
3296         (Symbol_table::do_define_in_output_segment): Likewise.
3297         (Symbol_table::do_define_as_constant): Likewise.
3298         * symtab.h (Symbol::is_predefined): New function.
3299         (Symbol::init_base_output_data): Add is_predefined parameter.
3300         (Symbol::init_base_output_segment): Likewise.
3301         (Symbol::init_base_constant): Likewise.
3302         (Symbol::is_predefined_): New data member.
3303         (Sized_symbol::init_output_data): Add is_predefined parameter.
3304         (Sized_symbol::init_output_segment): Likewise.
3305         (Sized_symbol::init_constant): Likewise.
3306         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3307
3308 2011-06-07  Cary Coutant  <ccoutant@google.com>
3309
3310         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3311         instead of emit_copy_reloc.
3312         (Copy_relocs::emit_copy_reloc): Refactor.
3313         (Copy_relocs::make_copy_reloc): New function.
3314         (Copy_relocs::add_copy_reloc): Remove.
3315         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3316         section.
3317         (Copy_relocs::make_copy_reloc): New function.
3318         (Copy_relocs::add_copy_reloc): Remove.
3319         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3320         unchanged input files.
3321         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3322         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3323         Reserve BSS space for COPY relocations.
3324         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3325         (Output_section_incremental_inputs::write_info_blocks): Record
3326         whether a symbol is copied from a shared object.
3327         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3328         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3329         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3330         (Incremental_input_entry_reader::get_output_symbol_index): Add
3331         is_copy parameter.
3332         (Incremental_binary::emit_copy_relocs): New function.
3333         (Incremental_binary::do_emit_copy_relocs): New function.
3334         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3335         new data member.
3336         (Sized_incremental_binary::add_copy_reloc): New function.
3337         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3338         (Sized_incremental_binary::Copy_reloc): New struct.
3339         (Sized_incremental_binary::Copy_relocs): New typedef.
3340         (Sized_incremental_binary::copy_relocs_): New data member.
3341         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3342         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3343         * target.h (Sized_target::emit_copy_reloc): New function.
3344         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3345
3346 2011-06-02  Cary Coutant  <ccoutant@google.com>
3347
3348         PR gold/12163
3349         * gold/archive.cc (Archive::Archive): Initialize new data member.
3350         (Archive::include_all_members): Return if archive has already been
3351         included.
3352         * gold/archive.h (Archive::include_all_members_): New data member.
3353
3354 2011-06-02  Nick Clifton  <nickc@redhat.com>
3355
3356         * dynobj.h: Fix spelling mistake in comment.
3357         * output.cc: Likewise.
3358
3359 2011-05-31  Doug Kwan  <dougkwan@google.com>
3360             Asier Llano
3361
3362         PR gold/12826
3363         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3364         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3365         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3366         redundant arm_exidx_test.so.
3367         * testsuite/Makefile.in: Regenerate.
3368         (check_SCRIPTS): Add pr12826.sh
3369         (check_DATA): Add pr12826.stdout
3370         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3371         * testsuite/pr12826.sh: New file.
3372         * testsuite/pr12826_1.s: Ditto.
3373         * testsuite/pr12826_1.s: Ditto.
3374
3375 2011-05-30  Ian Lance Taylor  <iant@google.com>
3376
3377         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3378         sections.
3379
3380 2011-05-29  Ian Lance Taylor  <iant@google.com>
3381
3382         PR gold/12804
3383         * testsuite/Makefile.am: Use different file name for two_file_test
3384         temporary file for each incremental test.
3385         * testsuite/Makefile.in: Rebuild.
3386
3387 2011-05-29  Ian Lance Taylor  <iant@google.com>
3388
3389         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3390         binary input file is empty.
3391
3392 2011-05-27  Ian Lance Taylor  <iant@google.com>
3393
3394         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3395         (ver_test_9.so): Likewise.
3396         * testsuite/Makefile.in: Rebuild.
3397
3398 2011-05-26 Cary Coutant  <ccoutant@google.com>
3399
3400         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3401         * incremental.cc (Incremental_inputs::report_input_section): Fix
3402         comment, indentation.
3403         (Incremental_inputs::report_comdat_group): New function.
3404         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3405         of data for incremental input file entry.
3406         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3407         group count, COMDAT group signatures.
3408         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3409         an unchanged input file.
3410         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3411         Initialize new data member.
3412         (Incremental_object_entry::add_comdat_group): New function.
3413         (Incremental_object_entry::get_comdat_group_count): New function.
3414         (Incremental_object_entry::get_comdat_signature_key): New function.
3415         (Incremental_object_entry::groups_): New data member.
3416         (Incremental_inputs::report_comdat_group): New function.
3417         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3418         data for incremental input file entry.
3419         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3420         (Incremental_input_entry_reader::get_input_section): Adjust size of
3421         data for incremental input file entry.
3422         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3423         (Incremental_input_entry_reader::get_comdat_group_signature): New
3424         function.
3425         * object.cc (Sized_relobj::include_section_group): Report kept
3426         COMDAT groups for incremental links.
3427
3428 2011-05-24  David Meyer  <pdox@google.com>
3429
3430         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3431         with name parameter.  Add found_name parameter.
3432         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3433         * dirsearch.h (class Dirsearch): Update declaration.
3434
3435 2011-05-24  Ian Lance Taylor  <iant@google.com>
3436
3437         * archive.cc (Library_base::should_include_member): Pull in object
3438         from archive if it defines the entry symbol.
3439         * parameters.cc (Parameters::entry): New function.
3440         * parameters.h (class Parameters): Declare entry.
3441         * output.h (class Output_file_header): Remove entry_ field.
3442         * output.cc (Output_file_header::Output_file_header): Remove entry
3443         parameter.  Change all callers.
3444         (Output_file_header::entry): Use parameters->entry.
3445         * gold.cc (queue_middle_tasks): Likewise.
3446         * plugin.cc (Plugin_hook::run): Likewise.
3447
3448 2011-05-24 Cary Coutant  <ccoutant@google.com>
3449
3450         * gold.cc (queue_initial_tasks): Pass incremental base filename
3451         to Output_file::open_base_file; don't print error message.
3452         * incremental-dump.cc (main): Adjust call to
3453         Output_file::open_for_modification.
3454         * incremental-dump.cc (main): Likewise.
3455         * incremental.cc (Incremental_inputs::report_command_line):
3456         Ignore --incremental-base option when comparing command lines.
3457         Ignore parameter when given as separate argument.
3458         * options.h (class General_options): Add --incremental-base.
3459         * output.cc (Output_file::Output_file):
3460         (Output_file::open_base_file): Add base_name and writable parameters;
3461         read base file into new file; print error message here.
3462         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3463         callers.
3464         * output.h (Output_file::open_for_modification): Rename to...
3465         (Output_file::open_base_file): ...this; add base_name and
3466         writable parameters; adjust all callers.
3467         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3468         callers.
3469         * testsuite/Makefile.am (incremental_test_4): Test
3470         --incremental-base.
3471         * testsuite/Makefile.in: Regenerate.
3472
3473 2011-05-24 Cary Coutant  <ccoutant@google.com>
3474
3475         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3476         incremental_test_4.
3477         * testsuite/Makefile.in: Regenerate.
3478         * testsuite/two_file_test_1_v1.cc: New test source file.
3479         * testsuite/two_file_test_1b_v1.cc: New test source file.
3480         * testsuite/two_file_test_2_v1.cc: New test source file.
3481
3482 2011-05-24 Cary Coutant  <ccoutant@google.com>
3483
3484         * dynobj.h (Dynobj::do_dynobj): New function.
3485         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3486         flag and soname for shared objects.
3487         * incremental.cc (Incremental_inputs::report_object): Make
3488         either Incremental_object_entry or Incremental_dynobj_entry; add
3489         soname to string table.
3490         (Incremental_inputs::report_input_section): Add assertion.
3491         (Output_section_incremental_inputs::set_final_data_size): Adjust
3492         type of input file entry for shared libraries; adjust size of
3493         shared library info entry.
3494         (Output_section_incremental_inputs::write_input_files): Write
3495         as_needed flag for shared libraries.
3496         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3497         of input file entry for shared libraries; write soname.
3498         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3499         soname from incremental info.
3500         * incremental.h (enum Incremental_input_flags): Add
3501         INCREMENTAL_INPUT_AS_NEEDED.
3502         (Incremental_input_entry::Incremental_input_entry): Initialize new
3503         data member.
3504         (Incremental_input_entry::set_as_needed): New function.
3505         (Incremental_input_entry::as_needed): New function.
3506         (Incremental_input_entry::do_dynobj_entry): New function.
3507         (Incremental_input_entry::as_needed_): New data member.
3508         (Incremental_object_entry::Incremental_object_entry): Don't check
3509         for shared library.
3510         (Incremental_object_entry::do_type): Likewise.
3511         (class Incremental_dynobj_entry): New class.
3512         (Incremental_input_entry_reader::as_needed): New function.
3513         (Incremental_input_entry_reader::get_soname): New function.
3514         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3515         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3516         size of shared library info entry.
3517         * layout.cc (Layout::finish_dynamic_section): Don't test for
3518         incremental link when adding DT_NEEDED entries.
3519         * object.h (Object::Object): Initialize new data member.
3520         (Object::dynobj): New function.
3521         (Object::set_as_needed): New function.
3522         (Object::as_needed): New function.
3523         (Object::do_dynobj): New function.
3524         (Object::as_needed_): New data member.
3525
3526 2011-05-24 Cary Coutant  <ccoutant@google.com>
3527
3528         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3529         info; adjust display of GOT entries.
3530         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3531         vector of input objects; remove file_status_.
3532         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3533         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3534         got_plt reader; call target hooks to reserve GOT entries.
3535         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3536         of input file info header and GOT info entry.
3537         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3538         relocation info.
3539         (Got_plt_view_info::got_descriptor): Remove.
3540         (Got_plt_view_info::sym_index): New data member.
3541         (Got_plt_view_info::input_index): New data member.
3542         (Local_got_offset_visitor::visit): Write input file index.
3543         (Global_got_offset_visitor::visit): Write 0 for input file index.
3544         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3545         with sym_index and input_index.
3546         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3547         incremental info GOT entry; replace got_descriptor with input_index.
3548         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3549         map from input file index to object.
3550         (Sized_relobj_incr::do_layout): Replace direct data member reference
3551         with accessor function.
3552         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3553         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3554         Adjust size of input file info header.
3555         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3556         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3557         (Incremental_input_entry_reader::get_input_section): Adjust size of
3558         input file info header.
3559         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3560         of incremental info GOT entry.
3561         (Incremental_got_plt_reader::get_got_desc): Remove.
3562         (Incremental_got_plt_reader::get_got_symndx): New function.
3563         (Incremental_got_plt_reader::get_got_input_index): New function.
3564         (Sized_incremental_binary::Sized_incremental_binary): Remove
3565         file_status_; add input_objects_.
3566         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3567         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3568         (Sized_incremental_binary::file_is_unchanged): Remove.
3569         (Sized_incremental_binary::set_input_object): New function.
3570         (Sized_incremental_binary::input_object): New function.
3571         (Sized_incremental_binary::file_status_): Remove.
3572         (Sized_incremental_binary::input_objects_): New data member.
3573         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3574         references.
3575         (Sized_relobj_incr::invalid_address): Move to base class.
3576         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3577         class.
3578         (Sized_relobj_incr::do_output_section_offset): Likewise.
3579         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3580         (Sized_relobj_incr::section_offsets_): Likewise.
3581         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3582         function.
3583         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3584         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3585         with accessor function.
3586         (Sized_relobj_file::do_layout): Likewise.
3587         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3588         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3589         (Sized_relobj_file::compute_final_local_value): Replace refs to
3590         section_offsets_ with accessor function.
3591         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3592         * object.h (Relobj::Relobj): Initialize new data members.
3593         (Relobj::add_dyn_reloc): New function.
3594         (Relobj::first_dyn_reloc): New function.
3595         (Relobj::dyn_reloc_count): New function.
3596         (Relobj::first_dyn_reloc_): New data member.
3597         (Relobj::dyn_reloc_count_): New data member.
3598         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3599         references.
3600         (Sized_relobj::Address): New typedef.
3601         (Sized_relobj::invalid_address): Move here from child class.
3602         (Sized_relobj::Sized_relobj): Initialize new data members.
3603         (Sized_relobj::sized_relobj): New function.
3604         (Sized_relobj::is_output_section_offset_invalid): Move here from
3605         child class.
3606         (Sized_relobj::get_output_section_offset): Likewise.
3607         (Sized_relobj::local_has_got_offset): Likewise.
3608         (Sized_relobj::local_got_offset): Likewise.
3609         (Sized_relobj::set_local_got_offset): Likewise.
3610         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3611         (Sized_relobj::clear_got_offsets): New function.
3612         (Sized_relobj::section_offsets): Move here from child class.
3613         (Sized_relobj::do_output_section_offset): Likewise.
3614         (Sized_relobj::do_set_section_offset): Likewise.
3615         (Sized_relobj::Local_got_offsets): Likewise.
3616         (Sized_relobj::local_got_offsets_): Likewise.
3617         (Sized_relobj::section_offsets_): Likewise.
3618         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3619         references.
3620         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3621         class.
3622         (Sized_relobj_file::sized_relobj): New function
3623         (Sized_relobj_file::local_has_got_offset): Move to base class.
3624         (Sized_relobj_file::local_got_offset): Likewise.
3625         (Sized_relobj_file::set_local_got_offset): Likewise.
3626         (Sized_relobj_file::get_output_section_offset): Likewise.
3627         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3628         (Sized_relobj_file::do_output_section_offset): Likewise.
3629         (Sized_relobj_file::do_set_section_offset): Likewise.
3630         (Sized_relobj_file::Local_got_offsets): Likewise.
3631         (Sized_relobj_file::local_got_offsets_): Likewise.
3632         (Sized_relobj_file::section_offsets_): Likewise.
3633         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3634         (all constructors).
3635         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3636         (Output_reloc::get_symbol_index): Likewise.
3637         (Output_reloc::local_section_offset): Likewise.
3638         (Output_reloc::get_address): Likewise.
3639         (Output_reloc::symbol_value): Likewise.
3640         (Output_data_got::reserve_slot): Move to class definition.
3641         (Output_data_got::reserve_local): New function.
3642         (Output_data_got::reserve_slot_for_global): Remove.
3643         (Output_data_got::reserve_global): New function.
3644         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3645         (all constructors, two instantiations).
3646         (Output_reloc::get_relobj): New function (two instantiations).
3647         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3648         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3649         (Output_data_reloc::add_global): Adjust type of relobj.
3650         (Output_data_reloc::add_global_relative): Likewise.
3651         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3652         (Output_data_reloc::add_local): Likewise.
3653         (Output_data_reloc::add_local_relative): Likewise.
3654         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3655         (Output_data_reloc::add_local_section): Likewise.
3656         (Output_data_reloc::add_output_section): Likewise.
3657         (Output_data_reloc::add_absolute): Likewise.
3658         (Output_data_reloc::add_target_specific): Likewise.
3659         (Output_data_got::reserve_slot): Move definition here.
3660         (Output_data_got::reserve_local): New function.
3661         (Output_data_got::reserve_global): New function.
3662         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3663         section_offsets_ with accessor function.
3664         (Sized_relobj_file::write_sections): Likewise.
3665         (Sized_relobj_file::do_relocate_sections): Likewise.
3666         * target.h (Sized_target::reserve_local_got_entry): New function.
3667         (Sized_target::reserve_global_got_entry): New function.
3668         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3669         (Target_x86_64::reserve_global_got_entry): New function.
3670         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3671
3672 2011-05-23 Cary Coutant  <ccoutant@google.com>
3673
3674         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3675         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3676         bit when checking got_type.
3677         * incremental.cc (Sized_incremental_binary::setup_readers):
3678         Store symbol table and string table locations; initialize bit vector
3679         of file status flags.
3680         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3681         unchanged files.
3682         (Sized_incremental_binary::do_process_got_plt): New function.
3683         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3684         (Output_section_incremental_inputs::set_final_data_size): Record
3685         file index for each input file.
3686         (Output_section_incremental_inputs::write_got_plt): Store file index
3687         instead of input entry offset for each GOT entry.
3688         * incremental.h
3689         (Incremental_input_entry::Incremental_input_entry): Initialize new
3690         data member.
3691         (Incremental_input_entry::set_offset): Store file index.
3692         (Incremental_input_entry::get_file_index): New function.
3693         (Incremental_input_entry::file_index_): New data member.
3694         (Incremental_binary::process_got_plt): New function.
3695         (Incremental_binary::do_process_got_plt): New function.
3696         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3697         data members.
3698         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3699         (Sized_incremental_binary::set_file_is_unchanged): New function.
3700         (Sized_incremental_binary::file_is_unchanged): New function.
3701         (Sized_incremental_binary::do_process_got_plt): New function.
3702         (Sized_incremental_binary::file_status_): New data member.
3703         (Sized_incremental_binary::main_symtab_loc_): New data member.
3704         (Sized_incremental_binary::main_strtab_loc_): New data member.
3705         * output.cc (Output_data_got::Got_entry::write): Add case
3706         RESERVED_CODE.
3707         (Output_data_got::add_global): Call add_got_entry.
3708         (Output_data_got::add_global_plt): Likewise.
3709         (Output_data_got::add_global_with_rel): Likewise.
3710         (Output_data_got::add_global_with_rela): Likewise.
3711         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3712         (Output_data_got::add_global_pair_with_rela): Likewise.
3713         (Output_data_got::add_local): Call add_got_entry.
3714         (Output_data_got::add_local_plt): Likewise.
3715         (Output_data_got::add_local_with_rel): Likewise.
3716         (Output_data_got::add_local_with_rela): Likewise.
3717         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3718         (Output_data_got::add_local_pair_with_rela): Likewise.
3719         (Output_data_got::reserve_slot): New function.
3720         (Output_data_got::reserve_slot_for_global): New function.
3721         (Output_data_got::add_got_entry): New function.
3722         (Output_data_got::add_got_entry_pair): New function.
3723         (Output_section::add_output_section_data): Edit FIXME.
3724         * output.h
3725         (Output_section_data_build::Output_section_data_build): New
3726         constructor with size parameter.
3727         (Output_data_space::Output_data_space): Likewise.
3728         (Output_data_got::Output_data_got): Initialize new data member; new
3729         constructor with size parameter.
3730         (Output_data_got::add_constant): Call add_got_entry.
3731         (Output_data_got::reserve_slot): New function.
3732         (Output_data_got::reserve_slot_for_global): New function.
3733         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3734         (Output_data_got::add_got_entry): New function.
3735         (Output_data_got::add_got_entry_pair): New function.
3736         (Output_data_got::free_list_): New data member.
3737         * target.h (Sized_target::init_got_plt_for_update): New function.
3738         (Sized_target::register_global_plt_entry): New function.
3739         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3740         Initialize new data member; call init; add constructor with PLT count.
3741         (Output_data_plt_x86_64::init): New function.
3742         (Output_data_plt_x86_64::add_relocation): New function.
3743         (Output_data_plt_x86_64::reserve_slot): New function.
3744         (Output_data_plt_x86_64::free_list_): New data member.
3745         (Target_x86_64::init_got_plt_for_update): New function.
3746         (Target_x86_64::register_global_plt_entry): New function.
3747         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3748         incremental updates.
3749         (Output_data_plt_x86_64::add_relocation): New function.
3750         * testsuite/object_unittest.cc (Object_test): Set default options.
3751
3752 2011-05-16  Ian Lance Taylor  <iant@google.com>
3753
3754         * options.h (class General_options): Make -i a synonym for -r.
3755
3756 2011-05-16  Ian Lance Taylor  <iant@google.com>
3757
3758         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3759
3760 2011-05-10 Cary Coutant  <ccoutant@google.com>
3761
3762         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3763         strip_all (-s).
3764
3765 2011-05-06  Ian Lance Taylor  <iant@google.com>
3766
3767         * layout.cc (Layout::layout): If the output section flags change,
3768         update the ordering.
3769
3770 2011-04-25 Cary Coutant  <ccoutant@google.com>
3771
3772         * incremental-dump.cc (dump_incremental_inputs): Print local
3773         symbol info for each input file.
3774         * incremental.cc
3775         (Output_section_incremental_inputs::set_final_data_size): Add local
3776         symbol info to input file entries in incremental info.
3777         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3778         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3779         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3780         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3781         implementation.
3782         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3783         (Sized_incr_relobj::do_relocate): Write the local symbols.
3784         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3785         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3786         Adjust size of input file header.
3787         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3788         (Incremental_inputs_reader::get_local_symbol_count): New function.
3789         (Incremental_inputs_reader::get_input_section): Adjust size of input
3790         file header.
3791         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3792         (Sized_incr_relobj::This): New typedef.
3793         (Sized_incr_relobj::sym_size): New const data member.
3794         (Sized_incr_relobj::Local_symbol): New struct.
3795         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3796         (Sized_incr_relobj::do_local_symbol_offset): New function.
3797         (Sized_incr_relobj::local_symbol_count_): New data member.
3798         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3799         (Sized_incr_relobj::local_symbol_index_): New data member.
3800         (Sized_incr_relobj::local_symbol_offset_): New data member.
3801         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3802         (Sized_incr_relobj::local_symbols_): New data member.
3803         * object.h (Relobj::output_local_symbol_count): New function.
3804         (Relobj::local_symbol_offset): New function.
3805         (Relobj::do_output_local_symbol_count): New function.
3806         (Relobj::do_local_symbol_offset): New function.
3807         (Sized_relobj::do_output_local_symbol_count): New function.
3808         (Sized_relobj::do_local_symbol_offset): New function.
3809
3810 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3811
3812         * descriptors.cc (set_close_on_exec): New function.
3813         (Descriptors::open): Use set_close_on_exec.
3814         * output.cc (S_ISLNK): Define if not defined.
3815
3816 2011-04-22 Cary Coutant  <ccoutant@google.com>
3817
3818         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3819         global symbol map.
3820         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3821         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3822         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3823         relocations.
3824         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3825         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3826         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3827         * incremental.h
3828         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3829         function.
3830         (Incremental_binary::apply_incremental_relocs): New function.
3831         (Incremental_binary::do_apply_incremental_relocs): New function.
3832         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3833         data member.
3834         (Sized_incremental_binary::add_global_symbol): New function.
3835         (Sized_incremental_binary::global_symbol): New function.
3836         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3837         (Sized_incremental_binary::symbol_map_): New data member.
3838         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3839         * target.h (Sized_target::apply_relocation): New function.
3840         * target-reloc.h (apply_relocation): New function.
3841         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3842
3843 2011-04-22  Doug Kwan  <dougkwan@google.com>
3844
3845         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3846         flag of a SHT_ARM_EXIDX section.
3847         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3848         * testsuite/Makefile.in: Regenerate.
3849         * testsuite/arm_exidx_test.s: New file.
3850         * testsuite/arm_exidx_test.sh: Same.
3851
3852 2011-04-20 Cary Coutant  <ccoutant@google.com>
3853
3854         PR gold/12689
3855         * archive.h (Incremental_archive_entry::Archive_member):
3856         Initialize arg_serial_ (second constructor).
3857
3858 2011-04-17  Ian Lance Taylor  <iant@google.com>
3859
3860         * object.cc (Relocate_info::location): Simplify location string.
3861         * errors.cc (Errors::error_at_location): Don't print program
3862         name.
3863         (Errors::warning_at_location): Likewise.
3864         (Errors::undefined_symbol): Likewise.
3865         * testsuite/debug_msg.sh: Update accordingly.
3866
3867 2011-04-14 Cary Coutant  <ccoutant@google.com>
3868
3869         * gold/layout.cc (Layout::symtab_section_offset): New function.
3870         * gold/layout.h (Layout::symtab_section_offset): New function.
3871         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3872
3873 2011-04-12  Ian Lance Taylor  <iant@google.com>
3874
3875         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3876         with MREMAP_MAYMOVE.
3877         * output.h (class Output_file): Add map_is_allocated_ field.
3878         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3879         not available, provide stubs.  If mremap is not available, #define
3880         it to gold_mremap.
3881         (MREMAP_MAYMOVE): Define if not defined.
3882         (Output_file::Output_file): Initialize map_is_allocated_.
3883         (Output_file::resize): Check map_is_allocated_.
3884         (Output_file::map_anonymous): If mmap fails, use malloc.
3885         (Output_file::unmap): Don't do anything for an anonymous map.
3886         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3887         is not available, provide stubs.
3888         (File_read::View::~View): Use free rather than delete[].
3889         (File_read::make_view): Use malloc rather than new[].  If mmap
3890         fails, use malloc.
3891         (File_read::find_or_make_view): Use malloc rather than new[].
3892         * gold.h: Remove HAVE_REMAP code.
3893         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3894         exists.  Rename mremap to gold_mremap.  If mmap is not available
3895         don't do anything.
3896         * configure, config.in: Rebuild.
3897
3898 2011-04-11  Ian Lance Taylor  <iant@google.com>
3899
3900         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3901         initialize local variable v.
3902
3903 2011-04-11  Cary Coutant  <ccoutant@google.com>
3904
3905         * archive.cc (Archive::include_member): Adjust call to
3906         report_object.
3907         (Add_archive_symbols::run): Track argument serial numbers.
3908         (Lib_group::include_member): Likewise.
3909         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3910         * archive.h (Incremental_archive_entry::Archive_member):
3911         Initialize arg_serial_.
3912         (Archive_member::arg_serial_): New data member.
3913         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3914         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3915         incremental link.
3916         (Sized_dynobj::do_for_all_local_got_entries): New function.
3917         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3918         function.
3919         * fileread.cc (get_mtime): New function.
3920         * fileread.h (get_mtime): New function.
3921         * gold.cc (queue_initial_tasks): Check for incremental update.
3922         (process_incremental_input): New function.
3923         (queue_middle_tasks): Don't force valid target for incremental
3924         update.
3925         * incremental-dump.cc (find_input_containing_global): Adjust
3926         size of symbol info entry.
3927         (dump_incremental_inputs): Dump argument serial number and
3928         in_system_directory flag; bias shndx by 1; print symbol names
3929         when dumping per-file symbol lists; use new symbol info readers.
3930         * incremental.cc
3931         (Output_section_incremental_inputs:update_data_size): New function.
3932         (Sized_incremental_binary::setup_readers): Setup input readers
3933         for each input file; build maps for files added from libraries
3934         and scripts.
3935         (Sized_incremental_binary::check_input_args): New function.
3936         (Sized_incremental_binary::do_check_inputs): Build map of argument
3937         serial numbers to input arguments.
3938         (Sized_incremental_binary::do_file_has_changed): Rename
3939         do_file_is_unchanged to this; compare file modification times.
3940         (Sized_incremental_binary::do_init_layout): New function.
3941         (Sized_incremental_binary::do_reserve_layout): New function.
3942         (Sized_incremental_binary::do_get_input_reader): Remove.
3943         (Sized_incremental_binary::get_symtab_view): New function.
3944         (Incremental_checker::can_incrementally_link_output_file): Remove.
3945         (Incremental_inputs::report_command_line): Exclude --debug options.
3946         (Incremental_inputs::report_archive_begin): Add parameter; track
3947         argument serial numbers; don't put input file entry for archive
3948         before archive members.
3949         (Incremental_inputs::report_archive_end): Put input file entry
3950         for archive after archive members.
3951         (Incremental_inputs::report_object): Add parameter; track argument
3952         serial numbers and in_system_directory flag.
3953         (Incremental_inputs::report_script): Add parameter; track argument
3954         serial numbers.
3955         (Output_section_incremental_inputs::set_final_data_size): Adjust
3956         size of symbol info entry; check for forwarding symbols.
3957         (Output_section_incremental_inputs::write_input_files): Write
3958         in_system_directory flag and argument serial number.
3959         (Output_section_incremental_inputs::write_info_blocks): Map section
3960         indices between incremental info and original input file; store
3961         input section index for each symbol.
3962         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3963         change operator() to visit().
3964         (class Global_got_offset_visitor): Likewise.
3965         (class Global_symbol_visitor_got_plt):
3966         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3967         classes.
3968         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3969         (Sized_incr_relobj::do_read_symbols): New function.
3970         (Sized_incr_relobj::do_layout): New function.
3971         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3972         (Sized_incr_relobj::do_add_symbols): New function.
3973         (Sized_incr_relobj::do_should_include_member): New function.
3974         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3975         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3976         (Sized_incr_relobj::do_section_size): New function.
3977         (Sized_incr_relobj::do_section_name): New function.
3978         (Sized_incr_relobj::do_section_contents): New function.
3979         (Sized_incr_relobj::do_section_flags): New function.
3980         (Sized_incr_relobj::do_section_entsize): New function.
3981         (Sized_incr_relobj::do_section_address): New function.
3982         (Sized_incr_relobj::do_section_type): New function.
3983         (Sized_incr_relobj::do_section_link): New function.
3984         (Sized_incr_relobj::do_section_info): New function.
3985         (Sized_incr_relobj::do_section_addralign): New function.
3986         (Sized_incr_relobj::do_initialize_xindex): New function.
3987         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3988         (Sized_incr_relobj::do_read_relocs): New function.
3989         (Sized_incr_relobj::do_gc_process_relocs): New function.
3990         (Sized_incr_relobj::do_scan_relocs): New function.
3991         (Sized_incr_relobj::do_count_local_symbols): New function.
3992         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3993         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3994         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3995         (Sized_incr_relobj::do_relocate): New function.
3996         (Sized_incr_relobj::do_set_section_offset): New function.
3997         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3998         (Sized_incr_dynobj::do_read_symbols): New function.
3999         (Sized_incr_dynobj::do_layout): New function.
4000         (Sized_incr_dynobj::do_add_symbols): New function.
4001         (Sized_incr_dynobj::do_should_include_member): New function.
4002         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4003         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4004         (Sized_incr_dynobj::do_section_size): New function.
4005         (Sized_incr_dynobj::do_section_name): New function.
4006         (Sized_incr_dynobj::do_section_contents): New function.
4007         (Sized_incr_dynobj::do_section_flags): New function.
4008         (Sized_incr_dynobj::do_section_entsize): New function.
4009         (Sized_incr_dynobj::do_section_address): New function.
4010         (Sized_incr_dynobj::do_section_type): New function.
4011         (Sized_incr_dynobj::do_section_link): New function.
4012         (Sized_incr_dynobj::do_section_info): New function.
4013         (Sized_incr_dynobj::do_section_addralign): New function.
4014         (Sized_incr_dynobj::do_initialize_xindex): New function.
4015         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4016         (make_sized_incremental_object): New function.
4017         (Incremental_library::copy_unused_symbols): New function.
4018         (Incremental_library::do_for_all_unused_symbols): New function.
4019         * incremental.h (enum Incremental_input_flags): New type.
4020         (class Incremental_checker): Remove.
4021         (Incremental_input_entry::Incremental_input_entry): Add argument
4022         serial number.
4023         (Incremental_input_entry::arg_serial): New function.
4024         (Incremental_input_entry::set_is_in_system_directory): New function.
4025         (Incremental_input_entry::is_in_system_directory): New function.
4026         (Incremental_input_entry::arg_serial_): New data member.
4027         (Incremental_input_entry::is_in_system_directory_): New data member.
4028         (class Script_info): Move here from script.h.
4029         (Script_info::Script_info): Add filename parameter.
4030         (Script_info::filename): New function.
4031         (Script_info::filename_): New data member.
4032         (Incremental_script_entry::Incremental_script_entry): Add argument
4033         serial number.
4034         (Incremental_object_entry::Incremental_object_entry): Likewise.
4035         (Incremental_object_entry::add_input_section): Build list of input
4036         sections with map to original shndx.
4037         (Incremental_object_entry::get_input_section_index): New function.
4038         (Incremental_object_entry::shndx_): New data member.
4039         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4040         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4041         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4042         serial number.
4043         (Incremental_inputs::report_archive_begin): Likewise.
4044         (Incremental_inputs::report_object): Likewise.
4045         (Incremental_inputs::report_script): Likewise.
4046         (class Incremental_global_symbol_reader): New class.
4047         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4048         and store flags and input file type.
4049         (Incremental_input_entry_reader::arg_serial): New function.
4050         (Incremental_input_entry_reader::type): Extract type from flags.
4051         (Incremental_input_entry_reader::is_in_system_directory): New function.
4052         (Incremental_input_entry_reader::get_input_section_count): Call
4053         accessor function for type.
4054         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4055         function for type; adjust size of global symbol entry.
4056         (Incremental_input_entry_reader::get_global_symbol_count): Call
4057         accessor function for type.
4058         (Incremental_input_entry_reader::get_object_count): Likewise.
4059         (Incremental_input_entry_reader::get_object_offset): Likewise.
4060         (Incremental_input_entry_reader::get_member_count): Likewise.
4061         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4062         (Incremental_input_entry_reader::get_member_offset): Likewise.
4063         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4064         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4065         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4066         (Incremental_input_entry_reader::get_global_symbol_reader): New
4067         function.
4068         (Incremental_input_entry_reader::get_output_symbol_index): New
4069         function.
4070         (Incremental_input_entry_reader::type_): Remove.
4071         (Incremental_input_entry_reader::flags_): New data member.
4072         (Incremental_inputs_reader::input_file_offset): New function.
4073         (Incremental_inputs_reader::input_file_index): New function.
4074         (Incremental_inputs_reader::input_file): Call input_file_offset.
4075         (Incremental_inputs_reader::input_file_at_offset): New function.
4076         (Incremental_relocs_reader::get_r_type): Reformat.
4077         (Incremental_relocs_reader::get_r_shndx): Reformat.
4078         (Incremental_relocs_reader::get_r_offset): Reformat.
4079         (Incremental_relocs_reader::data): New function.
4080         (Incremental_binary::Incremental_binary): Initialize new data members.
4081         (Incremental_binary::check_inputs): Add cmdline parameter.
4082         (Incremental_binary::file_is_unchanged): Remove.
4083         (Input_reader::arg_serial): New function.
4084         (Input_reader::get_unused_symbol_count): New function.
4085         (Input_reader::get_unused_symbol): New function.
4086         (Input_reader::do_arg_serial): New function.
4087         (Input_reader::do_get_unused_symbol_count): New function.
4088         (Input_reader::do_get_unused_symbol): New function.
4089         (Incremental_binary::input_file_count): New function.
4090         (Incremental_binary::get_input_reader): Change signature to use
4091         index instead of filename.
4092         (Incremental_binary::file_has_changed): New function.
4093         (Incremental_binary::get_input_argument): New function.
4094         (Incremental_binary::get_library): New function.
4095         (Incremental_binary::get_script_info): New function.
4096         (Incremental_binary::init_layout): New function.
4097         (Incremental_binary::reserve_layout): New function.
4098         (Incremental_binary::output_file): New function.
4099         (Incremental_binary::do_check_inputs): New function.
4100         (Incremental_binary::do_file_is_unchanged): Remove.
4101         (Incremental_binary::do_file_has_changed): New function.
4102         (Incremental_binary::do_init_layout): New function.
4103         (Incremental_binary::do_reserve_layout): New function.
4104         (Incremental_binary::do_input_file_count): New function.
4105         (Incremental_binary::do_get_input_reader): Change signature.
4106         (Incremental_binary::input_args_map_): New data member.
4107         (Incremental_binary::library_map_): New data member.
4108         (Incremental_binary::script_map_): New data member.
4109         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4110         new data members.
4111         (Sized_incremental_binary::output_section): New function.
4112         (Sized_incremental_binary::inputs_reader): Add const.
4113         (Sized_incremental_binary::symtab_reader): Add const.
4114         (Sized_incremental_binary::relocs_reader): Add const.
4115         (Sized_incremental_binary::got_plt_reader): Add const.
4116         (Sized_incremental_binary::get_symtab_view): New function.
4117         (Sized_incremental_binary::Inputs_reader): New typedef.
4118         (Sized_incremental_binary::Input_entry_reader): New typedef.
4119         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4120         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4121         (Sized_incremental_binary::do_file_has_changed): New function.
4122         (Sized_incremental_binary::do_init_layout): New function.
4123         (Sized_incremental_binary::do_reserve_layout): New function.
4124         (Sized_input_reader::Inputs_reader): Remove.
4125         (Sized_input_reader::Input_entry_reader): Remove.
4126         (Sized_input_reader::do_arg_serial): New function.
4127         (Sized_input_reader::do_get_unused_symbol_count): New function.
4128         (Sized_input_reader::do_get_unused_symbol): New function.
4129         (Sized_incremental_binary::do_input_file_count): New function.
4130         (Sized_incremental_binary::do_get_input_reader): Change signature;
4131         use index instead of filename.
4132         (Sized_incremental_binary::section_map_): New data member.
4133         (Sized_incremental_binary::input_entry_readers_): New data member.
4134         (class Sized_incr_relobj): New class.
4135         (class Sized_incr_dynobj): New class.
4136         (make_sized_incremental_object): New function.
4137         (class Incremental_library): New class.
4138         * layout.cc (Free_list::num_lists): New static data member.
4139         (Free_list::num_nodes): New static data member.
4140         (Free_list::num_removes): New static data member.
4141         (Free_list::num_remove_visits): New static data member.
4142         (Free_list::num_allocates): New static data member.
4143         (Free_list::num_allocate_visits): New static data member.
4144         (Free_list::init): New function.
4145         (Free_list::remove): New function.
4146         (Free_list::allocate): New function.
4147         (Free_list::dump): New function.
4148         (Free_list::print_stats): New function.
4149         (Layout_task_runner::run): Resize output file for incremental updates.
4150         (Layout::Layout): Initialize new data members.
4151         (Layout::set_incremental_base): New function.
4152         (Layout::init_fixed_output_section): New function.
4153         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4154         incremental updates.
4155         (Layout::create_gold_note): Do not create gold note section for
4156         incremental updates.
4157         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4158         for incremental updates.
4159         (Layout::set_section_offsets): For incremental updates, allocate space
4160         from free list.
4161         (Layout::create_symtab_sections): Layout with offsets relative to
4162         start of section; for incremental updates, allocate space from free
4163         list.
4164         (Layout::create_shdrs): For incremental updates, allocate space from
4165         free list.
4166         (Layout::finish_dynamic_section): For incremental updates, do not
4167         check --as-needed (fixed in subsequent patch).
4168         * layout.h (class Free_list): New class.
4169         (Layout::set_incremental_base): New function.
4170         (Layout::incremental_base): New function.
4171         (Layout::init_fixed_output_section): New function.
4172         (Layout::allocate): New function.
4173         (Layout::incremental_base_): New data member.
4174         (Layout::free_list_): New data member.
4175         * main.cc (main): Print Free_list statistics.
4176         * object.cc (Relobj::finalize_incremental_relocs): Add
4177         clear_counts parameter; clear counts only when clear_counts is set.
4178         (Sized_relobj::Sized_relobj): Initialize new base class.
4179         (Sized_relobj::do_layout): Don't report special sections.
4180         (Sized_relobj::do_for_all_local_got_entries): New function.
4181         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4182         symtab_off to all symbol table offsets.
4183         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4184         * object.h (class Got_offset_list): Move to top of file.
4185         (Object::Object): Allow case where input_file == NULL.
4186         (Object::~Object): Likewise.
4187         (Object::input_file): Assert that input_file != NULL.
4188         (Object::lock): Allow case where input_file == NULL.
4189         (Object::unlock): Likewise.
4190         (Object::is_locked): Likewise.
4191         (Object::token): Likewise.
4192         (Object::release): Likewise.
4193         (Object::is_incremental): New function.
4194         (Object::get_mtime): New function.
4195         (Object::for_all_local_got_entries): New function.
4196         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4197         (Object::set_is_in_system_directory): New function.
4198         (Object::is_in_system_directory): New function.
4199         (Object::do_is_incremental): New function.
4200         (Object::do_get_mtime): New function.
4201         (Object::do_for_all_local_got_entries): New function.
4202         (Object::is_in_system_directory_): New data member.
4203         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4204         (class Sized_relobj_base): New class.
4205         (class Sized_relobj): Derive from Sized_relobj_base.
4206         (class Sized_relobj::Symbols): Redeclare from base class.
4207         (class Sized_relobj::local_got_offset_list): Remove.
4208         (class Sized_relobj::Output_sections): Redeclare from base class.
4209         (class Sized_relobj::do_for_all_local_got_entries): New function.
4210         (class Sized_relobj::write_local_symbols): Add offset parameter.
4211         (class Sized_relobj::local_symbol_offset_): Update comment.
4212         (class Sized_relobj::local_dynsym_offset_): Update comment.
4213         * options.cc (Input_arguments::add_file): Remove const.
4214         * options.h (Input_file_argument::Input_file_argument):
4215         Initialize arg_serial_ (all constructors).
4216         (Input_file_argument::set_arg_serial): New function.
4217         (Input_file_argument::arg_serial): New function.
4218         (Input_file_argument::arg_serial_): New data member.
4219         (Input_arguments::Input_arguments): Initialize file_count_.
4220         (Input_arguments::add_file): Remove const.
4221         (Input_arguments::number_of_input_files): New function.
4222         (Input_arguments::file_count_): New data member.
4223         (Command_line::number_of_input_files): Call
4224         Input_arguments::number_of_input_files.
4225         * output.cc (Output_segment_headers::Output_segment_headers):
4226         Set current size.
4227         (Output_section::Input_section::current_data_size): New function.
4228         (Output_section::Output_section): Initialize new data members.
4229         (Output_section::add_input_section): Don't do merge sections for
4230         an incremental link; allocate space from free list for an
4231         incremental update.
4232         (Output_section::add_output_section_data): Allocate space from
4233         free list for an incremental update.
4234         (Output_section::update_data_size): New function.
4235         (Output_section::set_fixed_layout): New function.
4236         (Output_section::reserve): New function.
4237         (Output_segment::set_section_addresses): Remove const.
4238         (Output_segment::set_section_list_addresses): Remove const; allocate
4239         space from free list for an incremental update.
4240         (Output_segment::set_offset): Adjust size of RELRO segment for an
4241         incremental update.
4242         * output.h (Output_data::current_data_size): Move here from
4243         child classes.
4244         (Output_data::pre_finalize_data_size): New function.
4245         (Output_data::update_data_size): New function.
4246         (Output_section_headers::update_data_size): new function.
4247         (Output_section_data_build::current_data_size): Move to Output_data.
4248         (Output_data_strtab::update_data_size): New function.
4249         (Output_section::current_data_size): Move to Output_data.
4250         (Output_section::set_fixed_layout): New function.
4251         (Output_section::has_fixed_layout): New function.
4252         (Output_section::reserve): New function.
4253         (Output_section::update_data_size): New function.
4254         (Output_section::has_fixed_layout_): New data member.
4255         (Output_section::free_list_): New data member.
4256         (Output_segment::set_section_addresses): Remove const.
4257         (Output_segment::set_section_list_addresses): Remove const.
4258         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4259         New function.
4260         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4261         New function.
4262         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4263         parameter when calling Add_symbols constructor; store argument
4264         serial number for members of a lib group.
4265         (Add_symbols::locks): Allow case where token == NULL.
4266         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4267         (Read_member::~Read_member): New function.
4268         (Read_member::is_runnable): New function.
4269         (Read_member::locks): New function.
4270         (Read_member::run): New function.
4271         (Check_script::~Check_script): New function.
4272         (Check_script::is_runnable): New function.
4273         (Check_script::locks): New function.
4274         (Check_script::run): New function.
4275         (Check_library::~Check_library): New function.
4276         (Check_library::is_runnable): New function.
4277         (Check_library::locks): New function.
4278         (Check_library::run): New function.
4279         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4280         (Add_symbols::library_): New data member.
4281         (class Read_member): New class.
4282         (class Check_script): New class.
4283         (class Check_library): New class.
4284         * reloc.cc (Read_relocs::is_runnable): Allow case where
4285         token == NULL.
4286         (Read_relocs::locks): Likewise.
4287         (Scan_relocs::locks): Likewise.
4288         (Relocate_task::locks): Likewise.
4289         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4290         to clear counters.
4291         (Sized_relobj::incremental_relocs_scan): Fix comment.
4292         (Sized_relobj::do_relocate): Pass output file offset to
4293         write_local_symbols.
4294         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4295         from class declaration.
4296         * script.cc (read_input_script): Allocate Script_info; pass
4297         argument serial number to report_script.
4298         * script.h (class Script_info): Move to incremental.h.
4299         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4300         * symtab.h (Symbol_table::add_from_incrobj): New function.
4301         (Symbol_table::set_file_offset): New function.
4302
4303 2011-04-05  Cary Coutant  <ccoutant@google.com>
4304
4305         * incremental-dump.cc (dump_incremental_inputs): Change signature
4306         to take a Sized_incremental_binary; change caller.  Use readers
4307         in Sized_incremental_binary.
4308         * incremental.cc
4309         (Sized_incremental_binary::find_incremental_inputs_sections):
4310         Rename do_find_incremental_inputs_sections to this.
4311         (Sized_incremental_binary::setup_readers): New function.
4312         (Sized_incremental_binary::do_check_inputs): Check
4313         has_incremental_info_ flag; move setup code to setup_readers;
4314         use input readers.
4315         (Sized_incremental_binary::do_file_is_unchanged): New function.
4316         (Sized_incremental_binary::do_get_input_reader): New function.
4317         * incremental.h (class Incremental_binary): Move to end of file.
4318         (Incremental_binary::file_is_unchanged): New function.
4319         (Incremental_binary::do_file_is_unchanged): New function.
4320         (Incremental_binary::Input_reader): New class.
4321         (Incremental_binary::get_input_reader): New function.
4322         (class Sized_incremental_binary): Move to end of file.
4323         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4324         input section reader classes.
4325         (Sized_incremental_binary::has_incremental_info): New function.
4326         (Sized_incremental_binary::inputs_reader): New function.
4327         (Sized_incremental_binary::symtab_reader): New function.
4328         (Sized_incremental_binary::relocs_reader): New function.
4329         (Sized_incremental_binary::got_plt_reader): New function.
4330         (Sized_incremental_binary::do_file_is_unchanged): New function.
4331         (Sized_incremental_binary::Sized_input_reader): New class.
4332         (Sized_incremental_binary::get_input_reader): New function.
4333         (Sized_incremental_binary::find_incremental_inputs_sections):
4334         Rename do_find_incremental_inputs_sections to this.
4335         (Sized_incremental_binary::setup_readers): New function.
4336         (Sized_incremental_binary::has_incremental_info_): New data member.
4337         (Sized_incremental_binary::inputs_reader_): New data member.
4338         (Sized_incremental_binary::symtab_reader_): New data member.
4339         (Sized_incremental_binary::relocs_reader_): New data member.
4340         (Sized_incremental_binary::got_plt_reader_): New data member.
4341         (Sized_incremental_binary::current_input_file_): New data member.
4342
4343 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4344
4345         PR gold/12640
4346         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4347         violation.
4348
4349 2011-03-30  Cary Coutant  <ccoutant@google.com>
4350
4351         * archive.cc (Archive::include_member): Adjust call to report_object.
4352         (Add_archive_symbols::run): Add script_info to call to
4353         report_archive_begin.
4354         (Lib_group::include_member): Adjust call to report_object.
4355         (Add_lib_group_symbols::run): Adjust call to report_object.
4356         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4357         blocks.  Add object count for script input files.
4358         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4359         script_info parameter; change all callers.
4360         (Incremental_inputs::report_object): Add script_info parameter;
4361         change all callers.
4362         (Incremental_inputs::report_script): Store backpointer to
4363         incremental info entry.
4364         (Output_section_incremental_inputs::set_final_data_size): Record
4365         additional information for scripts.
4366         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4367         * incremental.h (Incremental_script_entry::add_object): New function.
4368         (Incremental_script_entry::get_object_count): New function.
4369         (Incremental_script_entry::get_object): New function.
4370         (Incremental_script_entry::objects_): New data member; adjust
4371         constructor.
4372         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4373         (Incremental_inputs::report_object): Add script_info parameter.
4374         (Incremental_inputs_reader::get_object_count): New function.
4375         (Incremental_inputs_reader::get_object_offset): New function.
4376         * options.cc (Input_arguments::add_file): Return reference to
4377         new input argument.
4378         * options.h (Input_argument::set_script_info): New function.
4379         (Input_argument::script_info): New function.
4380         (Input_argument::script_info_): New data member; adjust all
4381         constructors.
4382         (Input_file_group::add_file): Return reference to new input argument.
4383         (Input_file_lib::add_file): Likewise.
4384         (Input_arguments::add_file): Likewise.
4385         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4386         * script.cc (Parser_closure::Parser_closure): Add script_info
4387         parameter; adjust all callers.
4388         (Parser_closure::script_info): New function.
4389         (Parser_closure::script_info_): New data member.
4390         (read_input_script): Report scripts earlier to incremental info.
4391         (script_add_file): Set script_info in Input_argument.
4392         (script_add_library): Likewise.
4393         * script.h (Script_options::Script_info): Rewrite class.
4394
4395 2011-03-29  Cary Coutant  <ccoutant@google.com>
4396
4397         * archive.cc (Library_base::should_include_member): Move
4398         method here from class Archive.
4399         (Archive::Archive): Initialize base class.
4400         (Archive::should_include_member): Move to base class.
4401         (Archive::do_for_all_unused_symbols): New function.
4402         (Add_archive_symbols::run): Remove redundant access to
4403         incremental_inputs.
4404         (Lib_group::Lib_group): Initialize base class.
4405         (Lib_group::do_filename): New function.
4406         (Lib_group::include_member): Pass pointer to Lib_group to
4407         report_object.
4408         (Lib_group::do_for_all_unused_symbols): New function.
4409         (Add_lib_group_symbols::run): Report archive information for
4410         incremental links.
4411         * archive.h (class Library_base): New base class.
4412         (class Archive): Derive from Library_base.
4413         (Archive::filename): Move to base class.
4414         (Archive::set_incremental_info): Likewise.
4415         (Archive::incremental_info): Likewise.
4416         (Archive::Should_include): Likewise.
4417         (Archive::should_include_member): Likewise.
4418         (Archive::Armap_entry): Remove.
4419         (Archive::Unused_symbol_iterator): Remove.
4420         (Archive::unused_symbols_begin): Remove.
4421         (Archive::unused_symbols_end): Remove.
4422         (Archive::do_filename): New function.
4423         (Archive::do_get_mtime): New function.
4424         (Archive::do_for_all_unused_symbols): New function.
4425         (Archive::task_): Move to base class.
4426         (Archive::incremental_info_): Likewise.
4427         (class Lib_group): Derive from Library_base.
4428         (Lib_group::do_filename): New function.
4429         (Lib_group::do_get_mtime): New function.
4430         (Lib_group::do_for_all_unused_symbols): New function.
4431         (Lib_group::task_): Move to base class.
4432         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4433         function.
4434         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4435         function.
4436         * incremental.cc (Incremental_inputs::report_archive_begin):
4437         Use Library_base; call library's get_mtime; add incremental inputs
4438         entry before members.
4439         (class Unused_symbol_visitor): New class.
4440         (Incremental_inputs::report_archive_end): Use Library_base; use
4441         visitor class to record unused symbols; don't add incremental inputs
4442         entry after members.
4443         (Incremental_inputs::report_object): Use Library_base.
4444         * incremental.h
4445         (Incremental_archive_entry::Incremental_archive_entry): Remove
4446         unused Archive parameter.
4447         (Incremental_inputs::report_archive_begin): Use Library_base.
4448         (Incremental_inputs::report_archive_end): Likewise.
4449         (Incremental_inputs::report_object): Likewise.
4450         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4451         function.
4452         * object.h (Object::for_all_global_symbols): New function.
4453         (Object::do_for_all_global_symbols): New function.
4454         (Sized_relobj::do_for_all_global_symbols): New function.
4455         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4456         function.
4457         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4458         function.
4459
4460 2011-03-27  Ian Lance Taylor  <iant@google.com>
4461
4462         * archive.cc (Archive::interpret_header): Return -1 if something
4463         goes wrong.  Change callers accordingly.
4464
4465 2011-03-25  Cary Coutant  <ccoutant@google.com>
4466
4467         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4468         * testsuite/Makefile.in: Regenerate.
4469
4470 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4471
4472         * plugin.cc (get_view): New.
4473         (Plugin::load): Pass get_view to the plugin.
4474         (Plugin_manager::get_view): New.
4475
4476 2011-03-21  Ian Lance Taylor  <iant@google.com>
4477
4478         * testsuite/final_layout.sh: Rewrite to not use dc.
4479         * testsuite/relro_test.sh: Fail if dc is not present.
4480
4481 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4482
4483         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4484         Change == to -eq.
4485         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4486         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4487         Change == to -eq.
4488         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4489         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4490
4491 2011-03-14  Ian Lance Taylor  <iant@google.com>
4492
4493         * script-sections.cc (Sort_output_sections::script_compare):
4494         Rename from is_before, change return type.
4495         (Sort_output_sections::operator()): Adjust accordingly.
4496
4497 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4498
4499         PR gold/12572
4500         * testsuite/odr_violation2.cc: Add comment to make all error line
4501         numbers double digits.
4502         * testsuite/debug_msg.sh: Adjust expected errors.
4503
4504 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4505
4506         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4507         but mark earlier ones as non-canonical
4508         (offset_to_iterator): Update search target and example
4509         (do_addr2line): Return extra lines in a vector*
4510         (format_file_lineno): Extract from do_addr2line
4511         (one_addr2line): Add vector* out-param
4512         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4513         when a lineno entry appeared last for its instruction
4514         (Dwarf_line_info): Add vector* out-param
4515         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4516         * symtab.cc (Odr_violation_compare): Include the lineno in the
4517         comparison again.
4518         (linenos_from_loc): New. Combine the canonical line for an
4519         address with its other lines.
4520         (True_if_intersect): New. Helper functor to make
4521         std::set_intersection a query.
4522         (detect_odr_violations): Compare sets of lines instead of just
4523         one line for each function. This became less deterministic, but
4524         has fewer false positives.
4525         * symtab.h: Declarations.
4526         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4527         mix an optimized and non-optimized object in the same binary
4528         (odr_violation2.so): Same.
4529         * testsuite/Makefile.in: Regenerate from Makefile.am.
4530         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4531         * testsuite/debug_msg.sh: Update line numbers and add
4532         assertions.
4533         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4534         non-optimized context.
4535         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4536         isn't inlined, and use OdrDerived in an optimized context.
4537         * testsuite/odr_header1.h: Defines OdrDerived, where
4538         optimization will change the
4539         first-instruction-in-the-destructor's file and line number.
4540         * testsuite/odr_header2.h: Defines OdrBase.
4541
4542 2011-03-09  Ian Lance Taylor  <iant@google.com>
4543
4544         * fileread.cc (File_read::clear_views): Don't delete the whole
4545         file view.
4546
4547 2011-03-08  Ian Lance Taylor  <iant@google.com>
4548
4549         PR gold/12525
4550         * fileread.cc: #include <climits>.
4551         (GOLD_IOV_MAX): Define.
4552         (File_read::read_multiple): Limit number of entries by iov_max.
4553         * fileread.h (class File_read): Always set max_readv_entries to
4554         128.
4555
4556 2011-03-07  Ian Lance Taylor  <iant@google.com>
4557
4558         PR gold/12525
4559         * options.h (class General_options): Add -dy and -dn.
4560
4561 2011-03-02  Cary Coutant  <ccoutant@google.com>
4562
4563         * testsuite/script_test_9.t: Add TLS segment.
4564
4565 2011-03-02  Simon Baldwin  <simonb@google.com>
4566
4567         * configure.ac: Add check for gnu_indirect_function support in
4568         the toolchain building binutils.
4569         * configure: Rebuild.
4570
4571 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4572
4573         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4574         plugin only symbols.
4575         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4576         in plugin files as not needed in the symbol table.
4577
4578 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4579
4580         * output.cc (Output_section::add_input_section): Delay fill
4581         generation for section ordering.
4582
4583 2011-02-09  Ian Lance Taylor  <iant@google.com>
4584
4585         PR gold/12316
4586         * object.h (class Sized_relobj): Remove clear_local_symbols.
4587         * reloc.cc (Sized_relobj::do_relocate): Don't call
4588         clear_local_symbols.
4589
4590 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4591
4592         * plugin.cc (is_visible_from_outside): Return true for symbols
4593         in the -u option.
4594
4595 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4596
4597         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4598         filename.
4599
4600 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4601
4602         * icf.h (is_section_foldable_candidate): Change type of parameter
4603         to std::string.
4604         * icf.cc (Icf::find_identical_sections): Change type of local variable
4605         section_name to be std::string.
4606         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4607
4608 2011-01-25  Ian Lance Taylor  <iant@google.com>
4609
4610         * script.cc (script_add_extern): Rewrite to use
4611         add_symbol_reference.
4612
4613 2011-01-25  Doug Kwan  <dougkwan@google.com>
4614
4615         * icf.cc (get_section_contents): Always lock section's object.
4616
4617 2011-01-24  Ian Lance Taylor  <iant@google.com>
4618
4619         * options.h (class General_options): Accept
4620         --no-detect-odr-violations.
4621
4622 2011-01-24  Ian Lance Taylor  <iant@google.com>
4623
4624         * version.cc (version_string): Bump to 1.11.
4625
4626 2011-01-24  Ian Lance Taylor  <iant@google.com>
4627
4628         * plugin.cc (class Plugin_rescan): Define new class.
4629         (Plugin_manager::claim_file): Set any_claimed_.
4630         (Plugin_manager::save_archive): New function.
4631         (Plugin_manager::save_input_group): New function.
4632         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4633         necessary.
4634         (Plugin_manager::new_undefined_symbol): New function.
4635         (Plugin_manager::rescan): New function.
4636         (Plugin_manager::rescannable_defines): New function.
4637         (Plugin_manager::add_input_file): Set any_added_.
4638         * plugin.h (class Plugin_manager): define new fields rescannable_,
4639         undefined_symbols_, any_claimed_, and any_added_.  Declare
4640         Plugin_rescan as friend.  Declare new functions.
4641         (Plugin_manager::Rescannable): Define type.
4642         (Plugin_manager::Rescannable_list): Define type.
4643         (Plugin_manager::Undefined_symbol_list): Define type.
4644         (Plugin_manager::Plugin_manager): Initialize new fields.
4645         * archive.cc (Archive::defines_symbol): New function.
4646         (Add_archive_symbols::run): Pass archive to plugins if any.
4647         * archive.h (class Archive): Declare defines_symbol.
4648         * readsyms.cc (Input_group::~Input_group): New function.
4649         (Finish_group::run): Pass input_group to plugins if any.
4650         * readsyms.h (class Input_group): Declare destructor.
4651         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4652         any.
4653
4654 2011-01-10  Ian Lance Taylor  <iant@google.com>
4655
4656         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4657         section as relro.
4658         (Layout::set_segment_offsets): Reset increase_relro before calling
4659         set_section_addresses a second time.
4660
4661 2011-01-04  Cary Coutant  <ccoutant@google.com>
4662
4663         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4664         sections before NOBITS sections.
4665
4666 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4667
4668         * version.cc (print_version): Update copyright to 2011.
4669
4670 2010-12-23  Cary Coutant  <ccoutant@google.com>
4671
4672         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4673         of OS to this->add.  Add OD parameter to second form of the function.
4674
4675 2010-12-20  Ian Lance Taylor  <iant@google.com>
4676
4677         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4678         second of two consecutive entries with same offset.
4679
4680 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4681
4682         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4683         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4684         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4685         to avoid unneeded links against $(LDADD).
4686         * testsuite/Makefile.in: Regenerate.
4687
4688 2010-12-15  Ian Lance Taylor  <iant@google.com>
4689
4690         PR gold/12324
4691         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4692         for R_X86_64_32 and R_X86_64_PC32.
4693         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4694         ver_matching_def_pic.o.
4695         (ver_matching_def_pic.o): New target.
4696
4697 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4698
4699         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4700         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4701         Move definition before File_read::View member definitions.
4702         (File_read::View::~View): Initialize and hold lock before
4703         updating current_mapped_bytes.
4704
4705 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4706
4707         * dwarf_reader.cc: Remove outdated comment.
4708         * gold-threads.cc: Fix typo in error message.
4709         * archive.cc: Fix typos in comments.
4710         * archive.h: Likewise.
4711         * arm-reloc-property.cc: Likewise.
4712         * arm-reloc-property.h: Likewise.
4713         * arm-reloc.def: Likewise.
4714         * arm.cc: Likewise.
4715         * attributes.h: Likewise.
4716         * cref.cc: Likewise.
4717         * ehframe.cc: Likewise.
4718         * fileread.h: Likewise.
4719         * gold.h: Likewise.
4720         * i386.cc: Likewise.
4721         * icf.cc: Likewise.
4722         * incremental.h: Likewise.
4723         * int_encoding.cc: Likewise.
4724         * layout.h: Likewise.
4725         * main.cc: Likewise.
4726         * merge.h: Likewise.
4727         * object.cc: Likewise.
4728         * object.h: Likewise.
4729         * options.cc: Likewise.
4730         * readsyms.cc: Likewise.
4731         * reduced_debug_output.cc: Likewise.
4732         * reloc.cc: Likewise.
4733         * script-sections.cc: Likewise.
4734         * sparc.cc: Likewise.
4735         * symtab.h: Likewise.
4736         * target-reloc.h: Likewise.
4737         * target.cc: Likewise.
4738         * target.h: Likewise.
4739         * timer.cc: Likewise.
4740         * timer.h: Likewise.
4741         * x86_64.cc: Likewise.
4742
4743 2010-12-09  Cary Coutant  <ccoutant@google.com>
4744
4745         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4746         stack.
4747         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4748         parameter; change all callers.
4749         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4750         * options.h (warn_execstack): New option.
4751
4752 2010-12-07  Doug Kwan  <dougkwan@google.com>
4753
4754         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4755         like function call relocations.
4756
4757 2010-12-07  Ian Lance Taylor  <iant@google.com>
4758
4759         * archive.cc (Archive::get_elf_object_for_member): Permit
4760         punconfigured to be NULL.
4761         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4762         (Archive::include_member): Pass NULL to get_elf_object_for_member
4763         if we searched for the archive and this is the first included
4764         object.
4765
4766 2010-12-01  Ian Lance Taylor  <iant@google.com>
4767
4768         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4769         track_relocs_type_ field.
4770         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4771         Set track_relocs_type_.
4772         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4773         contents when using RELA relocs.
4774         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4775         reloc_map_.
4776         * reloc.cc (Track_relocs::next_addend): New function.
4777         * reloc.h (class Track_relocs): Declare next_addend.
4778
4779 2010-12-01  Ian Lance Taylor  <iant@google.com>
4780
4781         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4782         virtual destructor.
4783
4784 2010-12-01  Ian Lance Taylor  <iant@google.com>
4785
4786         * README: Update compilers known to work and fail.
4787
4788 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4789
4790         * configure.in: For --enable-gold, handle value `default' instead of
4791         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4792         not the default.
4793         * configure: Regenerate.
4794
4795 2010-11-18  Doug Kwan  <dougkwan@google.com>
4796
4797         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4798         and right_alignment to be zero.  Store result alignment only if it is
4799         greater than existing alignment.
4800
4801 2010-11-16  Cary Coutant  <ccoutant@google.com>
4802
4803         PR gold/12220
4804         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4805         Check for ".zdebug_line".
4806
4807 2010-11-16  Doug Kwan  <dougkwan@google.com>
4808             Cary Coutant  <ccoutant@google.com>
4809
4810         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4811         by reference; adjust all callers.
4812         * output.cc (Output_segment::set_section_addresses): Adjust references
4813         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4814         list is empty.
4815         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4816         end at page boundary.
4817
4818 2010-11-16  Cary Coutant  <ccoutant@google.com>
4819
4820         PR gold/12220
4821         * layout.cc (Layout::choose_output_section): Transform names of
4822         compressed sections even when using a script with a SECTIONS clause.
4823         (Layout::output_section_name): Remove code to transform
4824         compressed debug section names.
4825         * output.cc (Output_section::add_input_section): Use uncompressed
4826         section size when tracking input sections.
4827
4828 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4829
4830         * symtab.h (Symbol::NON_PIC_REF): Remove.
4831         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4832         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4833         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4834         (Symbol::use_plt_offset): Take a flags argument and pass it
4835         directly to needs_dynamic_reloc.  Restrict check for undefined
4836         weak symbols to function calls.
4837         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4838         (Target_arm::Scan::global): Use it.
4839         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4840         (Target_arm::Relocate::relocate): Likewise.
4841         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4842         parameter with an r_type parameter.  Use get_reference_flags
4843         to get the flags.
4844         (Target_arm::Relocate::relocate): Update accordingly.
4845         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4846         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4847         (Target_i386::Scan::global): Likewise.
4848         (Target_i386::Relocate::relocate): Likewise.
4849         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4850         parameter with an r_type parameter.  Use get_reference_flags
4851         to get the flags.
4852         (Target_i386::Relocate::relocate): Update accordingly.
4853         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4854         (Target_powerpc::Scan::global): Use it.
4855         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4856         (Target_powerpc::Relocate::relocate): Likewise.
4857         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4858         (Target_sparc::Scan::global): Use it.
4859         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4860         (Target_sparc::Relocate::relocate): Likewise.
4861         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4862         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4863         (Target_x86_64::Scan::global): Likewise.
4864         (Target_x86_64::Relocate::relocate): Likewise.
4865
4866 2010-11-08  Doug Kwan  <dougkwan@google.com>
4867             Cary Coutant  <ccoutant@google.com>
4868
4869         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4870         (Arm_exidx_merge_section::section_contents_): New data member.
4871         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4872         (Arm_input_section::~Arm_input_section): De-allocate memory.
4873         (Arm_input_section::original_contents_): New data member.
4874         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4875         in parameters instead of calling Object::section_contents without
4876         locking.
4877         (Arm_output_section::group_section): New parameter TASK.  Pass it
4878         to callees that need locking objects.
4879         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4880         to lock EXIDX input sections.  Fix a formatting issue.  Call
4881         Arm_exidx_merged_section::build_contents to create merged section
4882         contents.
4883         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4884         to lock object of stub table owner.
4885         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4886         TEXT_SIZE to initialize data member TEXT_SIZE_.
4887         (Arm_exidx_input_section::addralign): Fix typo in comment.
4888         (Arm_exidx_input_section::text_size): New method.
4889         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4890         that require locking objects.  Lock objects before scanning for stubs
4891         and updating local symbols.
4892         (Arm_input_section<big_endian>::init): Copy contents of original
4893         input section.
4894         (Arm_input_section<big_endian>::do_write): Use saved contents of
4895         original input section instead of calling Object::section_contents
4896         without locking.
4897         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4898         size without calling Object::section_size().
4899         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4900         for size.  Allocate a buffer for merged EXIDX entries.
4901         (Arm_exidx_merged_section::build_contents): New method.
4902         (Arm_exidx_merged_section::do_write): Move merge section contents
4903         building code to Arm_exidx_merged_section::build_contetns.  Write
4904         out contetns in buffer instead of building it on the fly.
4905         (Arm_relobj::make_exidx_input_section): Also pass text section size
4906         to Arm_exidx_input_section constructor.
4907         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4908         (Arm_dynobj::do_read_symbols): Fix memory leak.
4909         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4910         * target.h: (class Task): Add forward declaration.
4911         (Target::relax): Add new parameter TASK and pass it to
4912         Target::do_relax().
4913         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4914
4915 2010-11-05  Cary Coutant  <ccoutant@google.com>
4916
4917         PR gold/10708
4918         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4919         object when reading from the file.
4920         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4921         second layout pass.
4922         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4923         when reading section contents.
4924         (get_section_contents): Likewise.
4925         (icf::find_identical_sections): Likewise.
4926         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4927         object when reading from the file.
4928         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4929         the object when doing deferred section layout.
4930
4931 2010-11-03  Nick Clifton  <nickc@redhat.com>
4932
4933         PR gold/12001
4934         * script.h (class Symbol_assignment: name): New member.  Returns
4935         the name of the symbol.
4936         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4937         Returns true if the given symbol name is on the list of
4938         assignments wating to be processed.
4939         * archive.cc (should_incldue_member): If the symbol is undefined,
4940         check to see if it is on the list of symbols pending assignment.
4941
4942 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4943
4944         * script-sections.cc (Script_sections::find_memory_region): Check
4945         for a NULL output section pointer.
4946
4947 2010-10-29  Doug Kwan  <dougkwan@google.com>
4948
4949         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4950         Output_section::add_relaxed_input_section.
4951         * output.cc (Output_section::add_relaxed_input_section): Add new
4952         arguments LAYOUT and NAME.  Set section order index.
4953         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4954         Copy section order index.
4955         * output.h (Output_section::add_relaxed_input_section): Add new
4956         arguments LAYOUT and NAME.
4957
4958 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4959
4960         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4961         NATIVE_OR_CROSS_LINKER.
4962         * testsuite/Makefile.in: Regenerate.
4963
4964 2010-10-20  Doug Kwan  <dougkwan@google.com>
4965
4966         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4967         without SHF_LINK_ORDER flags.
4968         * layout.cc (Layout::choose_output_section): Do not filter
4969         SHF_LINK_ORDER flag in a relocatable link.
4970
4971 2010-10-17  Cary Coutant  <ccoutant@google.com>
4972
4973         * output.h (Output_segment::set_section_addresses): Change function
4974         signature.  Update all callers.
4975         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4976         sections.
4977         (Output_segment::set_section_addresses): Align after last TLS
4978         section.  Add padding before last relro section instead of after.
4979
4980 2010-10-17  Doug Kwan  <dougkwan@google.com>
4981
4982         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4983         GOT output section to be writable.
4984
4985 2010-10-14  Cary Coutant  <ccoutant@google.com>
4986
4987         * debug.h (DEBUG_INCREMENTAL): New flag.
4988         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4989         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4990         mode.
4991         * incremental.cc (report_command_line): Ignore all forms of
4992         --incremental.
4993         * layout.cc (Layout::Layout): Check parameters for incremental link
4994         mode.
4995         * options.cc (General_options::parse_incremental): New function.
4996         (General_options::parse_no_incremental): New function.
4997         (General_options::parse_incremental_full): New function.
4998         (General_options::parse_incremental_update): New function.
4999         (General_options::incremental_mode_): New data member.
5000         (General_options::finalize): Check incremental_mode_.
5001         * options.h (General_options): Update help text for --incremental.
5002         Add --no-incremental, --incremental-full, --incremental-update.
5003         (General_options::Incremental_mode): New enum type.
5004         (General_options::incremental_mode): New function.
5005         (General_options::incremental_mode_): New data member.
5006         * parameters.cc (Parameters::incremental_mode_): New data member.
5007         (Parameters::set_options): Set incremental_mode_.
5008         (Parameters::set_incremental_full): New function.
5009         (Parameters::incremental): New function.
5010         (Parameters::incremental_update): New function.
5011         (set_parameters_incremental_full): New function.
5012         * parameters.h (Parameters::set_incremental_full): New function.
5013         (Parameters::incremental): New function.
5014         (Parameters::incremental_update): New function.
5015         (Parameters::incremental_mode_): New data member.
5016         (set_parameters_incremental_full): New function.
5017         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5018         incremental link mode.
5019         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5020         (Sized_relobj::do_relocate_sections): Likewise.
5021         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5022         option.
5023         * testsuite/Makefile.in: Regenerate.
5024         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5025
5026 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5027
5028         * script-sections.h (class Script_sections): Make
5029         Sections_elements typedef public.
5030         * script-sections.cc (class Sort_output_sections): Add elements_
5031         field.  Add constructor which sets it; change all callers.
5032         (Sort_output_sections::is_before): New function.
5033         (Sort_output_sections::operator()): Call is_before.
5034         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5035         conditional.
5036         * testsuite/script_test_10.sh: New test. Test script section
5037         order.
5038         * testsuite/script_test_10.t: Likewise.
5039         * testsuite/script_test_10.s: Likewise.
5040         * testsuite/Makefile.am: Wrap the cross linker tests and the
5041         common tests into NATIVE_OR_CROSS_LINKER.
5042         (check_SCRIPTS): Add script_test_10.sh.
5043         (check_DATA): Add script_test_10.stdout.
5044         (script_test_10.o, script_test_10): New targets.
5045         (script_test_10.stdout): New target.
5046         * configure, testsuite/Makefile.in: Regenerate.
5047
5048 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5049
5050         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5051         error for the deprecated relocations.
5052         (Target_arm::Scan::global): Likewise.
5053         (Target_arm::Relocate::relocate): Likewise.
5054
5055 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5056
5057         * fileread.cc (Input_file::find_file): Initialize *found_name
5058         and *namep when using the fallback search for case 4.
5059
5060 2010-10-11  Cary Coutant  <ccoutant@google.com>
5061
5062         * options.h (class General_options): Redefine -z lazy as an alias for
5063         the negation of -z now.
5064
5065 2010-10-11  Ian Lance Taylor  <iant@google.com>
5066
5067         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5068         binding.
5069
5070 2010-10-06  Nick Clifton  <nickc@redhat.com>
5071
5072         * script-sections.cc(class Memory_region): Remove
5073         current_lma_offset_ field.  Rename current_vma_offset_ to
5074         current_offset_.  Add last_section_ field.
5075         (Memory_region::get_current_vma_address): Rename to
5076         get_current_address.
5077         (Memory_region::get_current_lma_address): Delete.
5078         (Memory_region::increment_vma_offset): Rename to
5079         increment_offset.
5080         (Memory_region::increment_lma_offset): Delete.
5081         (Memory_region::attributes_compatible): New method.  Returns
5082         true if the provided section is compatible with the region.
5083         (Memory_region::get_last_section): New method.  Returns the last
5084         section to use the region.
5085         (Memory_region::set_last_section): New method.  Stores the last
5086         section to use the region.
5087         (Script_sections::block_in_region): New method.  Returns true if
5088         a block of memory is contained within a region.
5089         (Script_sections::find_memory_region): New method.  Locates a
5090         memory region to be used to set a VMA or LMA address.
5091         (Output_section_definition::set_section_addresses): Add code to
5092         check for addresses set by memory regions.
5093         (Output_segment::set_section_addresses): Remove memory region
5094         walking code.
5095         (Script_sections::create_segment): Add a warning if a header
5096         segment is created outside of any region.
5097         * script-sections.h (class Script_sections): Add prototypes for
5098         find_memory_region and block_in_region methods.
5099         * testsuite/memory_test.s: Use .long instead of .word.
5100         * testsuite/memory_test.t: Add some more output sections.
5101         * testsuite/memory_test.sh: Update expected output.
5102
5103 2010-10-02  Doug Kwan  <dougkwan@google.com>
5104
5105         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5106         defintion to symtab.h
5107         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5108         declaration to defintion.
5109
5110 2010-10-01  Nick Clifton  <nickc@redhat.com>
5111
5112         * expression.cc (eval): Replace dummy argument with NULL.
5113         (eval_maybe_dot): Check for a NULL result section pointer.
5114         (Symbol_expression::value): Likewise.
5115         (Dot_expression::value): Likewise.
5116         (BINARY_EXPRESSION): Likewise.
5117         (Max_expression::value): Likewise.
5118         (Min_expression::value): Likewise.
5119         (Absolute_expression::value): Likewise.
5120         (Addr_expression::value_from_output_section): Likewise.
5121         (Loaddddr_expression::value_from_output_section): Likewise.
5122         (Segment_start_expression::value): Likewise.
5123         * script-sections.cc
5124         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5125         argument with NULL.
5126         (Sections_elememt_dot_assignment::set_section_addresses):
5127         Likewise.
5128         (Output_data_expression::do_write_to_buffer): Likewise.
5129         (Output_section_definition::finalize_symbols): Likewise.
5130         (Output_section_definition::set_section_addresses): Likewise.
5131
5132 2010-09-30  Doug Kwan  <dougkwan@google.com>
5133
5134         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5135
5136 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5137
5138         * target.h (Target::can_icf_inline_merge_sections): New virtual
5139         function.
5140         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5141         virtual function.
5142         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5143         virtual function.
5144         * icf.cc (get_section_contents): Inline merge sections only when
5145         target allows it.
5146
5147 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5148
5149         * configure: Regenerate.
5150
5151 2010-09-17  Ian Lance Taylor  <iant@google.com>
5152
5153         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5154         * testsuite/Makefile.am (memory_test.o): New target.
5155         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5156         memory_test.t.
5157         * testsuite/Makefile.in: Rebuild.
5158
5159 2010-09-17  Doug Kwan  <dougkwan@google.com>
5160
5161         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5162         defintion if relocation uses GOT entries of the symbol.
5163         * testsuite/icf_safe_test.sh: Fix test.
5164         * testsuite/icf_safe_so_test.sh: Fix test.
5165
5166 2010-09-16  Cary Coutant  <ccoutant@google.com>
5167
5168         * script_sections.cc (class Memory_region): Remove "NULL" from
5169         vector initializations.
5170
5171 2010-09-15  Cary Coutant  <ccoutant@google.com>
5172
5173         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5174         Resolve forwarding symbols.
5175
5176 2010-09-15  Doug Kwan  <dougkwan@google.com>
5177
5178         * gold/testsuite/script_test_3.t: Add ARM special sections.
5179         * gold/testsuite/script_test_4.t: Same.
5180         * gold/testsuite/script_test_5.t: Same.
5181         * gold/testsuite/script_test_6.t: Same.
5182         * gold/testsuite/script_test_7.t: Same.
5183         * gold/testsuite/script_test_7.t: Same.
5184         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5185
5186 2010-09-14  Cary Coutant  <ccoutant@google.com>
5187
5188         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5189         (Target_x86_64::Relocate::relocate_tls): Replace check for
5190         saw_tls_block_reloc_ with test for executable section.
5191
5192 2010-09-12  Cary Coutant  <ccoutant@google.com>
5193
5194         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5195         position-independent executables to shared libraries need dynamic
5196         relocations.
5197         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5198         position-independent executables.
5199         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5200         * testsuite/Makefile.in: Regenerate.
5201
5202 2010-09-10  Nick Clifton  <nickc@redhat.com>
5203
5204         PR gold/11997
5205         * testsuite/memory_test.t: Discard any sections that are not
5206         needed.
5207
5208 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5209
5210         PR gold/11996
5211         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5212         "This::" to work around a bug in gcc 4.2.
5213
5214         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5215
5216 2010-09-09  Rafael Espindola  <espindola@google.com>
5217
5218         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5219         sections with different PF_X flags in the same segment.
5220         (Layout::find_first_load_seg): Search all segments to find the first
5221         one.
5222         * options.h (rosegment): New.
5223
5224 2010-09-08  Rafael Espindola  <espindola@google.com>
5225
5226         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5227
5228 2010-09-08  Doug Kwan  <dougkwan@google.com>
5229
5230         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5231         (Arm_relobj::do_relocate_sections): Add new parameter for output
5232         file to match the parent.
5233         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5234         of local symbols instead of input values.  Update code to track
5235         changes in gold::relocate_section.
5236         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5237         (Sized_relobj::compute_final_local_value_internal): New methods.
5238         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5239         body into private version of Sized_relobj::compute_final_local_value.
5240         Call the inline method.
5241         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5242         merged symbol value if there is one.
5243         (Symbol_value::has_output_value): New method defintiion.
5244         (Sized_relobj::Compute_final_local_value_status): New enum type.
5245         (Sized_relobj::compute_final_local_value): New methods.
5246         (Sized_relobj::compute_final_local_value_internal): New methods.
5247         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5248         and arm_cortex_a8.sh.
5249         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5250         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5251         New tests.
5252         * Makefile.in: Regenerate.
5253         * testsuite/arm_bl_out_of_range.s: Update test.
5254         * testsuite/thumb_bl_out_of_range.s: Ditto.
5255         * testsuite/thumb_blx_out_of_range.s: Ditto.
5256         * testsuite/arm_branch_out_of_range.sh: New file.
5257         * testsuite/arm_cortex_a8.sh: Ditto.
5258         * testsuite/arm_cortex_a8_b.s: Ditto.
5259         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5260         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5261         * testsuite/arm_cortex_a8_bl.s: Ditto.
5262         * testsuite/arm_cortex_a8_blx.s: Ditto.
5263         * testsuite/arm_cortex_a8_local.s: Ditto.
5264         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5265         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5266
5267 2010-09-08  Rafael Espindola  <espindola@google.com>
5268
5269         * Makefile.am (memory_test.stdout): Run readelf with -W.
5270         * Makefile.in: Regenerate.
5271         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5272         64 bit output.
5273
5274 2010-09-08  Rafael Espindola  <espindola@google.com>
5275
5276         * script-sections.cc (Script_sections::add_memory_region): Convert
5277         field precision to int.
5278         * script.cc (script_set_section_region, script_set_section_region):
5279         Convert field precision to int.
5280
5281 2010-09-08  Rafael Espindola  <espindola@google.com>
5282
5283         * arm.cc (do_finalize_sections): Create the __exidx_start and
5284         __exdix_end symbols even when the section is missing.
5285
5286 2010-09-08  Nick Clifton  <nickc@redhat.com>
5287
5288         * README: Remove claim that MEMORY is not supported.
5289         * expression.cc (script_exp_function_origin)
5290         (script_exp_function_length): Move from here to ...
5291         * script.cc: ... here.
5292         (script_set_section_region, script_add_memory)
5293         (script_parse_memory_attr, script_include_directive): New
5294         functions.
5295         * script-sections.cc
5296         (class Memory_region): New class.
5297         (class Output_section_definition): Add set_memory_region,
5298         set_section_vma, set_section_lma and get_section_name methods.
5299         (class Script_Sections): Add add_memory_region,
5300         find_memory_region, find_memory_region_origin,
5301         find_memory_region_length and set_memory_region methods.
5302         Have set_section_addresses method walk the list of set memory
5303         regions.
5304         Extend the print methos to display memory regions.
5305         * script-sections.h: Add prototypes for new methods.
5306         Add enum for MEMORY region attributes.
5307         * yyscript.y: Add support for parsing MEMORY regions.
5308         * script-c.h: Add prototypes for new functions.
5309         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5310         * testsuite/Makefile.in: Regenerate.
5311         * testsuite/memory_test.sh: New script.
5312         * testsuite/memory_test.s: New assembler source file.
5313         * testsuite/memory_test.t: New linker script.
5314
5315 2010-08-27  Doug Kwan  <dougkwan@google.com>
5316
5317         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5318         reference override an existing dynamic weak reference.
5319         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5320         * testsuite/Makefile.in: Regenerate.
5321         * testsuite/dyn_weak_ref.sh: New file.
5322         * testsuite/dyn_weak_ref_1.c: Ditto.
5323         * testsuite/dyn_weak_ref_2.c: Ditto.
5324
5325 2010-08-27  Ian Lance Taylor  <iant@google.com>
5326
5327         * incremental.h (class Incremental_input_entry): Add virtual
5328         destructor.
5329
5330 2010-08-27  Ian Lance Taylor  <iant@google.com>
5331
5332         * testsuite/start_lib_test_3.c: Mark t3 as used.
5333
5334 2010-08-27  Nick Clifton  <nickc@redhat.com>
5335
5336         * options.cc (version_script): Fix small typo in previous
5337         whitespace tidyup.
5338
5339 2010-08-25  Nick Clifton  <nickc@redhat.com>
5340
5341         * archive.cc: Formatting fixes: Remove whitespace between
5342         typename and following asterisk.  Remove whitespace between
5343         function name and opening parenthesis.
5344         * archive.h: Likewise.
5345         * arm.cc: Likewise.
5346         * attributes.cc: Likewise.
5347         * attributes.h: Likewise.
5348         * common.cc: Likewise.
5349         * copy-relocs.cc: Likewise.
5350         * dirsearch.h: Likewise.
5351         * dynobj.cc: Likewise.
5352         * ehframe.cc: Likewise.
5353         * ehframe.h: Likewise.
5354         * expression.cc: Likewise.
5355         * fileread.cc: Likewise.
5356         * fileread.h: Likewise.
5357         * gc.h: Likewise.
5358         * gold-threads.cc: Likewise.
5359         * gold.cc: Likewise.
5360         * i386.cc: Likewise.
5361         * icf.h: Likewise.
5362         * incremental-dump.cc: Likewise.
5363         * incremental.cc: Likewise.
5364         * layout.cc: Likewise.
5365         * layout.h: Likewise.
5366         * main.cc: Likewise.
5367         * merge.cc: Likewise.
5368         * merge.h: Likewise.
5369         * object.cc: Likewise.
5370         * object.h: Likewise.
5371         * options.cc: Likewise.
5372         * options.h: Likewise.
5373         * output.cc: Likewise.
5374         * output.h: Likewise.
5375         * plugin.cc: Likewise.
5376         * plugin.h: Likewise.
5377         * powerpc.cc: Likewise.
5378         * reloc.cc: Likewise.
5379         * script-c.h: Likewise.
5380         * script-sections.cc: Likewise.
5381         * script.cc: Likewise.
5382         * stringpool.cc: Likewise.
5383         * symtab.cc: Likewise.
5384         * symtab.h: Likewise.
5385         * target.cc: Likewise.
5386         * timer.cc: Likewise.
5387         * timer.h: Likewise.
5388         * version.cc: Likewise.
5389         * x86_64.cc: Likewise.
5390
5391 2010-08-24  Nick Clifton  <nickc@redhat.com>
5392
5393         PR 11899
5394         * layout.cc (segment_precedes): Sort segments by their physical
5395         addresses, if they have been set.
5396
5397 2010-08-23  Cary Coutant  <ccoutant@google.com>
5398
5399         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5400         symbols data.
5401         (Lib_group::include_member): Unlock object after deleting its
5402         symbols data.
5403         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5404         the bug fixed here.
5405
5406 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5407             Cary Coutant  <ccoutant@google.com>
5408
5409         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5410         constructor, and set_blocker.
5411         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5412         readsyms_blocker_.
5413         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5414         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5415         * testsuite/Makefile.am (start_lib_test): New test case.
5416         * testsuite/Makefile.in: Regenerate.
5417         * testsuite/start_lib_test_main.c: New file.
5418         * testsuite/start_lib_test_1.c: New file.
5419         * testsuite/start_lib_test_2.c: New file.
5420         * testsuite/start_lib_test_3.c: New file.
5421
5422 2010-08-19  Ian Lance Taylor  <iant@google.com>
5423
5424         * Makefile.in: Rebuild with automake 1.11.1.
5425         * aclocal.m4: Likewise.
5426         * testsuite/Makefile.in: Likewise.
5427
5428 2010-08-19  Ian Lance Taylor  <iant@google.com>
5429
5430         PR 10893
5431         * i386.cc (class Output_data_plt_i386): Update declarations.
5432         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5433         local_ifuncs_ fields.
5434         (Target_i386::do_plt_section_for_global): New function.
5435         (Target_i386::do_plt_section_for_local): New function.
5436         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5437         parameter; change all callers.  Initialize global_ifuncs_ and
5438         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5439         __rel_iplt_end.
5440         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5441         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5442         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5443         symbols.
5444         (Target_i386::make_plt_section): New function, broken out of
5445         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5446         (Target_i386::make_plt_entry): Call make_plt_section.
5447         (Target_i386::make_local_ifunc_plt_entry): New function.
5448         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5449         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5450         R_386_IRELATIVE to switch.
5451         (Target_i386::Scan::global): Likewise.
5452         (Target_i386::Relocate::relocate): Likewise.
5453         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5454         switch.
5455         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5456         (Target_x86_64::do_plt_section_for_global): New function.
5457         (Target_x86_64::do_plt_section_for_local): New function.
5458         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5459         parameter; change all callers.  If doing a static link define
5460         __rela_iplt_start and __rela_iplt_end.
5461         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5462         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5463         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5464         to point to .plt.
5465         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5466         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5467         switch.
5468         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5469         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5470         R_X86_64_IRELATIVE to switch.
5471         (Target_x86_64::Scan::global): Likewise.
5472         (Target_x86_64::Relocate::relocate): Likewise.
5473         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5474         switch.
5475         * target.h (class Target): Add plt_section_for_global and
5476         plt_section_for_local functions.  Add do_plt_section_for_global
5477         and do_plt_section_for_local virtual functions.
5478         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5479         clarifying comments.
5480         (Symbol::use_plt_offset): Handle IFUNC symbol.
5481         * object.cc (Sized_relobj::Sized_relobj): Initialize
5482         local_plt_offsets_.
5483         (Sized_relobj::local_has_plt_offset): New function.
5484         (Sized_relobj::local_plt_offset): New function.
5485         (Sized_relobj::set_local_plt_offset): New function.
5486         (Sized_relobj::do_count): Handle IFUNC symbol.
5487         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5488         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5489         is_ifunc_symbol functions.
5490         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5491         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5492         local_plt_offsets_ field.
5493         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5494         * output.h (class Output_section_data): Add non-const
5495         output_section function.
5496         (class Output_data_got): Update declarations.
5497         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5498         Add use_plt_offset parameter to global and local constructors.
5499         Change all callers.  Change local_sym_index_ field to 31 bits.
5500         Change GSYM_CODE and CONSTANT_CODE accordingly.
5501         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5502         doing a static link don't set sh_link field.
5503         (Output_data_got::Got_entry::write): Use PLT offset if
5504         appropriate.
5505         (Output_data_got::add_global_plt): New function.
5506         (Output_data_got::add_local_plt): New function.
5507         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5508         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5509         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5510         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5511         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5512         IFUNC conditional.
5513         * testsuite/ifunc-sel.h: New file.
5514         * testsuite/ifuncmain1.c: New file.
5515         * testsuite/ifuncmain1vis.c: New file.
5516         * testsuite/ifuncmod1.c: New file.
5517         * testsuite/ifuncdep2.c: New file.
5518         * testsuite/ifuncmain2.c: New file.
5519         * testsuite/ifuncmain3.c: New file.
5520         * testsuite/ifuncmod3.c: New file.
5521         * testsuite/ifuncmain4.c: New file.
5522         * testsuite/ifuncmain5.c: New file.
5523         * testsuite/ifuncmod5.c: New file.
5524         * testsuite/ifuncmain6pie.c: New file.
5525         * testsuite/ifuncmod6.c: New file.
5526         * testsuite/ifuncmain7.c: New file.
5527         * configure, testsuite/Makefile.in: Rebuild.
5528
5529 2010-08-18  Ian Lance Taylor  <iant@google.com>
5530
5531         * incremental.cc
5532         (Output_section_incremental_inputs::write_input_files): Add cast
5533         to avoid signed/unsigned comparison warning.
5534         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5535
5536 2010-08-12  Cary Coutant  <ccoutant@google.com>
5537
5538         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5539
5540 2010-08-13  Ian Lance Taylor  <iant@google.com>
5541
5542         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5543
5544 2010-08-12  Cary Coutant  <ccoutant@google.com>
5545             Doug Kwan  <dougkwan@google.com>
5546
5547         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5548         defintion overrides non-weak undef, remember that the original undef
5549         is not weak.
5550         * symtab.cc (Symbol_table::sized_write_global): For undef without
5551         an original weak binding, set binding to global in output.
5552         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5553         * testsuite/Makefile.in: Regenerate.
5554         * testsuite/strong_ref_weak_def.sh: New file.
5555         * testsuite/strong_ref_weak_def_1.c: Ditto.
5556         * testsuite/strong_ref_weak_def_2.c: Ditto.
5557
5558 2010-08-12  Cary Coutant  <ccoutant@google.com>
5559
5560         * testsuite/incremental_test.sh: Rewrite.
5561         * testsuite/incremental_test_1.c: Rewrite.
5562         * testsuite/incremental_test_2.c: Rewrite.
5563
5564 2010-08-12  Cary Coutant  <ccoutant@google.com>
5565
5566         * arm.cc (Target_arm::got_size): Add const.
5567         (Target_arm::got_entry_count): New function.
5568         (Target_arm::plt_entry_count): New function.
5569         (Target_arm::first_plt_entry_offset): New function.
5570         (Target_arm::plt_entry_size): New function.
5571         (Output_data_plt_arm::entry_count): New function.
5572         (Output_data_plt_arm::first_plt_entry_offset): New function.
5573         (Output_data_plt_arm::get_plt_entry_size): New function.
5574         * i386.cc (Target_i386::got_size): Add const.
5575         (Target_i386::got_entry_count): New function.
5576         (Target_i386::plt_entry_count): New function.
5577         (Target_i386::first_plt_entry_offset): New function.
5578         (Target_i386::plt_entry_size): New function.
5579         (Output_data_plt_i386::entry_count): New function.
5580         (Output_data_plt_i386::first_plt_entry_offset): New function.
5581         (Output_data_plt_i386::get_plt_entry_size): New function.
5582         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5583         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5584         * incremental.cc: Include target.h.
5585         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5586         parameter.  Adjust all callers.  Find incremental_got_plt section.
5587         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5588         section.
5589         (Output_section_incremental_inputs::set_final_data_size): Calculate
5590         size of incremental_got_plt section.
5591         (Output_section_incremental_inputs::do_write): Write the
5592         incremental_got_plt section.
5593         (Got_plt_view_info): New struct.
5594         (Local_got_offset_visitor): New class.
5595         (Global_got_offset_visitor): New class.
5596         (Global_symbol_visitor_got_plt): New class.
5597         (Output_section_incremental_inputs::write_got_plt): New function.
5598         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5599         Add parameter.  Adjust all callers.
5600         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5601         (Incremental_inputs::got_plt_section): New function.
5602         (Incremental_inputs::got_plt_section_): New data member.
5603         (Incremental_got_plt_reader): New class.
5604         * layout.cc (Layout::create_incremental_info_sections): Add the
5605         incremental_got_plt section.
5606         * object.h (Got_offset_list::get_list): New function.
5607         (Got offset_list::for_all_got_offsets): New function.
5608         (Sized_relobj::local_got_offset_list): New function.
5609         * powerpc.cc (Target_powerpc::got_size): Add const.
5610         (Target_powerpc::got_entry_count): New function.
5611         (Target_powerpc::plt_entry_count): New function.
5612         (Target_powerpc::first_plt_entry_offset): New function.
5613         (Target_powerpc::plt_entry_size): New function.
5614         (Output_data_plt_powerpc::entry_count): New function.
5615         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5616         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5617         * sparc.cc (Target_sparc::got_size): Add const.
5618         (Target_sparc::got_entry_count): New function.
5619         (Target_sparc::plt_entry_count): New function.
5620         (Target_sparc::first_plt_entry_offset): New function.
5621         (Target_sparc::plt_entry_size): New function.
5622         (Output_data_plt_sparc::entry_count): New function.
5623         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5624         (Output_data_plt_sparc::get_plt_entry_size): New function.
5625         * symtab.h (Symbol::got_offset_list): New function.
5626         (Symbol_table::for_all_symbols): New function.
5627         * target.h (Sized_target::got_entry_count): New function.
5628         (Sized_target::plt_entry_count): New function.
5629         (Sized_target::plt_entry_size): New function.
5630         * x86_64.cc (Target_x86_64::got_size): Add const.
5631         (Target_x86_64::got_entry_count): New function.
5632         (Target_x86_64::plt_entry_count): New function.
5633         (Target_x86_64::first_plt_entry_offset): New function.
5634         (Target_x86_64::plt_entry_size): New function.
5635         (Output_data_plt_x86_64::entry_count): New function.
5636         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5637         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5638
5639 2010-08-12  Cary Coutant  <ccoutant@google.com>
5640
5641         * archive.cc: Include incremental.h.
5642         (Archive::Archive): Initialize incremental_info_.
5643         (Archive::include_member): Record archive members in incremental info.
5644         (Add_archive_symbols::run): Record begin and end of an archive in
5645         incremental info.
5646         (Lib_group::include_member): Record objects in incremental info.
5647         * archive.h (Incremental_archive_entry): Forward declaration.
5648         (Archive::set_incremental_info): New member function.
5649         (Archive::incremental_info): New member function.
5650         (Archive::Unused_symbol_iterator): New class.
5651         (Archive::unused_symbols_begin): New member function.
5652         (Archive::unused_symbols_end): New member function.
5653         (Archive::incremental_info_): New data member.
5654         * incremental-dump.cc (find_input_containing_global): New function.
5655         (dump_incremental_inputs): Dump new incremental info sections.
5656         * incremental.cc: Include symtab.h.
5657         (Output_section_incremental_inputs): New class.
5658         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5659         new incremental info sections.
5660         (Sized_incremental_binary::do_check_inputs): Likewise.
5661         (Incremental_inputs::report_archive): Remove.
5662         (Incremental_inputs::report_archive_begin): New function.
5663         (Incremental_inputs::report_archive_end): New function.
5664         (Incremental_inputs::report_object): New function.
5665         (Incremental_inputs::finalize_inputs): Remove.
5666         (Incremental_inputs::report_input_section): New function.
5667         (Incremental_inputs::report_script): Rewrite.
5668         (Incremental_inputs::finalize): Do nothing but finalize string table.
5669         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5670         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5671         (Incremental_inputs::create_data_sections): New function.
5672         (Incremental_inputs::relocs_entsize): New function.
5673         (Output_section_incremental_inputs::set_final_data_size): New function.
5674         (Output_section_incremental_inputs::do_write): New function.
5675         (Output_section_incremental_inputs::write_header): New function.
5676         (Output_section_incremental_inputs::write_input_files): New function.
5677         (Output_section_incremental_inputs::write_info_blocks): New function.
5678         (Output_section_incremental_inputs::write_symtab): New function.
5679         * incremental.h (Incremental_script_entry): Forward declaration.
5680         (Incremental_object_entry): Forward declaration.
5681         (Incremental_archive_entry): Forward declaration.
5682         (Incremental_inputs): Forward declaration.
5683         (Incremental_inputs_header_data): Remove.
5684         (Incremental_inputs_header): Remove.
5685         (Incremental_inputs_header_write): Remove.
5686         (Incremental_inputs_entry_data): Remove.
5687         (Incremental_inputs_entry): Remove.
5688         (Incremental_inputs_entry_write): Remove.
5689         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5690         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5691         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5692         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5693         Likewise.
5694         (Incremental_input_entry): New class.
5695         (Incremental_script_entry): New class.
5696         (Incremental_object_entry): New class.
5697         (Incremental_archive_entry): New class.
5698         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5699         (Incremental_inputs::report_inputs): Remove.
5700         (Incremental_inputs::report_archive): Remove.
5701         (Incremental_inputs::report_archive_begin): New function.
5702         (Incremental_inputs::report_archive_end): New function.
5703         (Incremental_inputs::report_object): Change prototype.
5704         (Incremental_inputs::report_input_section): New function.
5705         (Incremental_inputs::report_script): Change prototype.
5706         (Incremental_inputs::get_reloc_count): New function.
5707         (Incremental_inputs::set_reloc_count): New function.
5708         (Incremental_inputs::create_data_sections): New function.
5709         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5710         (Incremental_inputs::inputs_section): New function.
5711         (Incremental_inputs::symtab_section): New function.
5712         (Incremental_inputs::relocs_section): New function.
5713         (Incremental_inputs::get_stringpool): Add const.
5714         (Incremental_inputs::command_line): Add const.
5715         (Incremental_inputs::inputs): Remove.
5716         (Incremental_inputs::command_line_key): New function.
5717         (Incremental_inputs::input_file_count): New function.
5718         (Incremental_inputs::input_files): New function.
5719         (Incremental_inputs::relocs_entsize): New function.
5720         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5721         (Incremental_inputs::finalize_inputs): Remove.
5722         (Incremental_inputs::Input_info): Remove.
5723         (Incremental_inputs::lock_): Remove.
5724         (Incremental_inputs::inputs_): Change type.
5725         (Incremental_inputs::inputs_map_): Remove.
5726         (Incremental_inputs::current_object_entry_): New data member.
5727         (Incremental_inputs::inputs_section_): New data member.
5728         (Incremental_inputs::symtab_section_): New data member.
5729         (Incremental_inputs::relocs_section_): New data member.
5730         (Incremental_inputs::reloc_count_): New data member.
5731         (Incremental_inputs_reader): New class.
5732         (Incremental_symtab_reader): New class.
5733         (Incremental_relocs_reader): New class.
5734         * layout.cc (Layout::finalize): Move finalization of incremental info
5735         and creation of incremental info sections to follow finalization of
5736         symbol table.  Set offsets for postprocessing sections.
5737         (Layout::create_incremental_info_sections): Call
5738         Incremental_inputs::create_data_sections.  Add incremental symtab
5739         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5740         sections to layout after input sections.
5741         * layout.h (struct Timespec): Forward declaration.
5742         (Layout::incremental_inputs): Add const.
5743         (Layout::create_incremental_info_sections): Add parameter.
5744         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5745         * object.cc: Include incremental.h.
5746         (Relobj::finalize_incremental_relocs): New function.
5747         (Sized_relobj::do_layout): Record input sections in incremental info.
5748         * object.h (Object::output_section): New function.
5749         (Object::output_section_offset): Moved from Relobj.
5750         (Object::get_incremental_reloc_base): New function.
5751         (Object::get_incremental_reloc_count): New function.
5752         (Object::do_output_section): New function.
5753         (Object::do_output_section_offset): Moved from Relobj.
5754         (Object::do_get_incremental_reloc_base): New function.
5755         (Object::do_get_incremental_reloc_count): New function.
5756         (Object::Object): Initialize new data members.
5757         (Relobj::output_section): Renamed do_output_section and moved to
5758         protected.
5759         (Relobj::output_section_offset): Moved to Object.
5760         (Relobj::do_get_incremental_reloc_base): New function.
5761         (Relobj::do_get_incremental_reloc_count): New function.
5762         (Relobj::allocate_incremental_reloc_counts): New function.
5763         (Relobj::count_incremental_reloc): New function.
5764         (Relobj::finalize_incremental_relocs): New function.
5765         (Relobj::next_incremental_reloc_index): New function.
5766         (Relobj::reloc_counts_): New data member.
5767         (Relobj::reloc_bases_): New data member.
5768         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5769         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5770         (Sized_relobj::incremental_relocs_scan): New function.
5771         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5772         (Sized_relobj::incremental_relocs_write): New function.
5773         (Sized_relobj::incremental_relocs_write_reltype): New function.
5774         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5775         incremental link.
5776         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5777         archives and object files elsewhere.
5778         (Add_symbols::run): Report object files here.
5779         (Finish_group::run): Report end of archive at end of group.
5780         * reloc.cc: Include layout.h, incremental.h.
5781         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5782         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5783         (Sized_relobj::incremental_relocs_scan): New function.
5784         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5785         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5786         (Sized_relobj::incremental_relocs_write): New function.
5787         (Sized_relobj::incremental_relocs_write_reltype): New function.
5788         * script.cc (read_input_script): Rewrite test for incremental link.
5789         Change call to Incremental_inputs::report_script.
5790         * symtab.h (Symbol_table::first_global_index): New function.
5791         (Symbol_table::output_count): New function.
5792
5793 2010-08-12  Doug Kwan  <dougkwan@google.com>
5794
5795         * arm.cc (Target_arm::merge_object_attributes): Check command line
5796         options --no-wchar-size-warning and --no-enum-size-warning.
5797         * options.h (General_options): Add ld-compatible options
5798         --no-enum-size-warning and --no-wchar-size-warning.
5799
5800 2010-08-04  Ian Lance Taylor  <iant@google.com>
5801
5802         * x86_64.cc (Target_x86_64::Scan::local): Use
5803         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5804         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5805         (Target_x86_64::Scan::global): Likewise.
5806         (Target_x86_64::Relocate::relocate): Likewise.
5807         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5808         Likewise.
5809
5810 2010-08-03  Cary Coutant  <ccoutant@google.com>
5811
5812         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5813         to reserve space in merged_strings vector. Keep total input size
5814         for stats.
5815         (Output_merge_string::do_print_merge_stats): Print total input size.
5816         * merge.h (Output_merge_string): Add input_size_ field.
5817         * stringpool.cc (Stringpool_template::string_length): Move
5818         implementations out of Stringpool_template class and place in
5819         stringpool.h.
5820         * stringpool.h (string_length): Move out of Stringpool_template.
5821
5822 2010-08-03  Ian Lance Taylor  <iant@google.com>
5823
5824         PR 11712
5825         * layout.cc (relaxation_loop_body): If address of load segment is
5826         set, adjust address to include headers if possible.
5827
5828 2010-08-03  Ian Lance Taylor  <iant@google.com>
5829
5830         * version.cc (version_string): Bump to 1.10.
5831
5832 2010-08-03  Ian Lance Taylor  <iant@google.com>
5833
5834         PR 11805
5835         * layout.h (enum Output_section_order): Define.
5836         (class Layout): Update declarations.
5837         * layout.cc (Layout::get_output_section): Add order parameter.
5838         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5839         is_first_non_relro parameters.  Change all callers.
5840         (Layout::choose_output_section): Likewise.
5841         (Layout::add_output_section_data): Likewise.
5842         (Layout::make_output_section): Likewise.  Set order.
5843         (Layout::default_section_order): New function.
5844         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5845         * output.cc (Output_section::Output_section): Initialize order_.
5846         Don't initialize deleted fields.
5847         (Output_segment::Output_segment): Don't initialize deleted
5848         fields.
5849         (Output_segment::add_output_section_to_load): New function
5850         replacing add_output_section.  Change all callers to call this or
5851         add_output_section_to_nonload.
5852         (Output_segment::add_output_section_to_nonload): New function.
5853         (Output_segment::remove_output_section): Rewrite.
5854         (Output_segment::add_initial_output_data): Likewise.
5855         (Output_segment::has_any_data_sections): Likewise.
5856         (Output_segment::is_first_section_relro): Likewise.
5857         (Output_segment::maximum_alignment): Likewise.
5858         (Output_segment::has_dynamic_reloc): New function replacing
5859         dynamic_reloc_count.  Change all callers.
5860         (Output_segment::has_dynamic_reloc_list): New function replacing
5861         dynamic_reloc_count_list.  Change all callers.
5862         (Output_segment::set_section_addresses): Rewrite.
5863         (Output_segment::set_offset): Rewrite.
5864         (Output_segment::find_first_and_last_list): Remove.
5865         (Output_segment::set_tls_offsets): Rewrite.
5866         (Output_segment::first_section_load_address): Likewise.
5867         (Output_segment::output_section_count): Likewise.
5868         (Output_segment::section_with_lowest_load_address): Likewise.
5869         (Output_segment::write_section_headers): Likewise.
5870         (Output_segment::print_sections_to_map): Likewise.
5871         * output.h (class Output_data): Remove dynamic_reloc_count_
5872         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5873         (Output_data::add_dynamic_reloc): Rewrite.
5874         (Output_data::has_dynamic_reloc): New function.
5875         (Output_data::dynamic_reloc_count): Remove.
5876         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5877         is_last_relro_, is_first_non_relro_, is_interp_,
5878         is_dynamic_linker_section_ fields.  Add order and set_order
5879         functions.  Remove is_relro_local, set_is_relro_local,
5880         is_last_relro, set_is_last_relro, is_first_non_relro,
5881         set_is_first_non_relro functions, is_interp, set_is_interp,
5882         is_dynamic_linker_section, and set_is_dynamic_linker_section
5883         functions.
5884         (class Output_segment): Change Output_data_list from std::list to
5885         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5886         output_bss_ fields.  Update declarations.
5887
5888 2010-08-02  Ian Lance Taylor  <iant@google.com>
5889
5890         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5891         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5892         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5893
5894 2010-08-02  Ian Lance Taylor  <iant@google.com>
5895
5896         PR 11855
5897         * script.cc (Script_options::Script_options): Initialize
5898         symbol_definitions_ and symbol_references_.
5899         (Script_options::add_symbol_assignment): Update
5900         symbol_definitions_ and symbol_references_.
5901         (Script_options::add_symbol_reference): New function.
5902         (script_symbol): New function.
5903         * script.h (class Script_options): Add symbol_definitions_ and
5904         symbol_references_ fields.
5905         (Script_options::referenced_const_iterator): New type.
5906         (Script_options::referenced_begin): New function.
5907         (Script_options::referenced_end): New function.
5908         (Script_options::is_referenced): New function.
5909         (Script_options::any_unreferenced): New function.
5910         * script-c.h (script_symbol): Declare.
5911         * yyscript.y (exp): Call script_symbol.
5912         * symtab.cc: Include "script.h".
5913         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5914         Change all callers.  Check symbols referenced by scripts.
5915         (Symbol_table::add_undefined_symbols_from_command_line): Add
5916         layout parameter.  Change all callers.
5917         (Symbol_table::do_add_undefined_symbols_from_command_line):
5918         Likewise.  Break out loop body.  Check symbols referenced by
5919         scripts.
5920         (Symbol_table::add_undefined_symbol_from_command_line): New
5921         function broken out of
5922         do_add_undefined_symbols_from_command_line.
5923         * symtab.h (class Symbol_table): Update declarations.
5924         * archive.cc: Include "layout.h".
5925         (Archive::should_include_member): Add layout parameter.  Change
5926         all callers.  Check for symbol mentioned in expression.
5927         * archive.h (class Archive): Update declaration.
5928         * object.cc (Sized_relobj::do_should_include_member): Add layout
5929         parameter.
5930         * object.h (Object::should_include_member): Add layout parameter.
5931         Change all callers.
5932         (Object::do_should_include_member): Add layout parameter.
5933         (class Sized_relobj): Update declaration.
5934         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5935         parameter.
5936         * dynobj.h (class Sized_dynobj): Update declaration.
5937         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5938         layout parameter.
5939         * plugin.h (class Sized_pluginobj): Update declaration.
5940
5941 2010-08-02  Ian Lance Taylor  <iant@google.com>
5942
5943         PR 11866
5944         * output.cc (Output_segment::set_offset): Search for the first and
5945         last sections rather than assuming that the list is in order.
5946         (Output_segment::find_first_and_last_list): New function.
5947         * output.h (class Output_segment): Update declarations.
5948         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5949         (relro_strip_test_SOURCES): New variable.
5950         (relro_strip_test_DEPENDENCIES): New variable.
5951         (relro_strip_test_LDFLAGS): New variable.
5952         (relro_strip_test_LDADD): New variable.
5953         (relro_strip_test.so): New target.
5954
5955 2010-08-02  Ian Lance Taylor  <iant@google.com>
5956
5957         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5958         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5959         (Target_i386::got_tlsdesc_section): New function.
5960         (Target_i386::got_section): Create space for GOT entries for
5961         TLSDESC relocations.
5962         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5963         R_386_TLS_GOTDESC.
5964         (Target_i386::Scan::global): Likewise.
5965         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5966         using TLSDESC GOT.
5967         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5968         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5969         (Target_x86_64::got_tlsdesc_section): New function.
5970         (Target_x86_64::got_section): Create space for GOT entries for
5971         TLSDESC relocations.
5972         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5973         R_386_TLS_GOTDESC.
5974         (Target_x86_64::Scan::global): Likewise.
5975         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5976         using TLSDESC GOT.
5977
5978 2010-08-02  Ian Lance Taylor  <iant@google.com>
5979
5980         * testsuite/final_layout.sh: Use dc to convert from hex to
5981         decimal.
5982
5983 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5984
5985         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5986         paramter to the call to gold::gc_process_relocs.
5987         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5988         paramter to the call to gold::gc_process_relocs.
5989         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5990         parameter to the call to gold::gc_process_relocs.
5991         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5992         template parameter to the call to gold::gc_process_relocs.
5993         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5994         paramter to the call to gold::gc_process_relocs.
5995         * gc.h (get_embedded_addend_size): New function.
5996         (gc_process_relocs): Save the size of the reloc for use by ICF.
5997         * icf.cc (get_section_contents): Get the addend from the text section
5998         for SHT_REL relocation sections.
5999         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6000         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6001         * int_encoding.h (read_from_pointer): New overloaded function.
6002         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6003         * testsuite/icf_sht_rel_addend_test.sh: New file.
6004         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6005         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6006
6007 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6008
6009         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6010         * Makefile.in: Regenerate.
6011         * testsuite/Makefile.in: Regenerate.
6012
6013 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6014
6015         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6016         * gold/testsuite/debug_msg.cc: Likewise.
6017         * gold/testsuite/odr_violation1.cc
6018         * gold/testsuite/odr_violation2.cc
6019
6020 2010-07-21  Cary Coutant  <ccoutant@google.com>
6021
6022         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6023         string, and length fields.
6024         (Output_merge_string::Merged_strings_list): New type.
6025         (Output_merge_string::Merged_strings_lists): New typedef.
6026         (Output_merge_string): Replace merged_strings_ with
6027         merged_strings_lists_.
6028         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6029         Merged_strings_list per input object and section.  Don't store pointer
6030         to the string.  Don't store length with each merged string entry.
6031         (Output_merge_string::finalize_merged_data): Loop over list of merged
6032         strings lists.  Recompute length of each merged string.
6033
6034 2010-07-15  Cary Coutant  <ccoutant@google.com>
6035
6036         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6037         here.
6038
6039 2010-07-14  Ian Lance Taylor  <iant@google.com>
6040
6041         * descriptors.cc (Descriptors::open): Report correct name in error
6042         message.
6043
6044 2010-07-13  Doug Kwan  <dougkwan@google.com>
6045
6046         * arm.cc (Arm_input_section::Arm_input_section): For a
6047         SHT_ARM_EXIDX section, always keeps the input sections.
6048         (Arm_input_section::set_exidx_section_link): New method.
6049         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6050         has_errors_ to false.
6051         (Arm_exidx_input_section::has_errors,
6052         Arm_exidx_input_section::set_has_errors): New methods.
6053         (Arm_exidx_input_section::has_errors_): New data member.
6054         (Arm_relobj::get_exidx_shndx_list): New method.
6055         (Arm_output_section::append_text_sections_to_list): Do not skip
6056         section without SHF_EXECINSTR.
6057         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6058         errors.
6059         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6060         section header.  Make error messages more verbose.  Check for
6061         a non-executable section linked to an EXIDX section.
6062         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6063         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6064         check that there is no deferred EXIDX section if we exit early.
6065         Instead of not making an EXIDX section in case of an error, make one
6066         and set the has_errors flag of it.
6067         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6068         in a relocatable link.
6069         (Target_arm::do_relax): Look for the EXIDX output section instead of
6070         assuming that it is called .ARM.exidx.
6071         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6072         section list.  Do not check for SHF_EXECINSTR section flags but
6073         skip any input section with errors.
6074         * output.cc (Output_section::Output_section): Initialize
6075         always_keeps_input_sections_ to false.
6076         (Output_section::add_input_section): Check for
6077         always_keeps_input_sections_.
6078         *  output.h (Output_section::always_keeps_input_sections,
6079         Output_section::set_always_keeps_input_sections): New methods.
6080         (Output_section::always_keeps_input_sections): New data member.
6081
6082 2010-07-13  Rafael Espindola  <espindola@google.com>
6083
6084         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6085         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6086
6087 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6088             Ian Lance Taylor  <iant@google.com>
6089
6090         * output.h (Output_section_lookup_maps::add_merge_section):
6091         Correct check of whether value was inserted.
6092         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6093         (Output_section_lookup_maps::add_relaxed_input_section):
6094         Likewise.
6095         * arm.cc (Target_arm::got_section): Remove used local os.
6096         * i386.cc (Target_i386::got_section): Likewise.
6097         * x86_64.cc (Target_x86_64::got_section): Likewise.
6098         * sparc.cc (Target_sparc::got_section): Likewise.
6099         (Target_sparc::relocate): Remove unused local have_got_offset.
6100         * powerpc.cc (Target_powerpc::relocate): Likewise.
6101
6102 2010-07-13  Ian Lance Taylor  <iant@google.com>
6103
6104         * compressed_output.cc (zlib_decompress): Fix signature in
6105         !HAVE_ZLIB_H case.
6106
6107         * archive.cc (Archive::include_member): Unlock an external member
6108         of a thin archive.  Don't bother to delete an object we know is
6109         NULL.
6110
6111 2010-07-12  Cary Coutant  <ccoutant@google.com>
6112
6113         * compressed_output.cc (zlib_decompress): New function.
6114         (get_uncompressed_size): New function.
6115         (decompress_input_section): New function.
6116         * compressed_output.h (get_uncompressed_size): New function.
6117         (decompress_input_section): New function.
6118         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6119         Handle compressed debug sections.
6120         * layout.cc (is_compressed_debug_section): New function.
6121         (Layout::output_section_name): Map compressed section names to
6122         canonical names.
6123         * layout.h (is_compressed_debug_section): New function.
6124         (is_debug_info_section): Recognize compressed debug sections.
6125         * merge.cc: Include compressed_output.h.
6126         (Output_merge_data::do_add_input_section): Handle compressed
6127         debug sections.
6128         (Output_merge_string::do_add_input_section): Handle compressed
6129         debug sections.
6130         * object.cc: Include compressed_output.h.
6131         (Sized_relobj::Sized_relobj): Initialize new data members.
6132         (build_compressed_section_map): New function.
6133         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6134         * object.h (Object::section_is_compressed): New method.
6135         (Object::do_section_is_compressed): New method.
6136         (Sized_relobj::Compressed_section_map): New type.
6137         (Sized_relobj::do_section_is_compressed): New method.
6138         (Sized_relobj::compressed_sections_): New data member.
6139         * output.cc (Output_section::add_input_section): Handle compressed
6140         debug sections.
6141         * reloc.cc: Include compressed_output.h.
6142         (Sized_relobj::write_sections): Handle compressed debug sections.
6143
6144 2010-07-08  Cary Coutant  <ccoutant@google.com>
6145
6146         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6147         weak when resolving to a dynamic def.
6148         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6149         for weak undef/dynamic def cases. Adjust callers.
6150         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6151         undef_binding_weak_.
6152         (Symbol_table::sized_write_globals): Adjust symbol binding.
6153         (Symbol_table::sized_write_symbol): Add binding parameter.
6154         * symtab.h (Symbol::set_undef_binding): New method.
6155         (Symbol::is_undef_binding_weak): New method.
6156         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6157         (Symbol_table::should_override): Add new parameter.
6158         (Symbol_table::sized_write_symbol): Add new parameter.
6159
6160         * testsuite/weak_undef_file1.cc: Add new test case.
6161         * testsuite/weak_undef_file2.cc: Fix header comment.
6162         * testsuite/weak_undef_test.cc: Add new test case.
6163
6164 2010-06-29  Doug Kwan  <dougkwan@google.com>
6165
6166         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6167         Initialize USE_SYMBOL_.
6168         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6169         definition.
6170         (Arm_reloc_property::uses_symbol_): New data member declaration.
6171         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6172         uses symbol value and symbol is undefined but not weakly undefined.
6173
6174 2010-06-28  Rafael Espindola  <espindola@google.com>
6175
6176         * plugin.cc (Plugin::load): Use dlerror.
6177
6178 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6179
6180         * symtab.cc (detect_odr_violations): When reporting an ODR
6181         violation, report an object where the symbol is defined.
6182
6183 2010-06-25  Doug Kwan  <dougkwan@google.com>
6184
6185         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6186         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6187         definition.
6188         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6189         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6190         target hook to detect function points.
6191         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6192         * icf.h (Icf::check_section_for_function_pointers): Change type of
6193         parameter SECTION_NAME to const reference to std::string.  Use
6194         target hook to determine if section may have unsafe pointers.
6195         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6196         method definition.
6197
6198 2010-06-21  Rafael Espindola  <espindola@google.com>
6199
6200         * fileread.cc (Input_file::find_fie): New
6201         (Input_file::open): Use Input_file::find_fie.
6202         * fileread.h (Input_file::find_fie): New
6203         * plugin.cc (set_extra_library_path): New.
6204         (Plugin::load): Add set_extra_library_path to the transfer vector.
6205         (Plugin_manager::set_extra_library_path): New.
6206         (Plugin_manager::add_input_file): Use the extra search path if set.
6207         (set_extra_library_path(): New.
6208         * plugin.h (Plugin_manager): Add set_extra_library_path and
6209         extra_search_path_.
6210
6211 2010-06-19  Cary Coutant  <ccoutant@google.com>
6212
6213         * layout.cc (gdb_sections): Add .debug_types.
6214         (lines_only_debug_sections): Likewise.
6215
6216 2010-06-18  Rafael Espindola  <espindola@google.com>
6217
6218         * plugin.cc (add_input_file,add_input_library)
6219         (Plugin_manager::add_input_file): Make filename arguments const.
6220         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6221         const.
6222
6223 2010-06-16  Doug Kwan  <dougkwan@google.com>
6224
6225         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6226         .ARM.attributes section if we have not merged any input
6227         attributes sections.
6228
6229 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6230
6231         * arm.cc: Allow combining objects with no EABI version
6232         information.
6233
6234 2010-06-15  Rafael Espindola  <espindola@google.com>
6235
6236         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6237
6238 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6239
6240         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6241         (struct iovec): Correct !HAVE_READV definition.
6242
6243 2010-06-10  Cary Coutant  <ccoutant@google.com>
6244
6245         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6246         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6247         reloc sections.
6248         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6249
6250         PR 11683
6251         * symtab.h (Symbol::is_placeholder): New member function.
6252         * target-reloc.h (relocate_section): Check for placeholder symbols.
6253
6254         * testsuite/Makefile.am (plugin_test_8): New test.
6255         (plugin_test_9): New test.
6256         * testsuite/Makefile.in: Regenerate.
6257
6258 2010-06-09  Nick Clifton  <nickc@redhat.com>
6259
6260         * yyscript.y (input_list_element): Allow strings prefixed with
6261         the '-' character.  Treat these as libraries.
6262         * script.cc (script_add_library): New function.  Adds a library
6263         specified by "-l<name>" found in an input script.
6264         * script-c.h: Add prototype for script_add_library.
6265
6266 2010-06-07  Doug Kwan  <dougkwan@google.com>
6267
6268         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6269         Restrict stub-group size to be within long conditional branch
6270         range when working around cortex-A8 erratum.
6271
6272 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6273
6274         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6275         #ifdef typo.
6276
6277 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6278
6279         PR gold/11658
6280         * output.cc
6281         (Output_section::Input_section_sort_entry::compare_section_ordering):
6282         Change to return non-zero correctly.
6283         (Output_section::Input_section_sort_section_order_index_compare
6284         ::operator()): Change to fix ambiguity in comparisons.
6285
6286 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6287
6288         * gold.h (is_wildcard_string): New function.
6289         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6290         (Layout::layout_eh_frame): Ditto.
6291         (Layout::find_section_order_index): New method.
6292         (Layout::read_layout_from_file): New method.
6293         * layout.h (Layout::find_section_order_index): New method.
6294         (Layout::read_layout_from_file): New method.
6295         (Layout::input_section_position_): New private member.
6296         (Layout::input_section_glob_): New private member.
6297         * main.cc (main): Call read_layout_from_file here.
6298         * options.h (--section-ordering-file): New option.
6299         * output.cc (Output_section::input_section_order_specified_): New
6300         member.
6301         (Output_section::Output_section): Initialize new member.
6302         (Output_section::add_input_section): Add new parameter.
6303         Keep input sections when --section-ordering-file is used.
6304         (Output_section::set_final_data_size): Sort input sections when
6305         section ordering file is specified.
6306         (Output_section::Input_section_sort_entry): Add new parameter.
6307         Check sorting type.
6308         (Output_section::Input_section_sort_entry::compare_section_ordering):
6309         New method.
6310         (Output_section::Input_section_sort_compare::operator()): Change to
6311         consider section_order_index.
6312         (Output_section::Input_section_sort_init_fini_compare::operator()):
6313         Change to consider section_order_index.
6314         (Output_section::Input_section_sort_section_order_index_compare
6315         ::operator()): New method.
6316         (Output_section::sort_attached_input_sections): Change to sort
6317         according to section order when specified.
6318         (Output_section::add_input_section<32, true>): Add new parameter.
6319         (Output_section::add_input_section<64, true>): Add new parameter.
6320         (Output_section::add_input_section<32, false>): Add new parameter.
6321         (Output_section::add_input_section<64, false>): Add new parameter.
6322         * output.h (Output_section::add_input_section): Add new parameter.
6323         (Output_section::input_section_order_specified): New
6324         method.
6325         (Output_section::set_input_section_order_specified): New method.
6326         (Input_section::Input_section): Initialize section_order_index_.
6327         (Input_section::section_order_index): New method.
6328         (Input_section::set_section_order_index): New method.
6329         (Input_section::section_order_index_): New member.
6330         (Input_section::Input_section_sort_section_order_index_compare): New
6331         struct.
6332         (Output_section::input_section_order_specified_): New member.
6333         * script-sections.cc (is_wildcard_string): Delete and move modified
6334         method to gold.h.
6335         (Output_section_element_input::Output_section_element_input): Modify
6336         call to is_wildcard_string.
6337         (Output_section_element_input::Input_section_pattern
6338         ::Input_section_pattern): Ditto.
6339         (Output_section_element_input::Output_section_element_input): Ditto.
6340         * testsuite/Makefile.am (final_layout): New test case.
6341         * testsuite/Makefile.in: Regenerate.
6342         * testsuite/final_layout.cc: New file.
6343         * testsuite/final_layout.sh: New file.
6344
6345 2010-06-01  Rafael Espindola  <espindola@google.com>
6346
6347         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6348
6349 2010-06-01  Rafael Espindola  <espindola@google.com>
6350
6351         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6352         visibility of symbols.
6353
6354 2010-05-27  Doug Kwan  <dougkwan@google.com>
6355
6356         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6357         from start of output section instead of address for a local symbol
6358         in a merged or relaxed section when doing a relocatable link.
6359
6360 2010-05-26  Rafael Espindola  <espindola@google.com>
6361
6362         PR 11604
6363         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6364         adding sections the garbage collector removed.
6365         * gold/testsuite/Makefile.am: Add test.
6366         * gold/testsuite/Makefile.in: Regenerate.
6367         * gold/testsuite/plugin_test_7.sh: New.
6368         * gold/testsuite/plugin_test_7_1.c: New.
6369         * gold/testsuite/plugin_test_7_2.c: New.
6370
6371 2010-05-26  Rafael Espindola  <espindola@google.com>
6372
6373         * script-sections.cc (Output_section_definition::set_section_addresses):
6374         Check for --section-start.
6375
6376 2010-05-26  Doug Kwan  <dougkwan@google.com>
6377
6378         * arm.cc (Arm_scan_relocatable_relocs): New class.
6379         (Target_arm::relocate_special_relocatable): New method.
6380         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6381         (Arm_relocate_functions::thumb_branch_common): Same.
6382         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6383         instead of Default_scan_relocatable_relocs.
6384         * target-reloc.h (relocate_for_relocatable): Let target handle
6385         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6386         * target.h (Sized_target::relocate_special_relocatable): New method.
6387
6388 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6389
6390         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6391
6392 2010-05-23  Doug Kwan  <dougkwan@google.com>
6393
6394         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6395         instead of a cast.
6396         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6397         with a direct branch, not a conditional branch, to a stub.
6398         * merge.cc (Output_merge_base::record_input_section): New method
6399         defintion.
6400         (Output_merge_data::do_add_input_section): Record input section if
6401         keeps-input-sections flag is set.
6402         (Output_merge_string::do_add_input_section): Ditto.
6403         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6404         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6405         INPUT_SECTIONS_.
6406         (Output_merge_base::keeps_input_sections,
6407         Output_merge_base::set_keeps_input_sections,
6408         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6409         method definitions.
6410         (Output_merge_base::Input_sections): New type declaration.
6411         (Output_merge_base::input_sections_begin,
6412         Output_merge_base::input_sections_end,
6413         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6414         (Output_merge_base::bool keeps_input_sections_,
6415         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6416         Output_merge_base::input_sections_): New data members.
6417         (Output_merge_data::do_set_keeps_input_sections): New method
6418         defintion.
6419         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6420         * output.cc (Output_section::Input_section::relobj): Move method
6421         defintion from class declaration to here and handle merge sections.
6422         (Output_section::Input_section::shndx): Ditto.
6423         (Output_section::Output_section): Remove initializations of removed
6424         data members and initialize new data member LOOKUP_MAPS_.
6425         (Output_section::add_input_section): Set keeps-input-sections flag
6426         for a newly created merge output section as appropriate.  Adjust code
6427         to use Output_section_lookup_maps class.
6428         (Output_section::add_relaxed_input_section): Adjst code for lookup
6429         maps code refactoring.
6430         (Output_section::add_merge_input_section): Add a new parameter
6431         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6432         class.  If adding input section to a newly created merge output
6433         section fails, remove the new merge section.
6434         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6435         Adjust code for use of the Output_section_lookup_maps class.
6436         (Output_section::find_merge_section): Ditto.
6437         (Output_section::build_lookup_maps): New method defintion.
6438         (Output_section::find_relaxed_input_section): Adjust code to use
6439         Output_section_lookup_maps class.
6440         (Output_section::get_input_sections): Export merge sections.  Adjust
6441         code to use Output_section_lookup_maps class.
6442         (Output_section:::add_script_input_section): Adjust code to use
6443         Output_section_lookup_maps class.  Update lookup maps for merge
6444         sections also.
6445         (Output_section::discard_states): Use Output_section_lookup_maps.
6446         (Output_section::restore_states): Same.
6447         * output.h (Merge_section_properties): Move class defintion out of
6448         Output_section.
6449         (Output_section_lookup_maps): New class.
6450         (Output_section::Input_section::is_merge_section): New method
6451         defintion.
6452         (Output_section::Input_section::relobj): Move defintion out of class
6453         defintion.  Declare method only.
6454         (Output_section::Input_section::shndx): Ditto.
6455         (Output_section::Input_section::output_merge_base): New method defintion.
6456         (Output_section::Input_section::u2_.pomb): New union field.
6457         (Output_section::Merge_section_by_properties_map,
6458         Output_section::Output_section_data_by_input_section_map,
6459         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6460         Remove types.
6461         (Output_section::add_merge_input_section): Add new parameter
6462         KEEPS_INPUT_SECTIONS.
6463         (Output_section::build_lookup_maps): New method declaration.
6464         (Output_section::merge_section_map_,
6465         Output_section::merge_section_by_properties_map_,
6466         Output_section::relaxed_input_section_map_,
6467         Output_section::is_relaxed_input_section_map_valid_): Remove data
6468         members.
6469         (Output_section::lookup_maps_): New data member.
6470
6471 2010-05-21  Doug Kwan  <dougkwan@google.com>
6472
6473         PR gold/11619
6474         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6475         avoid a compilation error.
6476
6477 2010-05-19  Rafael Espindola  <espindola@google.com>
6478
6479         * script-sections.cc (Output_section_definition::allocate_to_segment):
6480         Update the phdrs_list even when the output section is NULL.
6481         * testsuite/Makefile.am: Add test.
6482         * testsuite/Makefile.in: Regenerate.
6483         * testsuite/script_test_9.cc: New.
6484         * testsuite/script_test_9.sh: New.
6485         * testsuite/script_test_9.t: New.
6486
6487 2010-05-19  Doug Kwan  <dougkwan@google.com>
6488
6489         * arm.cc (Arm_input_section::original_size): New method.
6490         (Arm_input_section::do_addralign): Add a cast.
6491         (Arm_input_section::do_output_offset): Remove static cast.
6492         (Arm_input_section::original_addralign,
6493          Arm_input_section::original_size_): Change type to uint32_t.
6494         (Arm_input_section::init): Add safe casts for section alignment
6495         and size.
6496         (Arm_input_section::set_final_data_size): Do not set address and
6497         offset of stub table.
6498         (Arm_output_section::fix_exidx_coverage): Change use of of
6499         Output_section::Simple_input_section to that of
6500         Output_section::Input_section.
6501         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6502         except for the first pass.
6503         * output.cc (Output_section::get_input_sections): Change type of
6504         input_sections to std::list<Input_section>.
6505         (Output_section::add_script_input_section): Rename from
6506         Output_section::add_simple_input_section.  Change type of SIS
6507         parameter from Simple_input_section to Input_section.
6508         * output.h (Output_section::Simple_input_section): Remove class.
6509         (Output_section::Input_section): Change class visibility to public.
6510         (Output_section::Input_section::addralign): Use stored alignments
6511         for special input sections if set.
6512         (Output_section::Input_section::set_addralign): New method.
6513         (Output_section::get_input_sections): Change parameter type from
6514         list of Simple_input_section to list of Input_section.
6515         (Output_section::add_script_input_section): Rename from
6516         Output_section::add_simple_input_section. Change first parameter's
6517         type from Simple_input_section to Input_section and remove the
6518         second and third parameters.
6519         * script-sections.cc (Input_section::Input_section_list): Change
6520         type to list of Output_section::Input_section/
6521         (Input_section_info::Input_section_info): Change parameter type of
6522         INPUT_SECTION to Output_section::Input_section.
6523         (Input_section_info::input_section): Change return type.
6524         (Input_section_info::input_section_): Change type to
6525         Output_section::Input_section.
6526         (Output_section_element_input::set_section_addresses): Adjust code
6527         to use Output_section::Input_section instead of
6528         Output_section::Simple_input_section.  Adjust code for renaming
6529         of Output_section::add_simple_input_section.
6530         (Orphan_output_section::set_section_addresses): Ditto.
6531
6532 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6533
6534         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6535         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6536
6537 2010-05-18  Rafael Espindola  <espindola@google.com>
6538
6539         * options.cc (General_options::finalize): Handle -nostdlib.
6540         * options.h (nostdlib): New option.
6541         * script.cc (script_add_search_dir): Handle -nostdlib.
6542
6543 2010-05-12  Doug Kwan  <dougkwan@google.com>
6544
6545         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6546         attributes section only if there no attributes section after merging.
6547         (Target_arm::merge_object_attributes): Move value of
6548         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6549         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6550         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6551         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6552         and arm_attr_merge_7.stdout.
6553         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6554         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6555         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6556         arm_attr_merge_7b.o): New rules.
6557         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6558         arm_attr_merge_7
6559         * testsuite/Makefile.in: Regenerate.
6560         * testsuite/arm_attr_merge.sh: New file.
6561         * testsuite/arm_attr_merge_[67][ab].s: Same.
6562
6563 2010-05-05  Nick Clifton  <nickc@redhat.com>
6564
6565         * po/es.po: Updated Spanish translation.
6566
6567 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6568
6569         * Makefile.am (install-exec-local): Properly install gold as
6570         default cross linker.
6571         * Makefile.in: Regenerated.
6572
6573 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6574             Nick Clifton  <nickc@redhat.com>
6575
6576         * configure.ac (install_as_default): Define and set to false
6577         unless --enable-gold or --enable-gold=both/gold has been
6578         specified.
6579         * configure: Regenerate.
6580
6581         * Makefile.am (install-exec-local): Install the executable as
6582         'ld.gold'.  If install_as_default is true then also install it as
6583         'ld'.
6584         * Makefile.in: Regenerated.
6585
6586 2010-04-24  Ian Lance Taylor  <iant@google.com>
6587
6588         * layout.cc (Layout::layout_reloc): In relocatable link don't
6589         combine reloc sections for grouped sections.
6590
6591 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6592
6593         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6594         sections that are not ordinary to icf.
6595         * icf.cc (get_section_contents): Handle relocation pointing to section
6596         with no object or shndx information.
6597         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6598         * testsuite/Makefile.in: Regenerate.
6599         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6600         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6601
6602 2010-04-22  Ian Lance Taylor  <iant@google.com>
6603
6604         * expression.cc (Expression::Expression_eval_info): Add
6605         result_alignment_pointer field.
6606         (Expression::eval_with_dot): Add result_alignment_pointer
6607         parameter.  Change all callers.
6608         (Expression::eval_maybe_dot): Likewise.
6609         (class Binary_expression): Add alignment_pointer parameter to
6610         left_value and right_value.  Change all callers.
6611         (BINARY_EXPRESSION): Set result alignment.
6612         (class Trinary_expression): Add alignment_pointer parameter to
6613         arg2_value and arg3_value.  Change all callers.
6614         (Trinary_cond::value): Set result alignment.
6615         (Max_expression::value, Min_expression::value): Likewise.
6616         (Align_expression::value): Likewise.
6617         * script-sections.cc (class Sections_element): Add dot_alignment
6618         parameter to set_section_addresses virtual function.  Update
6619         instantiations.
6620         (class Output_section_element): Likewise.
6621         (Script_sections::create_segments): Add dot_alignment parameter.
6622         Change all callers.
6623         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6624         (Script_sections::set_phdrs_clause_addresses): Likewise.
6625         * script-sections.h: Update declarations.
6626         * script.h: Update declarations.
6627         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6628         min_p_align.
6629         * testsuite/script_test_3.t: Set large alignment.
6630         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6631         segment has expected alignment.
6632
6633 2010-04-22  Nick Clifton  <nickc@redhat.com>
6634
6635         * po/gold.pot: Updated by the Translation project.
6636         * po/vi.po: Updated Vietnamese translation.
6637
6638 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6639
6640         * testsuite/Makefile.am (check_PROGRAMS): Add
6641         icf_virtual_function_folding_test.
6642         * testsuite/Makefile.in: Regenerated.
6643
6644 2010-04-15  Andrew Haley  <aph@redhat.com>
6645
6646         * options.h (merge_exidx_entries): New option.
6647         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6648         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6649         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6650         (Target_arm::merge_exidx_entries): New function.
6651         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6652         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6653         to Arm_exidx_fixup constructor.
6654         Add new arg, merge_exidx_entries.
6655         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6656         Arm_output_section::fix_exidx_coverage.
6657
6658 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6659
6660         * icf.cc (get_section_contents): Check for preemptible functions.
6661         Ignore addend when appropriate.
6662         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6663         section folded.
6664         (add_from_relobj): Check for section folded.
6665         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6666         * symtab.h (should_add_dynsym_entry): Add new parameter.
6667         * target-reloc.h (scan_relocs): Check for section folded.
6668         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6669         Check reloc types for function pointers in shared objects.
6670         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6671         case.
6672         (icf_preemptible_functions_test): New test case.
6673         (icf_string_merge_test): New test case.
6674         * testsuite.Makefile.in: Regenerate.
6675         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6676         bar_glob.  Refactor code.
6677         * testsuite/icf_preemptible_functions_test.cc: New file.
6678         * testsuite/icf_preemptible_functions_test.sh: New file.
6679         * testsuite/icf_string_merge_test.cc: New file.
6680         * testsuite/icf_string_merge_test.sh: New file.
6681         * testsuite/icf_virtual_function_folding_test.cc: New file.
6682         * testsuite/icf_virtual_function_folding_test.sh: New file.
6683
6684 2010-04-14  Doug Kwan  <dougkwan@google.com>
6685
6686         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6687         for local symbol recounting if we remove a section due to ICF.
6688         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6689         there are no regular objects in input.
6690
6691 2010-04-13  Doug Kwan  <dougkwan@google.com>
6692
6693         * arm.cc (Arm_input_section::set_final_data_size): Compute
6694         accurate final data size instead of using current data size.
6695
6696 2010-04-09  Doug Kwan  <dougkwan@google.com>
6697
6698         * layout.cc (Layout::choose_output_section): Handle script section
6699         types.
6700         (Layout::make_output_section_for_script): Add section type parameter.
6701         Handle script section types.
6702         * layout.h (Layout::make_output_section_for_script): Add section
6703         type parameter.
6704         * output.cc (Output_section::Output_section): Initialize data member
6705         is_noload_.
6706         (Output_section::do_reset_address_and_file_offset): Do not set address
6707         to 0 if section is a NOLOAD section.
6708         * output.h (Output_section::is_noload): New method.
6709         (Output_section::set_is_noload): Ditto.
6710         (Output_section::is_noload_): New data member.
6711         * script-c.h (Script_section_type): New enum type.
6712         (struct Parser_output_section_header): Add new file section_type.
6713         * script-sections.cc (Sections_element::output_section_name): Add
6714         parameter for returning script section type.
6715         (Output_section_definition::output_section_name): Ditto.
6716         (Output_section_definition::section_type)P; New method.
6717         (Output_section_definiton::script_section_type_name): Ditto.
6718         (Output_section_definition::script_section_type_): New data member.
6719         (Output_section_definition::Output_section_definition): Initialize
6720         data member Output_section_definition::script_section_type_.
6721         (Output_section_definition::create_sections): Pass script section type
6722         to Layout::make_output_section_for_script.
6723         (Output_section_definition::output_section_name): Return script
6724         section type to caller.
6725         (Output_section_definition::set_section_address): Do not advance
6726         dot value and load address if section type is NOLOAD.  Set address
6727         of NOLOAD sections regardless of section flags.
6728         (Output_section_definition::print): Print section type if it is
6729         not SCRIPT_SECTION_TYPE_NONE.
6730         (Output_section_definition::section_type): New method.
6731         (Output_section_definition::script_section_type_name): Ditto.
6732         (Script_sections::output_section_name): Add new parameter
6733         PSECTION_TYPE for returning script section type.  Pass it to
6734         section elements.  Handle discard sections.
6735         (Sort_output_sections::operator()): Handle NOLOAD sections.
6736         * script-sections.h (Script_sections::Section_type): New enum type.
6737         (Script_sections::output_section_name): Add a new parameter for
6738         returning script section type.
6739         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6740         INFO and NOLOAD.
6741         * yyscript.y (union): Add new field SECTION_TYPE.
6742         (COPY, DSECT, INFO, NOLOAD): New tokens.
6743         (opt_address_and_section_type): Change type to output_section_header.
6744         (section_type): New non-terminal
6745         (section_header): Handle section type.
6746         (opt_address_and_section_type): Return section type value.
6747
6748 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6749
6750         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6751         * testsuite/plugin_common_test_2.c (foo): Likewise.
6752
6753 2010-04-08  Doug Kwan  <dougkwan@google.com>
6754
6755         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6756         Output_merge_data.
6757         * output.cc (Output_section::add_merge_input_section): Simplify
6758         code and return status of Output_merge_base::add_input_section.
6759         Update merge section map only if Output_merge_base::add_input_section
6760         returns true.
6761
6762 2010-04-07  Doug Kwan  <dougkwan@google.com>
6763
6764         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6765         if section is marked as containing instructions but has no mapping
6766         symbols.
6767         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6768         correct section index.
6769         (Arm_relobj::find_linked_text_section): Ditto.
6770
6771 2010-04-07  Cary Coutant  <ccoutant@google.com>
6772
6773         * archive.cc (include_member): Destroy Read_symbols_data object before
6774         releasing file.
6775         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6776         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6777         (Read_symbols_data::~Read_symbols_data) New destructor.
6778         (Section_relocs::Section_relocs) New constructor.
6779         (Section_relocs::~Section_relocs) New destructor.
6780         (Read_relocs_data::Read_relocs_data) New constructor.
6781         (Read_relocs_data::~Read_relocs_data) New destructor.
6782         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6783         pointers to NULL after deleting.
6784
6785 2010-04-07  Doug Kwan  <dougkwan@google.com>
6786
6787         * arm.cc: Replace "endianity" with "endianness" in comments.
6788         (Arm_exidx_cantunwind): Ditto.
6789         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6790         (Arm_relobj::merge_flags_and_attributes): New method.
6791         (Arm_relobj::merge_flags_and_attributes_): New data member.
6792         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6793         (Arm_relobj::scan_sections_for_stubs): Ditto.
6794         (Arm_relobj::do_read_symbols): Check to see if we really want to
6795         merge processor-specific flags and attributes.  Exit early if
6796         an object is empty except for section names and the undefined symbol.
6797         (Target_arm::do_finalize_sections): Move check for ELF format to
6798         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6799         attributes from a regular object only when we have determined that
6800         it is aapropriate.  Do not create an .ARM.attributes section in
6801         output if there is no regular input object.
6802         (Target_arm::merge_processor_specific_flags): Check
6803         --warn-mismatch before printing any error.
6804         (Target_arm::merge_object_attributes): Ditto.
6805         * gold.cc (queue_middle_tasks): Handle the case in which there is
6806         no regular object in input.
6807         * options.cc (General_options::parse_EB): New method.
6808         (General_options::parse_EL): Same.
6809         (General_options::General_options): Initialize endianness_.
6810         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6811         New options.
6812         (General_options::Endianness): New enum.
6813         (General_options::endianness): New method.
6814         (General_options::endianness_): New data member.
6815         * parameters.cc (Parameters::set_options): Check target endianness.
6816         (Parameters::set_target_once): Ditto.
6817         (Parameters::check_target_endianness): New method.
6818         (parameters_force_valid_target): If either -EL or -EB is specified,
6819         use it to define endianness of default target.
6820         * parameters.h (Parameters::check_target_endianness): New method
6821         declaration.
6822         * target.h (class Target): Change "endianity" to "endianness"
6823         in comments.
6824
6825 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6826
6827         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6828         * configure: Regenerate.
6829         * Makefile.in: Regenerate.
6830         * testsuite/Makefile.in: Regenerate.
6831
6832 2010-04-06  Cary Coutant  <ccoutant@google.com>
6833
6834         gcc PR lto/42757
6835         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6836         prevailing definitions of common symbols.
6837         * testsuite/plugin_test_6.sh: New test case.
6838         * testsuite/plugin_common_test_1.c: New test case.
6839         * testsuite/plugin_common_test_2.c: New test case.
6840         * testsuite/Makefile.am (plugin_test_6): New test case.
6841         * testsuite/Makefile.in: Regenerate.
6842
6843 2010-04-06  Nick Clifton  <nickc@redhat.com>
6844
6845         * po/vi.po: New Vietnamese translation.
6846
6847 2010-03-30  Doug Kwan  <dougkwan@google.com>
6848
6849         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6850
6851 2010-03-25  Doug Kwan  <dougkwan@google.com>
6852
6853         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6854         to avoid a conversion warning on a 32-bit host.
6855
6856 2010-03-24  Ian Lance Taylor  <iant@google.com>
6857
6858         * testsuite/script_test_3.t: Add a TLS segment.
6859         * testsuite/Makefile.am (check_PROGRAMS): Add
6860         tls_phdrs_script_test.
6861         (tls_phdrs_script_test_SOURCES): Define.
6862         (tls_phdrs_script_test_DEPENDENCIES): Define.
6863         (tls_phdrs_script_test_LDFLAGS): Define.
6864         (tls_phdrs_script_test_LDADD): Define.
6865         * testsuite/Makefile.in: Rebuild.
6866
6867 2010-03-23  Cary Coutant  <ccoutant@google.com>
6868
6869         * fileread.cc (find_or_make_view): Fix comment.
6870
6871 2010-03-23  Ian Lance Taylor  <iant@google.com>
6872
6873         * script-sections.cc (class Orphan_section_placement): Define
6874         PLACE_TLS and PLACE_TLS_BSS.
6875         (Orphan_section_placement::Orphan_section_placement): Initialize
6876         new places.
6877         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6878         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6879         (tls_script_test_SOURCES): Define.
6880         (tls_script_test_DEPENDENCIES): Define.
6881         (tls_script_test_LDFLAGS): Define.
6882         (tls_script_test_LDADD): Define.
6883         * testsuite/Makefile.in: Rebuild.
6884
6885 2010-03-22  Doug Kwan  <dougkwan@google.com>
6886
6887         * arm.cc (Arm_relocate_functions::abs8,
6888         Arm_relocate_functions::abs16): Use correct check for overflow
6889         specified in the ARM ELF specs.
6890         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6891         target of a BLX instruction specially.
6892         (Reloc_stub::stub_type_for_reloc): Ditto.
6893         (Relocate::relocate): Use symbolic names instead of numeric relocation
6894         codes to report error.
6895         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6896         workaround.
6897         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6898         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6899         thumb2_blx_out_of_range.stdout
6900         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6901         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6902         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6903         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6904         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6905         thumb2_blx_in_range, thumb2_blx_in_range.o,
6906         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6907         thumb2_blx_out_of_range.o): New rules.
6908         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6909         thumb2_blx_in_range and thumb2_blx_out_of_range.
6910         * testsuite/Makefile.in: Regenerate.
6911         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6912         * testsuite/thumb_blx_in_range.s: New file.
6913         * testsuite/thumb_blx_out_of_range.s: New file.
6914
6915 2010-03-22  Rafael Espindola  <espindola@google.com>
6916
6917         * archive.cc (Should_include): Move to archive.h.
6918         (should_include_member): Make it a member of Archive.
6919         (Lib_group): New.
6920         (Add_lib_group_symbols): New.
6921         * archive.h: Include options.h.
6922         (Archive_member): Moved from Archive.
6923         (Should_include): Moved from archive.cc.
6924         (Lib_group): New.
6925         (Add_lib_group_symbols): New.
6926         * dynobj.cc (do_should_include_member): New.
6927         * dynobj.h (do_should_include_member): New.
6928         * gold.cc (queue_initial_tasks): Update call to queue.
6929         * main.cc (main): Print lib group stats.
6930         * object.cc (do_should_include_member): New.
6931         * object.h: Include archive.h.
6932         (Object::should_include_member): New.
6933         (Object::do_should_include_member): New.
6934         (Sized_relobj::do_should_include_member): New.
6935         * options.cc (General_options::parse_start_lib): New.
6936         (General_options::parse_end_lib): New.
6937         (Input_arguments::add_file): Handle lib groups.
6938         (Input_arguments::start_group): Check we are not in a lib.
6939         (Input_arguments::start_lib): New.
6940         (Input_arguments::end_lib): New.
6941         * options.h (General_options): Add start_lib and end_lib.
6942         (Input_argument::lib_): New.
6943         (Input_argument::lib): New.
6944         (Input_argument::is_lib): New.
6945         (Input_file_lib): New.
6946         (Input_arguments::in_lib_): New.
6947         (Input_arguments::in_lib): New.
6948         (Input_arguments::start_lib): New.
6949         (Input_arguments::end_lib_): New.
6950         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6951         in unused members as preempted.
6952         (Sized_pluginobj::do_should_include_member): New.
6953         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6954         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6955         return the blocker.
6956         (Read_symbols::do_whole_lib_group): New.
6957         (Read_symbols::do_lib_group): New.
6958         (Read_symbols::do_read_symbols): Handle lib groups.
6959         (Read_symbols::get_name): Handle lib groups.
6960         * readsyms.h (Read_symbols): Add an archive member pointer.
6961         (Read_symbols::do_whole_lib_group): New.
6962         (Read_symbols::do_lib_group): New.
6963         (Read_symbols::member_): New.
6964         * script.cc (read_input_script): Update call to queue_soon.
6965
6966 2010-03-19  Doug Kwan  <dougkwan@google.com>
6967
6968         * arm.cc (Stub_table::Stub_table): Initialize new data members
6969         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6970         (Stub_table::add_reloc_stub): Assign stub offset and update
6971         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6972         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6973         New data members.
6974         (Stub_table::update_data_size_and_addralign): Use
6975         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6976         instead of going over all reloc stubs.
6977         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6978         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6979         Stringpool_template::offset_ to size of Stringpool_char.
6980         (Stringpool_template::new_key_offset): Remove code to initialize
6981         Stringpool_template::offset_.
6982         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6983         Stringpool_template::offset_ to zero.
6984
6985 2010-03-15  Doug Kwan  <dougkwan@google.com>
6986
6987         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6988         offset_.
6989         (Stringpool_template::new_key_offset): New method.
6990         (Stringpool_template::add_string): Assign offsets when adding new
6991         strings.
6992         (Stringpool_template::set_string_offsets): Do not set string offsets
6993         when not optimizing.
6994         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6995         member size_.
6996         (Chunked_vector::clear): Clear size_.
6997         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6998         (Chunked_vector::size): Return size_.
6999         (Chunked_vector::push_back): Use size_ to find insert position.
7000         (Chunked_vector::size_): New data member.
7001         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7002         (Stringpool_template::new_key_offset): New method declaration.
7003         (Stringpool_template::offset_): New data member.
7004
7005 2010-03-15   Rafael Espindola  <espindola@google.com>
7006
7007         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7008         Add_symbols' constructor.
7009         * readsyms.h (Add_symbols): Remove the input_group member.
7010
7011 2010-03-10  Ian Lance Taylor  <iant@google.com>
7012
7013         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7014         target to ask whether a reference to a symbol requires a stack
7015         split.
7016         * target.h (Target::is_call_to_non_split): New function.
7017         (Target::do_is_call_to_non_split): Declare virtual function.
7018         * target.cc: Include "symtab.h".
7019         (Target::do_is_call_to_non_split): New function.
7020         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7021
7022 2010-03-10  Cary Coutant  <ccoutant@google.com>
7023
7024         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7025         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7026         (File_read::open[2]): Add whole_file_view_ to list of views.
7027         (File_read::make_view): Remove test of whole_file_view_.
7028         (File_read::find_or_make_view): Create whole_file_view_ if
7029         necessary.
7030         (File_read::clear_views): Replace bool parameter with enum;
7031         adjust all callers.  Don't delete views with permanent data;
7032         do delete cached views and views from archives if
7033         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7034         if clearing the corresponding view.
7035         * fileread.h (File_read::Clear_views_mode): New enum.
7036         (File_read::View::is_permanent_view): New method.
7037         (File_read::clear_views): Replace bool parameter
7038         with enum; adjust all callers.
7039         * options.h (General_options): Change keep_files_mapped option;
7040         add map_whole_files.
7041         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7042         releasing the file.
7043         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7044         the file.
7045
7046 2010-03-10  David S. Miller  <davem@davemloft.net>
7047
7048         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7049
7050 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7051
7052         * icf.cc (get_section_contents): Add '@' marker after processing the
7053         merge reloc.
7054
7055 2010-03-08  Doug Kwan  <dougkwan@google.com>
7056
7057         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7058         due to a conversion warning.
7059         (Arm_relobj::update_output_local_symbol_count): Check for local
7060         symbol with unset output index.
7061
7062 2010-03-05  Ian Lance Taylor  <iant@google.com>
7063
7064         * options.h (class General_options): Add --spare-dynamic-tags.
7065         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7066         --spare-dynamic-tags.
7067
7068 2010-03-05  Ian Lance Taylor  <iant@google.com>
7069
7070         * incremental.cc: Include "libiberty.h".
7071
7072 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7073
7074         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7075         function, is_info_ member.
7076         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7077         (Versions::Versions): Update caller.
7078         (Versions::define_base_version): Likewise.
7079         (Versions::add_def): Likewise.
7080
7081 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7082
7083         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7084         (Scan::possible_function_pointer_reloc): New function.
7085         (Scan::local_reloc_may_be_function_pointer): Change to call
7086         possible_function_pointer_reloc.
7087         (Scan::global_reloc_may_be_function_pointer): Ditto.
7088         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7089         relocations in ".data.rel.ro._ZTV" section.
7090         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7091         * testsuite/icf_safe_so_test.cc: Ditto.
7092         * testsuite/icf_safe_test.cc: Ditto.
7093         * testsuite/icf_safe_test.sh: Ditto.
7094
7095 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7096             Ian Lance Taylor  <iant@google.com>
7097
7098         * target-reloc.h (relocate_section): Check the symbol table index
7099         for -1U before setting the local symbol index.
7100         (scan_relocatable_relocs): If copying the relocation, record that
7101         the local symbol is required.
7102         * object.h (Symbol_value::is_output_symtab_index_set): New
7103         function.
7104         (Symbol_value::may_be_discarded_from_output_symtab): New
7105         function.
7106         (Symbol_value::has_output_symtab_entry): New function.
7107         (Symbol_value::needs_output_symtab_entry): Remove.
7108         (Symbol_value::output_symtab_index): Make sure the symbol index is
7109         set.
7110         (Symbol_value::set_output_symtab_index): Make sure the symbol
7111         index is not set.  Make sure the new index is valid.
7112         (Symbol_value::set_must_have_output_symtab_entry): New function.
7113         (Symbol_value::has_output_dynsym_entry): New function.
7114         (Symbol_value::set_output_dynsym_index): Make sure the new index
7115         is valid.
7116         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7117         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7118         local symbol if permitted.
7119         (Sized_relobj::do_finalize_local_symbols): Call
7120         is_output_symtab_index_set rather than needs_output_symtab_entry.
7121         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7122         rather than needs_output_symtab_entry.  Call
7123         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7124         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7125         is_output_symtab_index_set rather than needs_output_symtab_entry.
7126         * testsuite/discard_locals_relocatable_test.c: New file.
7127         * testsuite/discard_locals_test.sh: Test -r.
7128         * testsuite/Makefile.am (check_DATA): Add
7129         discard_locals_relocatable_test1.syms,
7130         discard_local_relocatable_test2.syms.
7131         (MOSTLYCLEANFILES): Likewise.  Also add
7132         discard_locals_relocatable_test1.lout and
7133         discard_locals_relocatable_test2.out.
7134         (discard_locals_relocatable_test1.syms): New target.
7135         (discard_locals_relocatable_test.o): New target.
7136         (discard_locals_relocatable_test1.out): New target.
7137         (discard_locals_relocatable_test2.syms): New target.
7138         (discard_locals_relocatable_test2.out): New target.
7139         (various): Add missing ../ld-new dependencies.
7140         * testsuite/Makefile.in: Rebuild.
7141
7142 2010-03-03  Nick Clifton  <nickc@redhat.com>
7143
7144         * po/fi.po: New Finnish translation.
7145
7146 2010-03-01  Doug Kwan  <dougkwan@google.com>
7147
7148         * layout.cc (Layout::Layout): Force section types of .init_array*,
7149         .preinit_array* and .fini_array* sections.
7150         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7151         Fix check of return value of std::string::find.().
7152         (Output_section::Input_section_sort_compare::operator()): Remove
7153         comment about .init_array.
7154         (Output_section::Input_section_sort_init_fini_compare::operator()):
7155         New method.
7156         (Output_section::sort_attached_input_sections): Handle .init_array
7157         and .fini_array specially.
7158         * output.h (Output_section::Inut_section_sort_compare): Update
7159         comment.
7160         (Output_section::Input_section_sort_init_fini_compare): New struct.
7161
7162 2010-02-26  Doug Kwan  <dougkwan@google.com>
7163
7164         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7165         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7166         * testsuite/debug_msg.sh: Avoid matching source line number for
7167         use of global variable undef_int.
7168
7169 2010-02-26  Doug Kwan  <dougkwan@google.com>
7170
7171         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7172         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7173         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7174         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7175         * options.cc (General_options::General_options): Initialize member
7176         fix_v4bx_.
7177         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7178         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7179         and rm_no_fix_v4bx.stdout
7180         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7181         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7182         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7183         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7184         and arm_no_fix_v4bx.
7185         * Makefile.in: Regenerate.
7186         * testsuite/arm_fix_v4bx.s: New file.
7187         * testsuite/arm_fix_v4bx.sh: Ditto.
7188
7189 2010-02-24  Doug Kwan  <dougkwan@google.com>
7190
7191         * arm.cc (Target_arm::got_section): Make the .got section the first
7192         non RELRO section in the data segment.
7193         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7194         suffixes of section names.
7195
7196 2010-02-24  Doug Kwan  <dougkwan@google.com>
7197
7198         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7199         flags and attributes merging if an input file is a binary file.
7200         * fileread.cc (Input_file::open): Record format of original file.
7201         * fileread.h (Input_file::Format): New enum type.
7202         (Input_file::Input_file): Initialize data member format_.
7203         (Input_file::format): New method definition.
7204         (Input_file::format_):: New data member.
7205
7206 2010-02-24  Doug Kwan  <dougkwan@google.com>
7207
7208         * arm.cc (Arm_output_data_got): New class.
7209         (ARM_TCB_SIZE): New constant
7210         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7211         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7212         If user uses a script with a SECTIONS clause, issue only a warning
7213         for a misplaced EXIDX input section.  Otherwise, issue an error.
7214         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7215         garbage collection.
7216         (Target_arm::got_mode_index_entry): Handle static linking.
7217         (Target_arm::Scan::local): Ditto.
7218         (Target_arm::Scan::global): Ditto.
7219         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7220         all incorrectly implemented relocations.
7221         (Target_arm::fix_exidx_coverage): Pass layout to
7222         Arm_output_section::fix_exidx_coverage.
7223         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7224         from ".ARM.exidx." and ".ARM.extab.".
7225
7226 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7227
7228         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7229         section if it does not already exist.
7230         * attributes.cc (Attributes_section_data::Attributes_section_data):
7231         Don't crash if size is zero.
7232
7233 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7234             Ian Lance Taylor  <iant@google.com>
7235
7236         * gold.cc (queue_middle_tasks): If no input files were opened,
7237         exit.
7238         * workqueue.h (Task_function::Task_function): Assert that there is
7239         a blocker.
7240
7241 2010-02-22  Doug Kwan  <dougkwan@google.com>
7242
7243         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7244         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7245         types to avoid warnings due to different uint64_t implementations
7246         on different hosts.
7247
7248 2010-02-21  Doug Kwan  <dougkwan@google.com>
7249
7250         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7251         handling of the maximum backward branch offset.
7252         (Arm_relocate_functions::thumb_branch_common): Ditto.
7253         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7254         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7255         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7256         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7257         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7258         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7259         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7260         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7261         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7262         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7263         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7264         thumb2_bl_out_of_range.o): New rules.
7265         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7266         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7267         thumb2_bl_out_of_range
7268         * testsuite/Makefile.in: Regenerate.
7269         * testsuite/arm_bl_in_range.s: New file.
7270         * testsuite/arm_bl_out_of_range.s: Ditto.
7271         * testsuite/arm_branch_in_range.sh: Ditto.
7272         * testsuite/arm_branch_range.t: Ditto.
7273         * testsuite/thumb2_branch_range.t: Ditto.
7274         * testsuite/thumb_bl_in_range.s: Ditto.
7275         * testsuite/thumb_bl_out_of_range.s: Ditto.
7276         * testsuite/thumb_branch_range.t: Ditto.
7277
7278 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7279
7280         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7281         Add reloc offset information.
7282         * icf.cc (get_section_contents): Change iterators to point to the new
7283         vectors. Add reloc offset information to the contents.
7284         * icf.h (Icf::Sections_reachable_info): New typedef.
7285         (Icf::Sections_reachable_list): New typedef.
7286         (Icf::Offset_info): New typedef.
7287         (Icf::Reloc_info): New struct typedef.
7288         (Icf::Reloc_info_list): New typedef.
7289         (Icf::symbol_reloc_list): Delete method.
7290         (Icf::addend_reloc_list): Delete method.
7291         (Icf::section_reloc_list): Delete method.
7292         (Icf::reloc_info_list): New method.
7293         (Icf::reloc_info_list_): New member.
7294
7295 2010-02-19  Doug Kwan  <dougkwan@google.com>
7296
7297         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7298         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7299         * arm.cc (Arm_relocation_functions): New forward declaration.
7300         (Target_arm::Target_arm): Initialize new data members
7301         got_mod_index_offset_ and tls_base_symbol_defined_.
7302         (Target_arm::Relocate::relocate_tls): New method.
7303         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7304          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7305         New methods.
7306         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7307         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7308         (Target_arm::got_mod_index_offset_,
7309         Target_arm::tls_base_symbol_defined_): New data members.
7310         (Target_arm::Scan::local, Target::Scan::global,
7311         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7312         relocations.
7313
7314 2010-02-18  Doug Kwan  <dougkwan@google.com>
7315
7316         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7317         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7318         text section as a parameter becuase some broken tools may not set
7319         the link in section header.
7320         (Target_arm::has_got_section): New method.
7321         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7322         without any mapping symbol as data only.  Remove warning.
7323         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7324         link in its section header, try to discover the link by inspecting the
7325         REL31 relocation at the beginning of the section.
7326         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7327         in error message.
7328         (Target_arm::Scan::global): Treat any reference to the symbol
7329         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7330
7331 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7332
7333         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7334         (Scan::global_reloc_may_be_function_pointer): New function.
7335         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7336         (Scan::global_reloc_may_be_function_pointer): New function.
7337         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7338         (Scan::global_reloc_may_be_function_pointer): New function.
7339         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7340         (Scan::global_reloc_may_be_function_pointer): New function.
7341         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7342         (Scan::global_reloc_may_be_function_pointer): New function.
7343         (Scan::possible_function_pointer_reloc): New function.
7344         (Target_x86_64::can_check_for_function_pointers): New function.
7345         * gc.h (gc_process_relocs): Scan relocation types to determine if
7346         function pointers were taken for targets that support it.
7347         * icf.cc (Icf::find_identical_sections): Include functions for
7348         folding in safe ICF whose pointer is not taken.
7349         * icf.h (Secn_fptr_taken_set): New typedef.
7350         (fptr_section_id_): New member.
7351         (section_has_function_pointers): New function.
7352         (set_section_has_function_pointers): New function.
7353         (check_section_for_function_pointers): New function.
7354         * options.h: Fix comment for safe ICF option.
7355         * target.h (can_check_for_function_pointers): New function.
7356         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7357         Modify icf_safe_test for X86-64.
7358         * testsuite/Makefile.in: Regenerate.
7359         * testsuite/icf_safe_so_test.cc: New file.
7360         * testsuite/icf_safe_so_test.sh: New file.
7361         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7362         (main): Change to take pointer to function kept_func_3.
7363         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7364         folding is done correctly for X86-64.
7365
7366 2010-02-12  David S. Miller  <davem@davemloft.net>
7367
7368         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7369         is_symbolless parameter.
7370         (Output_reloc<SHT_REL>::is_symbolless): New.
7371         (Output_reloc<SHT_REL>::is_symbolless_): New.
7372         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7373         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7374         (Output_reloc<SHT_RELA>::is_symbolless): New.
7375         (Output_data_reloc::add_global): Handle is_symbolless.
7376         (Output_data_reloc::add_global_relative): Likewise.
7377         (Output_data_reloc::add_local): Likewise.
7378         (Output_data_reloc::add_local_relative): Likewise.
7379         (Output_data_reloc::add_symbolless_global_addend): New.
7380         (Output_data_reloc::add_symbolless_local_addend): New.
7381         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7382         is_symbolless.
7383         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7384         instead of ->is_relative_
7385         (Output_reloc::write): Likewise.
7386         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7387         (Output_reloc::write_rel): Simplify.
7388
7389         * sparc.cc (Target_sparc::Scan::local): Use
7390         ->add_symbolless_local_addend as needed.
7391         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7392         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7393         based upon relocation offset.
7394
7395 2010-02-11  Doug Kwan  <dougkwan@google.com>
7396
7397         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7398         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7399         beginning of function.
7400         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7401         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7402         parameter is_32bit in calls to should_apply_static_reloc.
7403         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7404         (check_DATA): Add arm_abs_global.stdout.
7405         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7406         arm_abs_global.stdout): New rules.
7407         (MOSTLLYCLEANFILES): Add arm_abs_global
7408         * Makefile.in: Regenerate.
7409         * testsuite/arm_abs_global.s: New file.
7410         * testsuite/arm_abs_global.sh: Ditto.
7411         * testsuite/arm_abs_lib.s: Ditto.
7412
7413 2010-02-11  Ian Lance Taylor  <iant@google.com>
7414
7415         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7416         Read_relocs task.
7417         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7418         Allocate_commons_task first.
7419         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7420         task, rather than symtab_lock_.
7421         (Gc_process_relocs::~Gc_process_relocs): New function.
7422         (Gc_process_relocs::is_runnable): Check this_blocker_.
7423         (Gc_process_relocs::locks): Use next_blocker_ rather than
7424         blocker_.
7425         (Scan_relocs::~Scan_relocs): New function.
7426         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7427         symtab_lock_.
7428         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7429         next_blocker_.
7430         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7431         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7432         constructor accordingly.
7433         (class Gc_process_relocs): Likewise.
7434         (class Scan_relocs): Likewise.
7435         * common.h (class Allocate_commons_task): Remove symtab_lock_
7436         field, and corresponding constructor parameter.
7437         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7438         symtab_lock_.
7439         (Allocate_commons_task::locks): Likewise.
7440
7441 2010-02-11  Ian Lance Taylor  <iant@google.com>
7442
7443         * gold-threads.h (class Once): Define.
7444         (class Initialize_lock): Rewrite as child of Once.
7445         * gold-threads.cc (class Once_initialize): Define.
7446         (once_pointer_control): New static variable.
7447         (once_pointer, once_arg): New static variables.
7448         (c_run_once): New static function.
7449         (Once::Once, Once::run_once, Once::internal_run): New functions.
7450         (class Initialize_lock_once): Remove.
7451         (initialize_lock_control): Remove.
7452         (initialize_lock_pointer): Remove.
7453         (initialize_lock_once): Remove.
7454         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7455         (Initialize_lock::initialize): Rewrite.
7456         (Initialize_lock::do_run_once): New function.
7457         * archive.cc (Archive::interpret_header): Only clear name if it is
7458         not already empty.
7459         * fileread.cc: Include "gold-threads.h"
7460         (file_counts_lock): New static variable.
7461         (file_counts_initialize_lock): Likewise.
7462         (File_read::release): Only increment counts when using --stats.
7463         Use a lock around the increment.
7464         * parameters.cc (class Set_parameters_target_once): Define.
7465         (set_parameters_target_once): New static variable.
7466         (Parameters::Parameters): Move here from parameters.h.
7467         (Parameters::set_target): Rewrite.
7468         (Parameters::set_target_once): New function.
7469         (Parameters::clear_target): Move here and rewrite.
7470         * parameters.h (class Parameters): Update declarations.  Add
7471         set_parameters_target_once_ field.
7472         (Parameters::Parameters): Move to parameters.cc.
7473         (Parameters::clear_target): Likewise.
7474         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7475         task.
7476         (Start_group::~Start_group): New function.
7477         (Start_group::is_runnable): New function.
7478         (Start_group::locks, Start_group::run): New functions.
7479         (Finish_group::run): Change saw_undefined to size_t.
7480         * readsyms.h (class Start_group): Define.
7481         (class Finish_group): Change saw_undefined_ field to size_t.
7482         (Finish_group::Finish_group): Remove saw_undefined and
7483         this_blocker parameters.  Change all callers.
7484         (Finish_group::set_saw_undefined): New function.
7485         (Finish_group::set_blocker): New function.
7486         * symtab.h (class Symbol_table): Change saw_undefined to return
7487         size_t.  Change saw_undefined_ field to size_t.
7488         * target-select.cc (Set_target_once::do_run_once): New function.
7489         (Target_selector::Target_selector): Initialize set_target_once_
7490         field.  Don't initialize lock_ and initialize_lock_ fields.
7491         (Target_selector::instantiate_target): Rewrite.
7492         (Target_selector::set_target): New function.
7493         * target-select.h (class Set_target_once): Define.
7494         (class Target_selector): Update declarations.  Make
7495         Set_target_once a friend.  Remove lock_ and initialize_lock_
7496         fields.  Add set_target_once_ field.
7497
7498 2010-02-10  Ian Lance Taylor  <iant@google.com>
7499
7500         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7501         queueing any tasks.
7502         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7503         (queue_middle_tasks): Add all blockers before queueing any tasks.
7504         (queue_final_tasks): Likewise.
7505         * token.h (Task_token::add_blockers): New function.
7506         * object.h (Input_objects::number_of_relobjs): New function.
7507
7508 2010-02-10  Ian Lance Taylor  <iant@google.com>
7509
7510         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7511         shared, not if not position independent.
7512         * x86_64.cc (Relocate::relocate_tls): Likewise.
7513         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7514         (tls_pie_pic_test): New target.
7515         * testsuite/Makefile.in: Rebuild.
7516
7517         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7518         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7519         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7520         * testsuite/Makefile.in: Rebuild.
7521
7522 2010-02-09  David S. Miller  <davem@davemloft.net>
7523
7524         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7525         R_SPARC_RELATIVE using ->add_local_relative().
7526         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7527
7528         * output.h (Output_data_dynamic::add_section_size): New method
7529         that takes two Output_data objects.
7530         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7531         entry param.  Handle it in initializers.
7532         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7533         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7534         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7535         arg.
7536         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7537         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7538         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7539         for dynrel_includes_plt.
7540         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7541         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7542         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7543         before .rela.plt
7544         (Target_sparc::do_finalize_sections): Update to pass true for
7545         dynrel_includes_plt.
7546         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7547         output before .rela.plt
7548         (Target_powerpc::do_finalize_sections): Update to pass true for
7549         dynrel_includes_plt when 32-bit.
7550
7551 2010-02-08  Doug Kwan  <dougkwan@google.com>
7552
7553         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7554         method.
7555         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7556         Arm_relobj::scan_section_for_cortex_a8_stubs,
7557         Arm_relobj::do_relocation_section): Instead of calling
7558         Output_section::output_address, use faster
7559         Arm_relobj::simple_input_section_output_address.
7560
7561 2010-02-08  David S. Miller  <davem@davemloft.net>
7562
7563         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7564         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7565         relocation helper function.
7566
7567         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7568         just like R_SPARC_GOT{10,13,22}.
7569         (Target_sparc::Scan::local): Likewise.
7570         (Target_sparc::Relocate:relocate): Likewise.
7571
7572 2010-02-06  Ian Lance Taylor  <iant@google.com>
7573
7574         * configure.ac: Rewrite targetobjs duplicate removal code to use
7575         only shell constructs.
7576         * configure: Rebuild.
7577
7578 2010-02-05  Doug Kwan  <dougkwan@google.com>
7579
7580         PR 11247
7581         * arm.cc (Arm_relobj::section_is_scannable): New method.
7582         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7583         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7584
7585 2010-02-04  Doug Kwan  <dougkwan@google.com>
7586
7587         PR 11247
7588         * arm-reloc-property.cc (cstdio): Include.
7589         * configure.ac (targetobjs): Remove duplicates.
7590         * configure: Regenerate.
7591         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7592         big and little endian version for a given address size.
7593
7594 2010-02-03  Doug Kwan  <dougkwan@google.com>
7595
7596         * arm-reloc-property.cc
7597         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7598         definition.
7599         * arm-reloc-property.h
7600         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7601         New method definition.
7602         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7603         declaration.
7604         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7605         overflow to N.
7606         (GOT_PREL): Change implemented to Y.
7607         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7608         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7609         (Arm_relocate_functions::movw_abs_nc): Remove method.
7610         (Arm_relocate_functions::movt_abs): Ditto.
7611         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7612         (Arm_relocate_functions::thm_movt_abs): Ditto.
7613         (Arm_relocate_functions::movw_rel_nc): Ditto.
7614         (Arm_relocate_functions::movw_rel): Ditto.
7615         (Arm_relocate_functions::movt_rel): Ditto.
7616         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7617         (Arm_relocate_functions:thm_movw_rel): Ditto.
7618         (Arm_relocate_functions:thm_movt_rel): Ditto.
7619         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7620         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7621         New method definitions.
7622         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7623         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7624         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7625         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7626         (Target_arm::Relocate::relocate): Check for non-static or
7627         unimplemented relocation code and exit early.  Change calls to
7628         Target_arm::reloc_uses_thumb_bit and
7629         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7630         instead.  Refactor code to handle similar relocations to increase
7631         code sharing.  Remove check for unsupported relocation code in switch
7632         statement.
7633         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7634         relocation property table to find out size.  Change error message to
7635         print out the name of a relocation code instead of the numeric value.
7636         (Target_arm::scan_reloc_for_stub): Use relocation property table
7637         instead of calling Target_arm::reloc_uses_thumb_bit().
7638
7639 2010-02-02  Doug Kwan  <dougkwan@google.com>
7640
7641         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7642         types of relaxed input section.
7643
7644 2010-02-02  Doug Kwan  <dougkwan@google.com>
7645
7646         * Makefile.am (HFILES): Add arm-reloc-property.h.
7647         (DEFFILES): New.
7648         (TARGETSOURCES): Add arm-reloc-property.cc
7649         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7650         (libgold_a_SOURCES): $(DEFFILES)
7651         * Makefile.in: Regenerate.
7652         * arm-reloc-property.cc: New file.
7653         * arm-reloc-property.h: New file.
7654         * arm-reloc.def: New file.
7655         * arm.cc: Update comments.
7656         (arm-reloc-property.h): New included header.
7657         (arm_reloc_property_table): New global variable.
7658         (Target_arm::do_select_as_default_target): New method definition.
7659         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7660         arm-reloc-property to targ_extra_obj.
7661         * parameters.cc (set_parameters_target): Call
7662         Target::select_as_default_target().
7663         * target.h (Target::select_as_default_target): New method definition.
7664         (Target::do_select_as_default_target): Same.
7665
7666 2010-02-01  Doug Kwan  <dougkwan@google.com>
7667
7668         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7669         first_output_text_section_.
7670         (Arm_exidx_fixup::first_output_text_section): New method definition.
7671         (Arm_exidx_fixup::first_output_text_section_): New data member.
7672         (Arm_exidx_fixup::process_exidx_section): Record the first text
7673         output section seen.
7674         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7675         and entsize in output section header.
7676
7677 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7678
7679         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7680         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7681         (Arm_relocate_functions::thm_alu11): New Method.
7682         (Arm_relocate_functions::thm_pc8): New Method.
7683         (Arm_relocate_functions::thm_pc12): New Method.
7684         (Target_arm::Scan::local): Handle the relocations.
7685         (Target_arm::Scan::global): Likewise.
7686         (Target_arm::Relocate::relocate): Likewise.
7687         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7688
7689 2010-01-29  Doug Kwan  <dougkwan@google.com>
7690
7691         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7692         of relocation types as ld.
7693
7694 2010-01-29  Doug Kwan  <dougkwan@google.com>
7695
7696         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7697         to public.
7698         (Arm_relocate_functions::thumb_branch_common): Ditto.
7699         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7700         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7701         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7702         Arm_relocate_functions::jump24): Remove.
7703         (Target_arm::Relocate::relocate): Adjust code to call
7704         Arm_relocation_functions::arm_branch_common and
7705         Arm_relocation_functions::thumb_branch_common instead of their removed
7706         wrappers.  Merge switch-cases together to reduce source code size.
7707
7708 2010-01-29  Doug Kwan  <dougkwan@google.com>
7709
7710         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7711         output_local_symbol_count_needs_update_.
7712         (Arm_relobj::output_local_symbol_count_needs_update,
7713          Arm_relobj::set_output_local_symbol_count_needs_update,
7714          Arm_relobj::update_output_local_symbol_count): New methods.
7715         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7716         member.
7717         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7718         of pointed function as in a R_ARM_PREL31 relocation.
7719         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7720         for output local symbol count updating.
7721         (Target_arm::do_relax): Update output local symbol counts in objects
7722         if necessary.
7723         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7724
7725 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7726
7727         * arm.cc: Added support for the ARM relocations:
7728         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7729         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7730         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7731         movw_prel_nc).
7732         (Arm_relocate_functions::movw_rel): New method.
7733         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7734         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7735         thm_movw_prel_nc).
7736         (Arm_relocate_functions::thm_movw_rel): New method.
7737         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7738         thm_movt_prel).
7739         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7740         relocations.
7741         (Target_arm::Scan::global): Likewise.
7742         (Target_arm::Relocate::relocate): Likewise.
7743         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7744         Likewise.
7745
7746 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7747
7748         * arm.cc: Added support for ARM group relocations.
7749         (Target_arm::reloc_needs_sym_origin): New method.
7750         (Arm_relocate_functions::calc_grp_kn): New method.
7751         (Arm_relocate_functions::calc_grp_residual): New method.
7752         (Arm_relocate_functions::calc_grp_gn): New method.
7753         (Arm_relocate_functions::arm_grp_alu): New Method.
7754         (Arm_relocate_functions::arm_grp_ldr): New Method.
7755         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7756         (Arm_relocate_functions::arm_grp_ldc): New Method.
7757         (Target_arm::Scan::local): Handle the ARM group relocations.
7758         (Target_arm::Scan::global): Likewise.
7759         (Target_arm::Relocate::relocate): Likewise.
7760         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7761         Likewise.
7762
7763 2010-01-26  Doug Kwan  <dougkwan@google.com>
7764
7765         * arm.cc (set): Include.
7766         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7767         pointer type.
7768         (Arm_output_section::Text_section_list): New type.
7769         (Arm_output_section::append_text_sections_to_list): New method.
7770         (Arm_output_section::fix_exidx_coverage): Ditto.
7771         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7772         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7773         Relobj::set_section_offset() instead of
7774         Sized_relobj::invalidate_section_offset().
7775         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7776         parameter for section headers. Ignore relocation sections for
7777         unallocated sections and EXIDX sections.
7778         (Target_arm::fix_exidx_coverage): New method.
7779         (Target_arm::output_section_address_less_than): New type.
7780         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7781         linked text section instead of the EXIDX section.
7782         (Arm_output_section::create_stub_group): Add an assertion to check
7783         that this is not an EXIDX output section.
7784         (Arm_output_section::append_text_sections_to_list): New method.
7785         (Arm_output_section::fix_exidx_coverage): Ditto.
7786         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7787         Arm_relobj::section_needs_reloc_stub_scanning.
7788         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7789         first pass.
7790         (Target_arm::fix_exidx_coverage): New method.
7791         * object.h (Relobj::set_output_section): New method.
7792         (Sized_relobj::invalidate_section_offset): Remove method.
7793         (Sized_relobj::do_invalidate_section_offset): Remove method.
7794         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7795
7796 2010-01-25  Doug Kwan  <dougkwan@google.com>
7797
7798         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7799         Fix warning due to signed and unsigned comparison on a 32-bit host.
7800
7801 2010-01-22  Doug Kwan  <dougkwan@google.com>
7802
7803         * arm.cc (Target_arm::do_relax): Record an output section for section
7804         offset adjustment it contains any stub table that has changed.
7805         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7806         offsets in an output section if necessary.
7807         * output.cc (Output_section::Output_section): Initialize
7808         section_offsets_need_adjustments_.
7809         (Output_section::add_input_section_for_script): Renamed to
7810         Output_section::add_simple_input_section.
7811         (Output_section::save_states): Add a comment.
7812         (Output_section::discard_states): New method defintion.
7813         (Output_section::adjust_section_offsets): Same.
7814         * output.h (Output_section::add_input_section_for_script): Renamed to
7815         Output_section::add_simple_input_section.
7816         (Output_section::discard_states): New method declaration.
7817         (Output_section::adjust_section_offsets): Same.
7818         (Output_section::section_offsets_need_adjustment,
7819         Output_section::set_section_offsets_need_adjustment): New method
7820         definitions.
7821         (Output_section::section_offsets_need_adjustment_): New data member.
7822         * script-sections.cc
7823         (Output_section_element_input::set_section_address): Adjust code for
7824         renaming of Output_section::add_input_section_for_script.
7825         (Orphan_output_section::set_section_address): Same.
7826
7827 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7828
7829         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7830         Fix_v4bx enum values .
7831         * gold/options.h (General_options): New option definitions.
7832         (General_options::fix_v4bx): New method.
7833         (General_options::Fix_v4bx): New enum.
7834         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7835         (General_options::parse_fix_v4bx_interworking): New method.
7836
7837 2010-01-22  Doug Kwan  <dougkwan@google.com>
7838
7839         * arm.cc (Arm_exidx_fixup): New class.
7840
7841 2010-01-21  Doug Kwan  <dougkwan@google.com>
7842
7843         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7844         classes.
7845         (Arm_exidx_section_offset_map): New type.
7846
7847 2010-01-21  Doug Kwan  <dougkwan@google.com>
7848
7849         * arm.cc (Arm_exidx_input_section): New class.
7850         (Arm_relobj::exidx_input_section_by_link,
7851         Arm_relobj::exidx_input_section_by_shndx,
7852         Arm_relobj::make_exidx_input_section): New methods.
7853         (read_arm_attributes_section): Remove.
7854         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7855         information about them.
7856         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7857         to here.
7858
7859 2010-01-20  Doug Kwan  <dougkwan@google.com>
7860
7861         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7862         Input_section_specifier to Section_id.
7863         (Target_arm::new_arm_input_section: Adjust code for change of key
7864         type.
7865         (Target_arm::find_arm_input_section): Ditto.
7866         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7867         (Section_id): Remove.
7868         (Garbage_collection::Section_id_hash): Remove.
7869         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7870         (Section_id): Remove.
7871         (Icf::Section_id_hash): Remove.
7872         * object.h (Section_id, Const_section_id, Section_id_hash,
7873         Const_section_id_hash): New type definitions.
7874         * output.cc (Output_section::add_relaxed_input_section): Change to
7875         use Const_section_id instead of Input_section_specifier as key type.
7876         (Output_section::add_merge_input_section): Ditto.
7877         (Output_section::build_relaxation_map): Change to use Section_id
7878         instead of Input_section_specifier as key type.
7879         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7880         Ditto.
7881         (Output_section::convert_input_sections_to_relaxed_sections): Change
7882         to use Const_section_id instead of Input_section_specifier as key type.
7883         (Output_section::find_merge_section): Ditto.
7884         (Output_section::find_relaxed_input_section): Ditto.
7885         * output.h (Input_section_specifier): Remove class.
7886         (Output_section::Output_section_data_by_input_section_map): Change
7887         key type to Const_section_id.
7888         (Output_section::Output_relaxed_input_section_by_input_section_map):
7889         Ditto.
7890         (Output_section::Relaxation_map): Change key type to Section_id.
7891
7892 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7893
7894         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7895         (class Arm_v4bx_stub): New class.
7896         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7897         (Stub_factory::make_arm_v4bx_stub): New method.
7898         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7899         (Stub_table::empty): Handle v4bx stubs.
7900         (Stub_table::add_arm_v4bx_stub): New method.
7901         (Stub_table::find_arm_v4bx_stub): New method.
7902         (Arm_relocate_functions::v4bx): New method.
7903         (Target_arm::fix_v4bx): New method.
7904         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7905         (Stub_table::relocate_stubs): Likewise.
7906         (Stub_table::do_write): Likewise.
7907         (Stub_table::update_data_size_and_addralign): Likewise.
7908         (Stub_table::finalize_stubs):  Likewise.
7909         (Target_arm::Scan::local): Likewise.
7910         (Target_arm::Scan::global): Likewise.
7911         (Target_arm::do_finalize_sections): Likewise.
7912         (Target_arm::Relocate::relocate): Likewise.
7913         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7914         Likewise.
7915         (Target_arm::scan_reloc_for_stub): Likewise.
7916         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7917
7918 2010-01-19  Ian Lance Taylor  <iant@google.com>
7919
7920         * output.cc (Output_section_headers::do_sized_write): Write large
7921         segment count to sh_info field.
7922         (Output_file_header::do_sized_write): For large segment count,
7923         write PN_XNUM to e_phnum field.
7924
7925 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7926
7927         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7928         (Arm_relocate_functions::thm_jump8): New function.
7929         (Arm_relocate_functions::thm_jump11): New function.
7930         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7931         R_ARM_THM_JUMP11.
7932         (Target_arm::Scan::global): Likewise.
7933         (Target_arm::Relocate::relocate): Likewise.
7934         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7935         Likewise.
7936
7937 2010-01-14  Doug Kwan  <dougkwan@google.com>
7938
7939         * arm.cc (map, utility): Include headers.
7940         (Target_arm::apply_cortex_a8_workaround): New method.
7941         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7942         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7943         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7944         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7945         the --[no-]fix-cortex-a8 command line options.
7946         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7947         (Target_arm::relocate_stub): Use addend in instruction template.
7948         * options.h (DEFINE_bool): Set the user-set flag.
7949         (General_options): Add --[no-]-fix-cortex options.
7950         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7951         : Update fast look-up map after conversion.
7952
7953 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7954
7955         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7956         in the first pass of do_layout.
7957
7958 2010-01-13  Doug Kwan  <dougkwan@google.com>
7959
7960         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7961         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7962         apparent compiler problem of not folding static constant integral
7963         data members of elfcpp::Elf_sizes<32>.
7964
7965 2010-01-13  Doug Kwan  <dougkwan@google.com>
7966
7967         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7968         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7969         Arm_relobj::scan_section_for_cortex_a8_erratum,
7970         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7971         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7972         sections to scan for relocation stubs into a new method
7973         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7974         relocation and Cortex-A8 stub scanning.
7975         (Target_arm::do_relax): Force stubs to be after stubbed sections
7976         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7977         the beginning of a new relaxation pass.  Update a comment.
7978         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7979
7980 2010-01-12  Ian Lance Taylor  <iant@google.com>
7981
7982         * target-reloc.h (visibility_error): New inline function.
7983         (relocate_section): Call visibility_error.
7984         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7985         (MOSTLYCLEANFILES): Likewise.
7986         (protected_4_pic.o, protected_3.err): New targets.
7987         * testsuite/protected_4.cc: New file.
7988
7989 2010-01-12  Doug Kwan  <dougkwan@google.com>
7990
7991         * arm.cc (Cortex_a8_reloc): New class.
7992         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7993         and cortex_a8_relocs_info_.
7994         (Target_arm::fix_cortex_a8): New method definition.
7995         (Target_arm::Cortex_a8_relocs_info): New type.
7996         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7997         New data member declarations.
7998         (Target_arm::scan_reloc_for_stub): Record information about
7999         relocations for THUMB branches that might be exempted from the
8000         Cortex-A8 workaround.
8001         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8002         at the beginning of a relaxation pass.
8003
8004 2010-01-12  Doug Kwan  <dougkwan@google.com>
8005
8006         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8007         (Arm_relobj::Mapping_symbol_position,
8008          Arm_reloj::Mapping_symbol_position_less,
8009          Arm_relobj::Mapping_symbols_info): New types.
8010         (Target_arm::is_mapping_symbol_name): New method definition.
8011         (Arm_relobj::do_count_local_symbols): Save information about mapping
8012         symbols.
8013
8014 2010-01-11  Doug Kwan  <dougkwan@google.com>
8015
8016         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8017         Arm_relocate_functions::thumb32_branch_upper,
8018         Arm_relocate_functions::thumb32_branch_lower,
8019         Arm_relocate_functions::thumb32_cond_branch_offset,
8020         Arm_relocate_functions::thumb32_cond_branch_upper,
8021         Arm_relocate_functions::thumb32_cond_branch_lower,
8022         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8023         branch offset encoding.
8024         (Arm_relocate_functions::thumb_branch_common): Use new branch
8025         offset encoding methods to avoid code duplication.
8026         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8027         (Stub_addend_reader::operator()): Use new branch encoding method
8028         to avoid code duplication.
8029
8030 2010-01-11  Doug Kwan  <dougkwan@google.com>
8031
8032         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8033         (Target_arm::do_finalize_sections): Define special EXIDX section
8034         symbols only if referenced.
8035         * gc.h (Garbage_collection::add_reference): New method.
8036         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8037         code duplication.
8038
8039 2010-01-11  Ian Lance Taylor  <iant@google.com>
8040
8041         * script.cc (Version_script_info::build_expression_list_lookup):
8042         Change complaing about duplicate wildcard match from error to
8043         warning.
8044
8045         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8046         of 2009-12-30.
8047         (Version_script_info::Version_script_info): Initialize globs_,
8048         default_version_, default_is_global_, and exact_.  Don't
8049         initialize globals_ or locals_.
8050         (Version_script_info::build_lookup_tables): Build local symbols
8051         first.
8052         (Version_script_info::unquote): New function.
8053         (Version_script_info::add_exact_match): New function.
8054         (Version_script_info::build_expression_list_lookup): Remove lookup
8055         parameter.  Add is_global parameter.  Change all callers.  Handle
8056         wildcard pattern specially.  Unquote pattern.  Call
8057         add_exact_match.
8058         (Version_script_info::get_name_to_match): New function.
8059         (Version_script_info::get_symbol_version): New function.
8060         (Version_script_info::get_symbol_version_helper): Remove.
8061         (Version_script_info::check_unmatched_names): Call unquote.
8062         * script.h (class Version_script_info): Change get_symbol_version
8063         to be non-inline and add is_global parameter; change all callers.
8064         Rewrite symbol_is_local.  Update declarations.  Define struct
8065         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8066         Remove globals_ and locals_ members.  Add exact_, globs_,
8067         default_version_, is_global_.
8068         (Version_script_info::Glob): Remove pattern, add expression and
8069         is_global.  Update constructor.  Change all callers.
8070         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8071         default version.
8072         (Versions::symbol_section_contents): If a symbol is undefined, or
8073         defined in a dynamic object, set the version index to
8074         VER_NDX_LOCAL.
8075         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8076         symbol_is_local.
8077         (Symbol_table::add_from_pluginobj): Likewise.
8078         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8079
8080 2010-01-11  Doug Kwan  <dougkwan@google.com>
8081
8082         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8083         (incremental_dump_LDADD): Add linking option for libintl.
8084         * Makefile.in: Regenerate.
8085
8086 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8087
8088         PR gold/11144
8089         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8090         instead of -Ds.
8091         * testsuite/Makefile.in: Regenerated.
8092
8093 2010-01-10  Doug Kwan  <dougkwan@google.com>
8094
8095         * options.h (DEFINE_var): Use parentheses around argument varname__
8096         in macro body to avoid any unintended subsequent substitutions.
8097
8098 2010-01-10  Ian Lance Taylor  <iant@google.com>
8099
8100         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8101         candidates before doing symbol resolution.
8102
8103         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8104         ODR candidates if only one is weak.
8105
8106 2010-01-08  Ian Lance Taylor  <iant@google.com>
8107
8108         * script.cc (Version_script_info::build_expression_list_lookup):
8109         Don't warn about ambiguous version, just record the ambiguity.
8110         (Version_script_info::get_symbol_version_helper): Give error if
8111         version is ambiguous.
8112
8113 2010-01-08  Doug Kwan  <dougkwan@google.com>
8114
8115         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8116         prev_data_size_ and prev_addralign_.  Remove initializer for
8117         deleted data member has_been_changed_.
8118         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8119         to determine if the table is empty.
8120         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8121         Remove.
8122         (Stub_table::add_reloc_stub): Define method in class definition
8123         instead of just declaring it there.
8124         (Stub_table::add_cortex_a8_stub): New method definition.
8125         (Stub_table::update_data_size_and_addralign): Ditto.
8126         (Stub_table::finalize_stubs): Ditto.
8127         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8128         (Stub_table::do_addralign_): Return address alignment in the
8129         (Stub_table::do_reset_address_and_file_offset): Define method in
8130         class definition instead of declaring it there.  Set current data
8131         size to be the data size of the previous pass.
8132         (Stub_table::set_final_data_size): Use current data size as the
8133         final data size.
8134         (Stub_table::relocate_stub): Change parameter type of stub from
8135         Reloc_stub pointer to Stub pointer.
8136         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8137         (Stub_table::Cortex_a8_stub_list): New typedef.
8138         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8139          Stub_table::prev_addralign_): New data member.
8140         (Arm_relobj::Arm_relobj): Initialize data member
8141         section_has_cortex_a8_workaround_.
8142         (Arm_relobj::section_has_cortex_a8_workaround,
8143          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8144          definitions.
8145         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8146         declarations.
8147         (Target_arm::relocate_stub): Change parameter type of stub from
8148         Reloc_stub pointer to Stub pointer.
8149         (Insn_template::size, Insn_template::alignment): Handle
8150         THUMB16_SPECIAL_TYPE.
8151         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8152          Stub_table::update_data_size_and_addralign,
8153          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8154         definitions.
8155         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8156         (Stub_table::do_write): Ditto.
8157         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8158
8159 2010-01-08  Ian Lance Taylor  <iant@google.com>
8160
8161         PR 11108
8162         * symtab.h (class Symbol): Remove fields is_target_special_ and
8163         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8164         (Symbol::is_defined_in_discarded_section): New function.
8165         (Symbol::set_is_defined_in_discarded_section): New function.
8166         (Symbol::has_plt_offset): Rewrite.
8167         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8168         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8169         Don't initialize is_target_special_ or has_plt_offset_.
8170         Initialize is_defined_in_discarded_section_.
8171         (Symbol_table::add_from_relobj): If appropriate, set
8172         is_defined_in_discarded_section.
8173         * resolve.cc (Symbol::override_base_with_special): Don't test
8174         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8175         * target-reloc.h (relocate_section): Do special handling for
8176         symbols defined in discarded sections for global symbols as well
8177         as local symbols.
8178
8179 2010-01-08  Ian Lance Taylor  <iant@google.com>
8180
8181         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8182         the SHT_SYMTAB case.
8183
8184 2010-01-08  Ian Lance Taylor  <iant@google.com>
8185
8186         * object.cc (Sized_relobj::do_layout): Don't get confused if
8187         layout_eh_frame returns NULL.
8188
8189 2010-01-08  Ian Lance Taylor  <iant@google.com>
8190
8191         PR 11084
8192         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8193         dynamic symbol table, use the normal symbol table.
8194         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8195         symbol table.
8196
8197 2010-01-08  Ian Lance Taylor  <iant@google.com>
8198
8199         PR 11072
8200         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8201         sections.
8202
8203 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8204
8205         * version.cc (print_version): Change to "Copyright 2010".
8206
8207 2010-01-08  Ian Lance Taylor  <iant@google.com>
8208
8209         PR 10287
8210         PR 11063
8211         * i386.cc (class Target_i386): Change return type of plt_section
8212         to be non-const.
8213         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8214         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8215         tls_desc_rel_ field.
8216         (Output_data_plt_i386::rel_tls_desc): New function.
8217         (Target_i386::rel_tls_desc_section): New function.
8218         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8219         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8220         R_386_TLS_DESC reloc in rel_tls_desc_section.
8221         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8222         Define struct Tlsdesc_info.
8223         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8224         (Target_x86_64::do_reloc_symbol_index): New function.
8225         (Target_x86_64::add_tlsdesc_info): New function.
8226         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8227         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8228         tlsdesc_rel_ field.
8229         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8230         all callers.
8231         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8232         (Target_x86_64::rela_tlsdesc_section): New function.
8233         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8234         handling.
8235         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8236         (Target_x86_64::do_reloc_addend): New function.
8237         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8238         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8239         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8240         (Output_reloc::type): New function.
8241         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8242         (Output_reloc::is_target_specific): New function.
8243         (Output_reloc::target_arg): New function.
8244         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8245         absolute relocs and target specific relocs.
8246         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8247         add_target_specific.
8248         (class Output_data_reloc) [SHT_RELA]: Likewise.
8249         * output.cc (Output_reloc::Output_reloc): Add four new versions
8250         for absolute relocs and target specific relocs.
8251         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8252         (Output_reloc::get_symbol_index): Likewise.
8253         (Output_reloc::local_section_offset): Check that local_sym_index_
8254         is not TARGET_CODE or 0.
8255         (Output_reloc::symbol_value): Likewise.
8256         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8257         reloc.
8258         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8259         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8260         functions.
8261         * layout.cc (add_target_dynamic_tags): Use output section for
8262         DT_PLTRELSZ and DT_JMPREL.
8263
8264 2010-01-07  Ian Lance Taylor  <iant@google.com>
8265
8266         PR 11061
8267         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8268         function.
8269         (class Output_data_reloc_generic): Define.
8270         (class Output_data_reloc_base): Change base class to
8271         Output_data_reloc_generic.  Change add() method to call
8272         bump_relative_reloc_count for a relative reloc.  Remove
8273         sort_relocs_ field.
8274         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8275         to sort_relocs().
8276         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8277         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8278         appropriate.
8279         * layout.h (class Layout): Update declaration.
8280
8281 2010-01-07  Ian Lance Taylor  <iant@google.com>
8282
8283         * output.h (class Output_data): Add const version of
8284         output_section and do_output_section.
8285         (class Output_section_data): Add const version of
8286         do_output_section.
8287         (class Output_section): Likewise.
8288         * layout.cc (Layout::add_target_dynamic_tags): New function.
8289         * layout.h (class Layout): Update declarations.
8290         * arm.cc (Target_arm::do_finalize_sections): Use
8291         add_target_dynamic_tags.
8292         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8293         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8294         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8295         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8296
8297 2010-01-07  Ian Lance Taylor  <iant@google.com>
8298
8299         PR 11042
8300         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8301         object as needed.
8302
8303 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8304             Ian Lance Taylor  <iant@google.com>
8305
8306         PR 11019
8307         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8308         Xindex::read_symtab_xindex.
8309
8310 2010-01-07  Doug Kwan  <dougkwan@google.com>
8311
8312         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8313         (Insn_template::thumb16_bcond_insn): New method declaration.
8314         (Insn_template): Fix spelling.
8315         (Stub::thumb16_special): New method declaration.
8316         (Stub::do_write): Define virtual method which was previously pure
8317         virtual.
8318         (Stub::do_thumb16_special): New method declaration.
8319         (Stub::do_fixed_endian_write): New template member.
8320         (Reloc_stub::do_write): Remove.
8321         (Reloc_stub::do_fixed_endian_write): Remove.
8322         (Cortex_a8_stub): New class definition.
8323         (Stub_factory::make_cortex_a8_stub): New method definition.
8324         (Stub_factory::Stub_factory): Add missing static storage class
8325         qualifier for elf32_arm_stub_a8_veneer_blx.
8326
8327 2010-01-07  Ian Lance Taylor  <iant@google.com>
8328
8329         PR 10980
8330         * options.h (class General_options): Add --warn-unresolved-symbols
8331         and --error-unresolved-symbols.
8332         * errors.cc (Errors::undefined_symbol): Implement
8333         --warn-unresolved-symbols.
8334
8335         * options.h (class General_options): Add -z text and -z textoff.
8336         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8337
8338 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8339
8340         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8341         (Garbage_collection::cident_sections): New function.
8342         (Garbage_collection::add_cident_section): New function.
8343         (Garbage_collection::cident_sections_): New member.
8344         (gc_process_relocs): Add references to sections whose names are C
8345         identifiers.
8346         * gold.h (cident_section_start_prefix): New constant.
8347         (cident_section_stop_prefix): New constant.
8348         (is_cident): New function.
8349         * layout.cc (Layout::define_section_symbols): Replace string constants
8350         with the newly defined constants.
8351         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8352         C identifiers.
8353         * testsuite/Makefile.am: Add gc_orphan_section_test.
8354         * testsuite/Makefile.in: Regenerate.
8355         * testsuite/gc_orphan_section_test.cc: New file.
8356         * testsuite/gc_orphan_section_test.sh: New file.
8357
8358 2010-01-06  Ian Lance Taylor  <iant@google.com>
8359
8360         PR 10980
8361         * options.h (class General_options): Add --warn-shared-textrel.
8362         * layout.cc (Layout::finish_dynamic_section): Implement
8363         --warn-shared-textrel.
8364
8365         PR 10980
8366         * options.h (class General_options): Add --warn-multiple-gp.
8367
8368 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8369
8370         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8371         $(THREADSLIB) and $(LIBDL).
8372         * Makefile.in: Rebuild.
8373
8374 2010-01-06  Ian Lance Taylor  <iant@google.com>
8375
8376         PR 10980
8377         * options.cc (General_options::parse_section_start): New function.
8378         (General_options::section_start): New function.
8379         (General_options::General_options): Initialize all members.
8380         * options.h: Include <map>
8381         (class General_options): Add --section-start.  Add section_starts_
8382         member.
8383         * layout.cc (Layout::attach_allocated_section_to_segment): If
8384         --section-start was used, set the address of the segment.  Remove
8385         local sort_sections.
8386         (Layout::relaxation_loop_body): If the address of the load segment
8387         has been set by --section-start, don't use it.
8388         * output.h (Output_segment::update_flags_for_output_section): New
8389         function.
8390         * output.cc (Output_segment::add_output_section): Call
8391         update_flags_for_output_section.
8392
8393 2010-01-05  Ian Lance Taylor  <iant@google.com>
8394
8395         PR 10980
8396         * options.h (class General_options): Add --undefined-version.
8397         * script.cc (struct Version_expression): Add was_matched_by_symbol
8398         field.
8399         (Version_script_info::matched_symbol): New function.
8400         (Version_script_info::get_symbol_version_helper): Call
8401         matched_symbol.
8402         (Version_script_info::check_unmatched_names): New function.
8403         * script.h (class Version_script_info): Update declarations.
8404         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8405
8406         * options.h (class General_options): Use DEFINE_bool_alias for
8407         allow_multiple_definition.
8408         * resolve.cc (Symbol_table::should_override): Don't test
8409         allow_multiple_definition.
8410
8411         PR 10980
8412         * options.h (class General_options): Add --cref.
8413         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8414         until after printing cref table.
8415         * cref.cc: Include "symtab.h".
8416         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8417         (Cref_table_compare::operator()): New function.
8418         (Cref_inputs::gather_cref): New function.
8419         (filecol): New static const.
8420         (Cref_inputs::print_cref): New function.
8421         (Cref::print_cref): New function.
8422         * cref.h: Include <cstdio>.
8423         (class Cref): Update declarations.
8424         * mapfile.h (Mapfile::file): New function.
8425         * object.h (class Object): Define Symbols.  Declare virtual
8426         do_get_global_symbols.
8427         (Object::get_global_symbols): New function.
8428         * object.cc (Input_objects::add_object): Pass object to cref_ if
8429         --cref.
8430         (Input_objects::archive_start): Likewise.
8431         (Input_objects::archive_stop): Likewise.
8432         (Input_objects::print_cref): New function.
8433         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8434         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8435         --cref.
8436         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8437         function.
8438         * plugin.h (class Sized_pluginobj): Update declarations.
8439
8440 2010-01-05  Ian Lance Taylor  <iant@google.com>
8441
8442         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8443         to is_default_version.  Rename insdef to insdefault.
8444         (Symbol_table::add_from_relobj): Rename def to is_default_version
8445         and local to is_forced_local.
8446         (Symbol_table::add_from_pluginobj): Likewise.
8447         (Symbol_table::add_from_dynobj): Likewise.
8448         (Symbol_table::define_special_symbol): Rename insdef to
8449         insdefault.
8450
8451 2010-01-04  Ian Lance Taylor  <iant@google.com>
8452
8453         PR 10980
8454         * options.h (class General_options): Add
8455         --allow-multiple-definition and -z muldefs.
8456         * resolve.cc (Symbol_table::should_override): Don't warn about a
8457         multiple symbol definition if --allow-multiple-definition or -z
8458         muldefs.
8459
8460         PR 10980
8461         * options.h (class General_options): Add --add-needed and
8462         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8463         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8464         error if --copy-dt-needed-entries aka --add-needed is used and
8465         would cause a change in behaviour.
8466
8467         PR 10980
8468         * options.h (class General_options): Add -G as a short version of
8469         --shared.  Add no-op options -assert, -g, and -i.
8470
8471 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8472
8473         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8474         check for .text or .gnu.linkonce.t sections.
8475         * icf.cc (Icf::find_identical_sections): Ditto.
8476         Change the detection for mangled function name within the section
8477         name.
8478         * icf.h (is_section_foldable_candidate): New function.
8479
8480 2009-12-30  Ian Lance Taylor  <iant@google.com>
8481
8482         PR 10980
8483         * options.h (class General_options): Permit two dashes with
8484         --retain-symbols-file.
8485
8486 2009-12-30  Ian Lance Taylor  <iant@google.com>
8487
8488         PR 10979
8489         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8490         don't put the file header and segment headers in the text
8491         segment.
8492
8493         PR 10979
8494         * common.cc (Sort_commons::operator()): Stabilize sort when both
8495         entries are NULL.
8496         (Symbol_table::do_allocate_commons_list): When allocating common
8497         symbols, skip a symbol which is no longer common.
8498         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8499         an object before checking its type.
8500         * testsuite/common_test_2.c: New file.
8501         * testsuite/common_test_3.c: New file.
8502         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8503         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8504         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8505         (common_test_2_pic.o, common_test_2.so): New targets.
8506         (common_test_3_pic.o, common_test_3.so): New targets.
8507         * testsuite/Makefile.in: Rebuild.
8508
8509         PR 10979
8510         * script.cc (read_input_script): If we see a new SECTIONS clause,
8511         and we have added an input section, give an error.
8512         * layout.h (class Layout): Add have_added_input_section function.
8513         Add have_added_input_section_ field.
8514         * layout.cc (Layout::Layout): Initialize
8515         have_added_input_section_.
8516         (Layout::layout): Set have_added_input_section_.
8517         (Layout::layout_eh_frame): Likewise.
8518
8519 2009-12-30  Ian Lance Taylor  <iant@google.com>
8520
8521         PR 10931
8522         * options.h (class General_options): Add --sort-common option.
8523         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8524         * common.cc (Sort_common): Add sort_order parameter to
8525         constructor.  Add sort_order_ field.
8526         (Sort_commons::operator): Check sort_order_.
8527         (Symbol_table::allocate_commons): Determine the sort order.
8528         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8529         Change all callers.
8530         (Symbol_table::do_allocate_commons_list): Likewise.
8531
8532 2009-12-30  Ian Lance Taylor  <iant@google.com>
8533
8534         PR 10916
8535         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8536         symbols from this object, don't change the visibility of an
8537         undefined symbol.
8538         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8539
8540 2009-12-30  Ian Lance Taylor  <iant@google.com>
8541
8542         PR 10861
8543         * script.h (class Version_script_info): Define Language enum.
8544         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8545         new fields globals_, locals_, and is_finalized_.
8546         * script.cc: Various formatting fixes.
8547         (class Parser_closure): Change language_stack_ from a vector of
8548         std::string to one of Version_script_info::Language.  Adjust all
8549         uses accordingly.
8550         (class Lazy_demangler): Remove.
8551         (struct Version_expression): Change language from std::string to
8552         Version_script_info::Language.
8553         (Version_script_info::Version_script_info): New function.
8554         (Version_script_info::~Version_script_info): Don't call clear.
8555         (Version_script_info::finalize): New function.
8556         (Version_script_info::build_lookup_tables): New function.
8557         (Version_script_info::build_expression_list_lookup): New
8558         function.
8559         (Version_script_info::get_symbol_version_helper): Rewrite to use
8560         lookup tables.
8561         (Version_script_info::print_expression_list): Adjust to use
8562         Version_script_info::Language.
8563         (script_push_lex_into_version_mode): Check that the version script
8564         has not been finalized.
8565         (version_script_push_lang): Change language string to
8566         Version_script_info::Language.
8567         * options.cc (Command_line::version_script): New function.
8568         * options.h (class General_options): Add finalize_dynamic_list
8569         function.  Change version_script from declaration to definition.
8570         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8571         * testsuite/version_script.map: Remove duplicate def of foo.
8572         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8573         version_script.map.
8574         * testsuite/Makefile.in: Rebuild.
8575
8576 2009-12-30  Ian Lance Taylor  <iant@google.com>
8577
8578         PR 10843
8579         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8580         if the input symbol index is 0, make the output symbol index 0.
8581
8582 2009-12-30  Ian Lance Taylor  <iant@google.com>
8583
8584         PR 10670
8585         * options.h (class General_options): Add -x/--discard-all.
8586         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8587         --discard-all.  If the local symbol needs a dynamic entry, check
8588         that before handling --discard-locals.
8589
8590 2009-12-30  Ian Lance Taylor  <iant@google.com>
8591
8592         PR 10450
8593         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8594         flags to PF_R.
8595         (Output_segment::add_output_section): Don't change the flags if
8596         the type is PT_TLS.
8597
8598         PR 10450
8599         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8600         GNU hash table if they need a dynamic value.  Otherwise, don't add
8601         them if they are defined in a dynamic object or are forced local.
8602
8603 2009-12-29  Ian Lance Taylor  <iant@google.com>
8604
8605         PR 10450
8606         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8607         .gnu.hash table for a 32-bit target.
8608
8609         PR 10450
8610         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8611         regular and a dynamic object only needs a dynamic symbol table
8612         entry if it is externally visible.
8613
8614         PR 10450
8615         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8616         constructor.  Add global_offset_table_ field.
8617         (Target_i386::got_section): Set global_offset_table_.
8618         (Target_i386::do_finalize_sections): Set global_offset_table_
8619         size.
8620         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8621         in constructor.  Add global_offset_table_ field.
8622         (Target_x86_64::got_section): Set global_offset_table_.
8623         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8624         size.
8625
8626         * layout.cc (Layout::Layout): Initialize increase_relro_.
8627         (Layout::get_output_section): Add is_relro, is_last_relro, and
8628         is_first_non_relro parameters.  Change all callers.
8629         (Layout::choose_output_section): Likewise.
8630         (Layout::add_output_section_data): Likewise.
8631         (Layout::make_output_section): Likewise.
8632         (Layout::set_segment_offsets): Clear increase_relro when using a
8633         linker script.
8634         * layout.h (class Layout): Add increase_relro method.  Add
8635         increase_relro_ field.  Update declarations.
8636         * output.cc (Output_section::Output_section): Initialize
8637         is_last_relro_ and is_first_non_relro_.
8638         (Output_segment::add_output_section): Group relro sections is
8639         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8640         (Output_segment::maximum_alignment): Remove relro handling.
8641         (Output_segment::set_section_addresses): Add increase_relro
8642         parameter.  Change all callers.  Add initial alignment to align
8643         relro sections on separate page.  Remove old relro handling.
8644         (Output_segment::set_section_list_addresses): Remove in_relro
8645         parameter.  Change all callers.
8646         (Output_segment::set_offset): Add increase parameter.  Change all
8647         callers.  Remove old relro handling.
8648         * output.h (class Output_section): Add new methods: is_last_relro,
8649         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8650         Add is_last_relro_ and is_first_non_relro_ fields.
8651         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8652         Create separate .got.plt section.  Call increase_relro.
8653         * x86_64.cc (Target_x86_64::got_section): Likewise.
8654         * testsuite/relro_script_test.t: Add .got.plt.
8655
8656         PR 10450
8657         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8658         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8659         (Layout::finalize): Call set_dynamic_symbol_size.
8660         (Layout::set_dynamic_symbol_size): New function.
8661         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8662         set_dynamic_symbol_size.
8663
8664         PR 10450
8665         * output.h (class Output_section): Add is_entsize_zero_ field.
8666         * output.cc (Output_section::Output_section): Initialize
8667         is_entsize_zero_.
8668         (Output_section::set_entsize): If two different entsizes are
8669         requested, force it to zero.
8670         (Output_section::add_input_section): Set flags for .debug_str
8671         before updating section flags.  Set entsize.
8672         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8673         and SHF_STRING if all input sections have those flags.
8674
8675 2009-12-29   Rafael Espindola  <espindola@google.com>
8676
8677         * main.cc (main): Fix the sys time reporting.
8678         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8679         reporting.
8680
8681 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8682
8683         * options.cc (General_options::parse_version): Allow -v to exit
8684         without an error if there is nothing to link.
8685
8686 2009-12-29  Ian Lance Taylor  <iant@google.com>
8687
8688         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8689         using a version of gcc before 4.1.
8690         * configure: Rebuild.
8691
8692 2009-12-28  Chris Demetriou  <cgd@google.com>
8693
8694         * attributes.cc (Output_attributes_section_data::do_write): Use
8695         std::vector::front rather than std::vector::data.
8696
8697 2009-12-28  Ian Lance Taylor  <iant@google.com>
8698
8699         * symtab.h (class Symbol_table): Add enum Defined.
8700         * resolve.cc (Symbol_table::should_override): Add defined
8701         parameter.  Change all callers.  Test whether object is NULL
8702         before calling a method on it.
8703         (Symbol_table::report_resolve_problem): Add defined parameter.
8704         Change all callers.
8705         (Symbol_table::should_override_with_special): Likewise.
8706         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8707         parameter.  Change all callers.
8708         (Symbol_table::do_define_in_output_data): Likewise.
8709         (Symbol_table::define_in_output_segment): Likewise.
8710         (Symbol_table::do_define_in_output_segment): Likewise.
8711         (Symbol_table::define_as_constant): Likewise.
8712         (Symbol_table::do_define_as_constant): Likewise.
8713         * script.h (class Symbol_assignment): Add is_defsym parameter to
8714         constructor; change all callers.
8715         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8716         parameter.  Change all callers.  Add is_defsym_ field.
8717         (class Parser_closure): Add parsing_defsym parameter to
8718         constructor; change all callers.  Add parsing_defsym accessor
8719         function.  Add parsing_defsym_ field.
8720
8721 2009-12-28  Ian Lance Taylor  <iant@google.com>
8722
8723         * gold.cc (queue_middle_tasks): Fix formatting.
8724         * object.cc (Relobj::is_section_name_included): Likewise.
8725
8726 2009-12-23  Ian Lance Taylor  <iant@google.com>
8727
8728         * i386.cc (Target_i386::do_calls_non_split): Recognize
8729         -fsplit-stack prologue for a function with a static chain.
8730         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8731         -fsplit-stack prologue when using %r11.
8732
8733 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8734
8735         * options.cc (General_options::parse_version): Make -v continue and do
8736         the link like GNU ld does.
8737
8738 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8739
8740         * Makefile.am (CCFILES): Add timer.cc.
8741         (HFILES): Add timer.h.
8742         * configure.ac: Check for sysconf and times.
8743         * main.cc: include timer.h.
8744         (main): Use Timer instead of get_run_time.
8745         * timer.cc: New.
8746         * timer.h: New.
8747         * workqueue.cc: include timer.h.
8748         (Workqueue::find_and_run_task):
8749         Report user, sys and wall time.
8750         * Makefile.in: Regenerate.
8751         * config.in: Regenerate.
8752         * configure: Regenerate.
8753
8754 2009-12-16  Doug Kwan  <dougkwan@google.com>
8755
8756         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8757         sections.
8758         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8759         relaxed input sections.
8760         * output.cc (Output_section::find_relaxed_input_section): Change
8761         return type to Output_relaxed_input_section pointer.  Adjust code
8762         for new type of relaxed_input_section_map_.
8763         * output.h (Output_section::find_relaxed_input_section): Change
8764         return type to Output_relaxed_input_section pointer.
8765         (Output_section::Output_relaxed_input_section_by_input_section_map):
8766         New type.
8767         (Output_section::relaxed_input_section_map_): Change type to
8768         Output_section::Output_relaxed_input_section_by_input_section_map.
8769         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8770         input section.
8771
8772 2009-12-15  Ian Lance Taylor  <iant@google.com>
8773
8774         * layout.cc (Layout::create_shstrtab): Only write out after input
8775         sections if we are compressing debug sections.
8776
8777 2009-12-15  Ian Lance Taylor  <iant@google.com>
8778
8779         * archive.cc (Archive::add_symbols): Only look up a symbol without
8780         a version if there is, in fact, a version.
8781
8782 2009-12-14  Ian Lance Taylor  <iant@google.com>
8783
8784         Revert -Wshadow changes, all changes from:
8785         2009-12-11  Doug Kwan  <dougkwan@google.com>
8786         2009-12-11  Nick Clifton  <nickc@redhat.com>
8787         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8788
8789 2009-12-11  Doug Kwan  <dougkwan@google.com>
8790
8791         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8792         due to -Wshadow.
8793         * attributes.cc (Object_attribute::size): Ditto.
8794         (Attributes_section_data::size): Ditto.
8795         (Attributes_section_data::Attributes_section_data): Ditto.
8796         (Output_attributes_section_data::do_write): Ditto.
8797         * attributes.h (Object_attribute::set_type): Ditto.
8798         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8799
8800 2009-12-11  Nick Clifton  <nickc@redhat.com>
8801
8802         * archive.cc: Fix shadowed variable warnings.
8803         * arm.cc: Likewise.
8804         * compressed_output.cc: Likewise.
8805         * compressed_output.h: Likewise.
8806         * configure: Likewise.
8807         * dwarf_reader.cc: Likewise.
8808         * dynobj.cc: Likewise.
8809         * dynobj.h: Likewise.
8810         * ehframe.cc: Likewise.
8811         * ehframe.h: Likewise.
8812         * errors.cc: Likewise.
8813         * expression.cc: Likewise.
8814         * fileread.cc: Likewise.
8815         * fileread.h: Likewise.
8816         * freebsd.h: Likewise.
8817         * i386.cc: Likewise.
8818         * icf.cc: Likewise.
8819         * incremental.h: Likewise.
8820         * layout.cc: Likewise.
8821         * layout.h: Likewise.
8822         * mapfile.cc: Likewise.
8823         * merge.cc: Likewise.
8824         * merge.h: Likewise.
8825         * object.cc: Likewise.
8826         * object.h: Likewise.
8827         * options.h: Likewise.
8828         * output.cc: Likewise.
8829         * output.h: Likewise.
8830         * parameters.cc: Likewise.
8831         * plugin.cc: Likewise.
8832         * powerpc.cc: Likewise.
8833         * reduced_debug_output.cc: Likewise.
8834         * reduced_debug_output.h: Likewise.
8835         * reloc.cc: Likewise.
8836         * reloc.h: Likewise.
8837         * resolve.cc: Likewise.
8838         * script-sections.cc: Likewise.
8839         * script.cc: Likewise.
8840         * script.h: Likewise.
8841         * sparc.cc: Likewise.
8842         * symtab.cc: Likewise.
8843         * symtab.h: Likewise.
8844         * target-select.cc: Likewise.
8845         * target-select.h: Likewise.
8846         * token.h: Likewise.
8847         * workqueue.cc: Likewise.
8848         * workqueue.h: Likewise.
8849         * x86_64.cc: Likewise.
8850
8851 2009-12-10  Doug Kwan  <dougkwan@google.com>
8852
8853         * arm.cc (attributes.h): New include.
8854         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8855         (Arm_relobj::~Arm_relobj): Delete object pointed by
8856         attributes_section_data_.
8857         (Arm_relobj::attributes_section_data): New method definition.
8858         (Arm_relobj::attributes_section_data_): New data member declaration.
8859         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8860         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8861         attributes_section_data_.
8862         (Arm_dynobj::attributes_section_data): New method definition.
8863         (Arm_dynobj::attributes_section_data_): New data member declaration.
8864         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8865         initialization value of may_use_blx_ to false.
8866         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8867         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8868         object attributes to compute results instead of hard-coding.
8869         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8870         Target_arm::get_secondary_compatible_arch,
8871         Target_arm::set_secondary_compatible_arch
8872         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8873         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8874         New method declarations.
8875         (Target_arm::get_aeabi_object_attribute): New method definition.
8876         (Target_arm::attributes_section_data_): New data member declaration.
8877         (read_arm_attributes_section): New template definition.
8878         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8879         (Arm_dynobj::do_read_symbols): Ditto.
8880         (Target_arm::do_finalize_sections): Merge attributes sections from
8881         input.  Check for BLX use after attributes section merging.
8882         Fix __exidx_start and __exidx_end visibility.  Create an
8883         .ARM.attributes section if necessary.
8884         (Target_arm::get_secondary_compatible_arch,
8885         Target_arm::set_secondary_compatible_arch,
8886         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8887         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8888         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8889         New method definitions.
8890
8891 2009-12-09  Ian Lance Taylor  <iant@google.com>
8892
8893         * plugin.cc (Plugin::load): Don't cast from void* to a function
8894         pointer.
8895
8896 2009-12-09  Ian Lance Taylor  <iant@google.com>
8897
8898         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8899         information fields.
8900
8901 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8902
8903         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8904         Replace two_file_shared_1.so with two_file_shared_2.so.
8905         * testsuite/Makefile.in: Regenerated.
8906
8907 2009-12-08  Doug Kwan  <dougkwan@google.com>
8908
8909         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8910         (HFILES): Add attributes.h and int_encoding.h.
8911         * Makefile.in: Regenerate.
8912         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8913         function definitions to int_encoding.cc
8914         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8915         prototypes to int_encoding.h
8916         * reduced_debug_output.cc (int_encoding.h): New include.
8917         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8918         function definitions to int_encoding.cc
8919         (insert_into_vector, read_from_pointer): Move template definitions to
8920         int_encoding.h
8921         * attributes.cc: New file.
8922         * attributes.h: New file.
8923         * int_encoding.cc: New file.
8924         * int_encoding.h: New file.
8925
8926 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8927
8928         PR gold/11055
8929         * incremental-dump.cc (dump_incremental_inputs): New.
8930         (main): Use dump_incremental_inputs.
8931
8932 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8933
8934         PR gold/10893
8935         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8936         checking elfcpp::STT_FUNC.
8937         (Target_i386::Relocate::relocate): Likewise.
8938         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8939
8940         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8941         symbols from shared libraries into normal FUNC symbols.
8942
8943         * symtab.h (Symbol): Add is_func and use it.
8944
8945 2009-12-05  Doug Kwan  <dougkwan@google.com>
8946
8947         * arm.cc (Target_arm::arm_info): Initialize new fields
8948         attributes_section and attributes_vendor.
8949         * i386.cc (Target_i386::i386_info): Same.
8950         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8951         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8952         fields attributes_section and attributes_vendor.
8953         * sparc.cc (Target_sparc::sparc_info): Same.
8954         * target.h (Target::attributes_section, Target::attributes_vendor,
8955         Target::is_attributes_section, Target::attribute_arg_type,
8956         Target::attributes_order): New method definitions.
8957         (Target::Target_info::attributes_section,
8958         Target::Target_info::attributes_vendor): New fields.
8959         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8960         virtual method definitions.
8961         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8962         attributes_section and attributes_vendor.
8963         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8964
8965 2009-12-05  Doug Kwan  <dougkwan@google.com>
8966
8967         * arm.cc: Update comments about interworking and stub generation.
8968         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8969         considered as non-PIC.
8970         (Arm_relocate_functions::base_abs): Fix formatting.
8971         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8972         of function to use GOT entry address instead of offset.
8973         (Target_arm::Scan::global): Issue an error if a symbol would need a
8974         PLT does not get one because it is untyped.  Remove code to create
8975         dynamic symbols for relative branches.
8976         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8977         takes unsigned integer instead of boolean.
8978
8979 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8980
8981         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8982         (two_file_test_LDADD): Likewise.
8983         (common_test_1_LDADD): Likewise.
8984         (exception_test_LDADD) Likewise.
8985         (weak_test_LDADD): Likewise.
8986         (many_sections_test_LDADD): Likewise.
8987         (initpri1_LDADD): Likewise.
8988         (script_test_1_LDADD): Likewise.
8989         (script_test_2_LDADD): Likewise.
8990         (justsyms_LDADD): Likewise.
8991         (binary_test_LDADD): Likewise.
8992         (large_LDADD): Likewise.
8993         * testsuite/Makefile.in: Regenerated.
8994
8995 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8996
8997         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8998         (Symbol_table::override_with_special): Likewise.
8999         (Symbol_table::add_from_object): Likewise.
9000
9001 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9002
9003         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9004         Don't set the data_offset twice.
9005
9006 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9007
9008         * testsuite/Makefile.in: Regenerate.
9009
9010 2009-12-03  Doug Kwan  <dougkwan@google.com>
9011
9012         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9013         (Target_arm::do_finalize_sections): Add parameter for symbol table
9014         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9015         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9016         parameter for symbol table pointer.
9017         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9018         an additional parameter for a pointer to symbol table.
9019         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9020         parameter for a symbol table pointer.
9021         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9022         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9023         Ditto.
9024         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9025         parameter for a symbol table pointer.
9026
9027 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9028
9029         * incremental.cc (Incremental_inputs_header)
9030         (Incremental_inputs_header_write, Incremental_inputs_entry)
9031         (Incremental_inputs_entry_write): Move ...
9032         * incremental.h (Incremental_inputs_header)
9033         (Incremental_inputs_header_write, Incremental_inputs_entry)
9034         (Incremental_inputs_entry_write): here.
9035
9036 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9037
9038         * incremental.cc (make_sized_incremental_binary): Set the target.
9039         Error if it is incompatible.
9040         * output.h (Output_file): Add filename method.
9041
9042 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9043
9044         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9045         from the get_* methods.
9046
9047 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9048
9049         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9050         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9051         Write 0 for the data_offset of scripts.
9052
9053 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9054
9055         * testsuite/Makefile.am: Add the incremental_test.sh test.
9056         * testsuite/incremental_test.sh: New.
9057         * testsuite/incremental_test_1.c: New.
9058         * testsuite/incremental_test_2.c: New.
9059
9060 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9061
9062         * incremental-dump.cc (main): Fix typos.
9063
9064 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9065
9066         PR gold/11025
9067         * incremental-dump.cc (main): Use llu to print 64 bit values.
9068
9069 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9070             H.J. Lu  <hongjiu.lu@intel.com>
9071
9072         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9073         $(LIBDL).
9074         (incremental_dump_LDADD): Likewise.
9075         * Makefile.in: Regenerated.
9076
9077 2009-11-25  Doug Kwan  <dougkwan@google.com>
9078
9079         Revert:
9080
9081         2009-11-25  Doug Kwan  <dougkwan@google.com>
9082
9083                 * arm.cc (Target_arm::Target_arm): Move method definition
9084                 outside of class definition.  Add code to handle
9085                 --target1-rel, --target1-abs and --target2= options.
9086                 (Target_arm::get_reloc_reloc_type): Change method to be
9087                 non-static and const.
9088                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9089                 New data member declaration.
9090                 (Target_arm::Scan::local, Target_arm::Scan::global,
9091                 Target_arm::Relocate::relocate,
9092                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9093                 Adjust call to Target_arm::get_real_reloc_type.
9094                 (Target_arm::get_real_reloc_type): Use command line options
9095                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9096                 * options.h (--target1-rel, --target1-abs, --target2): New
9097                 ARM-only options.
9098
9099 2009-11-25  Doug Kwan  <dougkwan@google.com>
9100
9101         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9102         class definition.  Add code to handle --target1-rel, --target1-abs
9103         and --target2= options.
9104         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9105         and const.
9106         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9107         member declaration.
9108         (Target_arm::Scan::local, Target_arm::Scan::global,
9109         Target_arm::Relocate::relocate,
9110         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9111         call to Target_arm::get_real_reloc_type.
9112         (Target_arm::get_real_reloc_type): Use command line options to
9113         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9114         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9115         options.
9116
9117 2009-11-25  Doug Kwan  <dougkwan@google.com>
9118
9119         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9120         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9121         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9122         formatting.
9123         (Arm_relocate_functions::thm_call): Replace body with a call to
9124         Arm_relocate_functions::thumb_branch_common.
9125         (Arm_relocate_functions::thm_jump24,
9126         Arm_relocate_functions::thm_xpc22): New method definitions.
9127         (Arm_relocate_functions::thumb_branch_common): New method definition.
9128         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9129         operator.
9130         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9131         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9132
9133 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9134
9135         * Makefile.am: Build incremental-dump
9136         * Makefile.in: Regenerate.
9137         * incremental-dump.cc: New.
9138         * incremental.cc (Incremental_inputs_header_data,
9139         Incremental_inputs_entry_data): Move to incremental.h
9140         * incremental.h: (Incremental_inputs_header_data,
9141         Incremental_inputs_entry_data): Move from incremental.cc
9142
9143 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9144
9145         * incremental.cc (Incremental_inputs_header,
9146         Incremental_inputs_header_write, Incremental_inputs_entry,
9147         Incremental_inputs_entry_write): Add a typedef with the data type.
9148
9149 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9150
9151         * incremental.cc (Incremental_inputs_header,
9152         Incremental_inputs_header_write, Incremental_inputs_entry,
9153         Incremental_inputs_entry_write): Update comment about which
9154         type has the filed descriptions.
9155
9156 2009-11-15  Doug Kwan  <dougkwan@google.com>
9157
9158         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9159         (Arm_relocate_functions::arm_branch_common): Change method defintion
9160         in class definition to a method declaration and update list of formal
9161         parameters.
9162         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9163         Arm_relocation_functions::jump24): Adjust call to
9164         Arm_relocate_functions::arm_branch_common.  Update list of formal
9165         parameters.
9166         (Arm_relocate_functions::xpc25): New method definition.
9167         (Arm_relocate_functions::arm_branch_common): Move method defintion
9168         out from class definition.  Use stubs for mode-switching and extending
9169         branch ranges.
9170         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9171         specially.  Change code to enable use of stubs in ARM branches.
9172
9173 2009-11-10  Doug Kwan  <dougkwan@google.com>
9174
9175         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9176         in method declaration.
9177         (Target_arm::relocate_stub): New method declaration.
9178         (Target_arm::default_target): Change to return a pointer instead of
9179         a const reference.
9180         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9181         Target_arm::default_target.
9182         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9183         method definition.
9184         (Target_arm::relocate_section): Adjust view.
9185         (Target_arm::relocate_stub): New method definition.
9186
9187 2009-11-10  Doug Kwan  <dougkwan@google.com>
9188
9189         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9190         a format warning.
9191         * incremental.cc (open_incremental_binary): Initialized local
9192         variables to avoid warnings.
9193         * object.cc (make_elf_object): Ditto.
9194         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9195         a format warning.
9196
9197 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9198
9199         PR gold/10930
9200         * testsuite/plugin_test.c: Include "config.h".
9201
9202 2009-11-09  Doug Kwan  <dougkwan@google.com>
9203
9204         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9205         (arm_symbol_value): Remove.
9206         (Arm_relocate_functions::arm_branch_common,
9207         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9208         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9209         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9210         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9211         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9212         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9213         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9214         Arm_relocate_functions::thm_mobw_abs_nc,
9215         Arm_relocate_functions::thm_mov_abs,
9216         Arm_relocate_functions::movw_prel_nc,
9217         Arm_relocate_functions::thm_movt_abs,
9218         Arm_relocate_functions::movt_prel,
9219         Arm_relocate_functions::thm_movw_prel_nc,
9220         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9221         (Target_arm::Relocate::relocate): Only decompose address into two
9222         parts if relocation type uses the thumb-bit and pass the actual
9223         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9224         calls to methods in Arm_relocate_functions for this change.
9225
9226 2009-11-08  Ian Lance Taylor  <iant@google.com>
9227
9228         PR 10925
9229         * reloc.cc: Instantiate
9230         Sized_relobj::initialize_input_to_output_maps and
9231         Sized_relobj:free_input_to_output_maps.
9232
9233 2009-11-06  Ian Lance Taylor  <iant@google.com>
9234
9235         PR 10876
9236         * defstd.cc (in_segment): Set only_if_ref true for "end".
9237
9238 2009-11-06  Doug Kwan  <dougkwan@google.com>
9239
9240         * arm.cc (class Reloc_stub): Correct a comment.
9241         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9242         (Target_arm::scan_section_for_stubs): New method declaration.
9243         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9244         Change methods from private to protected.
9245         (Target_arm::do_may_relax): New method definition.
9246         (Target_arm::do_relax, Target_arm::group_sections,
9247         Target_arm::scan_reloc_for_stub,
9248         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9249         (Target_arm::arm_input_section_map_): New data member declaration.
9250         (Target_arm::scan_reloc_for_stub,
9251         Target_arm::scan_reloc_section_for_stubs,
9252         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9253         Target_arm::do_relax): New method definitions.
9254
9255 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9256
9257         * configure.ac: Check for (struct stat)::st_mtim
9258         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9259         * config.in: Regenerate.
9260         * configure: Regenerate.
9261
9262 2009-11-05  Ian Lance Taylor  <iant@google.com>
9263
9264         PR 10910
9265         * output.cc (Output_segment::add_output_section): Add missing
9266         return statement.
9267
9268 2009-11-04  Ian Lance Taylor  <iant@google.com>
9269
9270         PR 10880
9271         * object.h (class Object): Add is_needed and set_is_needed
9272         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9273         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9274         defined in a dynamic object and referenced by a regular object,
9275         set is_needed for the dynamic object.
9276         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9277         if the file is marked with as_needed and it is not needed.
9278
9279 2009-11-04  Ian Lance Taylor  <iant@google.com>
9280
9281         PR 10887
9282         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9283         tags if data is discarded by linker script.
9284         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9285         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9286         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9287         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9288
9289 2009-11-04  Ian Lance Taylor  <iant@google.com>
9290
9291         * layout.cc (Layout::get_output_section): Add is_interp and
9292         is_dynamic_linker_section parameters.  Change all callers.
9293         (Layout::choose_output_section): Likewise.
9294         (Layout::make_output_section): Likewise.
9295         (Layout::add_output_section_data): Add is_dynamic_linker_section
9296         parameter.  Change all callers.
9297         * layout.h (class Layout): Update declarations.
9298         * output.h (class Output_section): Add is_interp, set_is_interp,
9299         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9300         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9301         generate_code_fills_at_write_ to a bitfield.
9302         * output.cc (Output_section::Output_sections): Initialize new
9303         fields.
9304         (Output_segment::add_output_section): Add do_sort parameter.
9305         Change all callers.
9306
9307 2009-11-03  Ian Lance Taylor  <iant@google.com>
9308
9309         PR 10860
9310         * options.h (class General_options): Add --warn-common.
9311         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9312         merging two common symbols.
9313         (Symbol_table::should_override): Handle --warn-common when merging
9314         a common symbol with a defined symbol.  Use report_resolve_problem
9315         for multiple definitions.
9316         (Symbol_table::report_resolve_problem): New function.
9317         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9318
9319 2009-11-03  Doug Kwan  <dougkwan@google.com>
9320
9321         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9322         stub_factory_.
9323         (Target_arm::stub_factory): New method definition.
9324         (Target_arm::new_arm_input_section,
9325         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9326         Target_arm::reloc_uses_thumb_bit): New method declarations.
9327         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9328         New type definitions.
9329         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9330         member declarations.
9331         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9332         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9333         New method definitions.
9334
9335 2009-11-03  Ian Lance Taylor  <iant@google.com>
9336
9337         * options.h (class General_options): Add --warn_constructors.
9338
9339 2009-11-03  Ian Lance Taylor  <iant@google.com>
9340
9341         PR 10893
9342         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9343         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9344
9345 2009-11-03  Ian Lance Taylor  <iant@google.com>
9346
9347         PR 10895
9348         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9349         --msgid-bugs-address.
9350         (install-pdf): New target.
9351         (install-data_yes): Look up one directory to find mkinstalldirs.
9352
9353 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9354
9355         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9356         tree.
9357
9358 2009-10-30  Doug Kwan  <dougkwan@google.com>
9359
9360         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9361
9362 2009-10-30  Doug Kwan  <dougkwan@google.com>
9363
9364         * arm.cc (Stub_addend_reader): New struct template definition
9365         and partial specializations.
9366         (Stub_addend_reader::operator()): New method definition for a
9367         partially specialized template.
9368
9369 2009-10-30  Doug Kwan  <dougkwan@google.com>
9370
9371         * arm.cc (Arm_relobj::processor_specific_flags): New method
9372         definition.
9373         (Arm_relobj::do_read_symbols): New method declaration.
9374         (Arm_relobj::processor_specific_flags_): New data member declaration.
9375         (Arm_dynobj): New class definition.
9376         (Target_arm::do_finalize_sections): Add input_objects parameter.
9377         (Target_arm::do_adjust_elf_header): New method declaration.
9378         (Target_arm::are_eabi_versions_compatible,
9379         (Target_arm::merge_processor_specific_flags): New method declaration.
9380         (Target_arm::do_make_elf_object): New overloaded method definitions
9381         and declaration.
9382         (Arm_relobj::do_read_symbols): New method definition.
9383         (Arm_dynobj::do_read_symbols): Ditto.
9384         (Target_arm::do_finalize_sections): Add input_objects parameters.
9385         Merge processor-specific flags from all input objects.
9386         (Target_arm::are_eabi_versions_compatible,
9387         Target_arm::merge_processor_specific_flags,
9388         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9389         New method definitions.
9390         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9391         Input_objects pointer type parameter.
9392         * layout.cc (Layout::finalize): Pass input objects to target's.
9393         finalize_sections function.
9394         * output.cc (Output_file_header::do_sized_write): Set ELF file
9395         header's processor-specific flags.
9396         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9397         Input_objects pointer type parameter.
9398         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9399         * target.h (Input_objects): New forward class declaration.
9400         (Target::processor_specific_flags,
9401         Target::are_processor_specific_flags_sect): New method definitions.
9402         (Target::finalize_sections): Add input_objects parameter.
9403         (Target::Target): Initialize processor_specific_flags_ and
9404         are_processor_specific_flags_set_.
9405         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9406         parameter.
9407         (Target::set_processor_specific_flags): New method definition.
9408         (Target::processor_specific_flags_,
9409         Target::are_processor_specific_flags_set_): New data member
9410         declarations.
9411         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9412         Input_objects pointer type parameter.
9413
9414 2009-10-30  Doug Kwan  <dougkwan@google.com>
9415
9416         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9417
9418 2009-10-28  Ian Lance Taylor  <iant@google.com>
9419
9420         * object.h (class Relobj): Drop options parameter from
9421         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9422         do_scan_relocs, do_relocate.  Change all callers.
9423         (class Sized_relobj): Drop options parameters from
9424         do_gc_process_relocs, do_scan_relocs, do_relocate,
9425         do_relocate_sections, relocate_sections, emit_relocs_scan,
9426         emit_relocs_scan_reltype.  Change all callers.
9427         (struct Relocate_info): Remove options field and all references to
9428         it.
9429         * reloc.h (class Read_relocs): Remove options constructor
9430         parameter and options_ field.  Change all callers.
9431         (class Gc_process_relocs, class Scan_relocs): Likewise.
9432         (class Relocate_task): Likewise.
9433         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9434         all callers.
9435         (scan_relocatable_relocs): Likewise.
9436         * target.h (class Sized_target): Remove options parameter from
9437         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9438         all callers.
9439         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9440         callers.
9441         * arm.cc: Update functions to remove options parameters.
9442         * i386.cc: Likewise.
9443         * powerpc.cc: Likewise.
9444         * sparc.cc: Likewise.
9445         * x86_64.cc: Likewise.
9446         * testsuite/testfile.cc: Likewise.
9447
9448 2009-10-28  Doug Kwan  <dougkwan@google.com>
9449
9450         * arm.cc (Arm_relobj): New class definition.
9451         (Arm_relobj::scan_sections_for_stubs,
9452         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9453         New method definitions.
9454
9455 2009-10-28  Cary Coutant  <ccoutant@google.com>
9456
9457         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9458         (Plugin::cleanup_done_): New member.
9459         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9460         (Plugin_manager::cleanup_done_): Remove.
9461         (Plugin_manager::add_input_file): Edit error message.
9462         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9463         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9464
9465 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9466
9467         * fileread.cc: (File_read::View::~View): Use the new
9468         data_ownership_ filed.
9469         (File_read::~File_read): Dispose the new whole_file_view_.
9470         (File_read::open): Mmap the whole file if needed.
9471         (File_read::open): Use whole_file_view_ instead of contents_.
9472         (File_read::find_view): Use whole_file_view_ if applicable.
9473         (File_read::do_read): Use whole_file_view_ instead of contents_.
9474         (File_read::make_view): Use whole_file_view_ instead of contents_,
9475         update File_read::View::View call.
9476         (File_read::find_or_make_view): Update File_read::View::View
9477         call.
9478         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9479         remove contents_
9480         (File_read::View::Data_ownership): New enum.
9481         (File_read::View::View): Replace bool mapped_ with Data_ownership
9482         argument.
9483         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9484         (File_read::View::data_ownership_): New field.
9485         (File_read::contents_): Remove (replaced by whole_file_view_).
9486         (File_read::whole_file_view_): New field.
9487         * options.h (class General_options): Add --keep-files-mapped.
9488
9489 2009-10-27  Cary Coutant  <ccoutant@google.com>
9490
9491         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9492         * testsuite/Makefile.am (plugin_test_5): New test case.
9493         * testsuite/Makefile.in: Regenerate.
9494
9495 2009-10-25  Doug Kwan  <dougkwan@google.com>
9496
9497         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9498         from private to protected to allow access by child class.
9499         (Sized_relobj::do_relocate_sections): New method declaration.
9500         (Sized_relobj::relocate_sections): Virtualize.
9501         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9502         Sized_relobj::relocate_sections.  Instantiate template explicitly
9503         for different target sizes and endianity.
9504
9505 2009-10-24  Doug Kwan  <dougkwan@google.com>
9506
9507         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9508         (Arm_input_section::as_arm_input_section): New method.
9509         (Arm_output_section): New class definition.
9510         (Arm_output_section::create_stub_group,
9511         Arm_output_section::group_sections): New method definitions.
9512
9513 2009-10-22  Doug Kwan  <dougkwan@google.com>
9514
9515         * arm.cc (Arm_input_section): New class definition.
9516         (Arm_input_section::init, Arm_input_section:do_write,
9517         Arm_input_section::set_final_data_size,
9518         Arm_input_section::do_reset_address_and_file_offset): New method
9519         definitions.
9520
9521 2009-10-21  Doug Kwan  <dougkwan@google.com>
9522
9523         * arm.cc (Stub_table, Arm_input_section): New forward class
9524         declarations.
9525         (Stub_table): New class defintion.
9526         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9527         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9528         New method definition.
9529
9530 2009-10-21  Doug Kwan  <dougkwan@google.com>
9531
9532         * arm.cc: Update copyright comments.
9533         (Target_arm): New forward class template declaration.
9534         (Arm_address): New type.
9535         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9536         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9537         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9538         constants.
9539         (Insn_template): Same.
9540         (DEF_STUBS): New macro.
9541         (Stub_type): New enum type.
9542         (Stub_template): New class definition.
9543         (Stub): Same.
9544         (Reloc_stub): Same.
9545         (Stub_factory): Same.
9546         (Target_arm::Target_arm): Initialize may_use_blx_ and
9547         should_force_pic_veneer_.
9548         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9549         Target_arm::should_force_pic_veneer,
9550         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9551         Target_arm::using_thumb_only, Target_arm:;default_target): New
9552         method defintions.
9553         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9554         New data member declarations.
9555         (Insn_template::size, Insn_template::alignment): New method defintions.
9556         (Stub_template::Stub_template): New method definition.
9557         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9558         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9559         (Stub_factory::Stub_factory): New method definition.
9560         * gold.h (string_hash): New template.
9561         * output.h (Input_section_specifier::hash_value): Use
9562         gold::string_hash.
9563         (Input_section_specifier::string_hash): Remove.
9564         * stringpool.cc (Stringpool_template::string_hash): Use
9565         gold::string_hash.
9566
9567 2009-10-20  Doug Kwan  <dougkwan@google.com>
9568
9569         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9570         symbols of relaxed input sections.
9571         * output.h (Output_section::find_relaxed_input_section): Make
9572         method public.
9573
9574 2009-10-16  Doug Kwan  <dougkwan@google.com>
9575
9576         * dynobj.cc (Versions::Versions): Initialize version_script_.
9577         Only insert base version symbol definition for a shared object
9578         if version script defines any version versions.
9579         (Versions::define_base_version): New method definition.
9580         (Versions::add_def): Check that base version is not needed.
9581         (Versions::add_need): Define base version lazily.
9582         * dynobj.h (Versions::define_base_version): New method declaration.
9583         (Versions::needs_base_version_): New data member declaration.
9584         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9585         (check_DATA): Add no_version_test.stdout.
9586         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9587         New make rules.
9588         * testsuite/Makefile.in: Regenerate.
9589         * testsuite/no_version_test.c: New file.
9590         * testsuite/no_version_test.sh: Ditto.
9591
9592 2009-10-16  Doug Kwan  <dougkwan@google.com>
9593
9594         * expression.cc (class Segment_start_expression): New class definition.
9595         (Segment_start_expression::value): New method definition.
9596         (script_exp_function_segment_start): Return a new
9597         Segment_start_expression.
9598         * gold/script-c.h (script_saw_segment_start_expression): New function
9599         prototype.
9600         * script-sections.cc (Script_sections::Script_sections): Initialize
9601         SAW_SEGMENT_START_EXPRESSION_ to false.
9602         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9603         and -Tbbs options to specify section addresses if given in
9604         command line and no SEGMENT_START expression is seen in a script.
9605         * script-sections.h (Script_sections::saw_segment_start_expression,
9606         Script_sections::set_saw_segment_start_expression): New method
9607         definition.
9608         (Script_sections::saw_segment_start_expression_): New data member
9609         declaration.
9610         * script.cc (script_saw_segment_start_expression): New function.
9611         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9612         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9613         script_test_7.sh and script_test_8.sh.
9614         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9615         script_test_8.stdout.
9616         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9617         (script_test_6, script_test_6.stdout, script_test_7,
9618         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9619         * Makefile.in: Regenerate.
9620         * testsuite/script_test_6.sh: New file.
9621         * testsuite/script_test_6.t: Same.
9622         * testsuite/script_test_7.sh: Same.
9623         * testsuite/script_test_7.t: Same.
9624         * testsuite/script_test_8.sh: Same.
9625
9626 2009-10-16  Doug Kwan  <dougkwan@google.com>
9627
9628         * output.cc (Output_segment::set_section_list_address): Cast
9629         expressions to unsigned long long type to avoid format warnings.
9630
9631 2009-10-15  Ian Lance Taylor  <iant@google.com>
9632
9633         * script.cc (Script_options::add_symbol_assignment): Always add a
9634         dot assignment to script_sections_.
9635         * script-sections.cc (Script_sections::add_dot_assignment):
9636         Initialize if necessary.
9637
9638         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9639         program headers with no load segment if there is a linker script.
9640
9641         * layout.cc (Layout::set_segment_offsets): Align the file offset
9642         to the segment aligment for -N or -n with no load segment.
9643         * output.cc (Output_segment::add_output_section): Don't crash if
9644         the first section is a TLS section.
9645         (Output_segment::set_section_list_addresses): Print an error
9646         message if the address moves backward in a linker script.
9647         * script-sections.cc
9648         (Output_section_element_input::set_section_addresses): Don't
9649         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9650         (Orphan_output_section::set_section_addresses): Likewise.
9651
9652 2009-10-15  Doug Kwan  <dougkwan@google.com>
9653
9654         * layout.cc (Layout::finish_dynamic_section): Generate tags
9655         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9656         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9657         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9658
9659 2009-10-14  Ian Lance Taylor  <iant@google.com>
9660
9661         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9662         fields.
9663         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9664         data_shdr fields of relinfo.
9665         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9666         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9667         R_386_TLS_LDO_32, adjust based on section flags.
9668         (Target_i386::Relocate::fix_up_ldo): Remove.
9669
9670 2009-10-13  Ian Lance Taylor  <iant@google.com>
9671
9672         Add support for -pie.
9673         * options.h (class General_options): Add -pie and
9674         --pic-executable.
9675         (General_options::output_is_position_independent): Test -pie.
9676         (General_options::output_is_executable): Return true if not shared
9677         and not relocatable.
9678         (General_options::output_is_pie): Remove.
9679         * options.cc (General_options::finalize): Reject incompatible uses
9680         of -pie.
9681         * gold.cc (queue_middle_tasks): A -pie link is not static.
9682         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9683         * symtab.cc (Symbol::final_value_is_known): Return false if
9684         output_is_position_independent.
9685         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9686         output_is_position_independent.
9687         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9688         output_is_position_independent.
9689         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9690         output_is_position_independent.
9691         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9692         two_file_pie_test.
9693         (basic_pie_test.o, basic_pie_test): New targets.
9694         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9695         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9696         (two_file_pie_test): New target.
9697         * testsuite/Makefile.in: Rebuild.
9698         * README: Remove note saying that -pie is not supported.
9699
9700 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9701
9702         * options.h (class General_options): Add -init and -fini.
9703         * layout.cc (Layout::finish_dynamic_section): Emit
9704         given init and fini functions.
9705
9706 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9707
9708         * gc.h (gc_process_relocs): Check if icf is enabled using new
9709         function.
9710         * gold.cc (queue_initial_tasks): Likewise.
9711         (queue_middle_tasks): Likewise.
9712         * object.cc (do_layout): Likewise.
9713         * symtab.cc (is_section_folded): Likewise.
9714         * main.cc (main): Likewise.
9715         * reloc.cc (Read_relocs::run): Likewise.
9716         (Sized_relobj::do_scan_relocs): Likewise.
9717         * icf.cc (is_function_ctor_or_dtor): New function.
9718         (Icf::find_identical_sections): Check if function is ctor or dtor when
9719         safe icf is chosen.
9720         * options.h (General_options::icf): Change option to be an enum.
9721         (Icf_status): New enum.
9722         (icf_enabled): New method.
9723         (icf_safe_folding): New method.
9724         (set_icf_status): New method.
9725         (icf_status_): New variable.
9726         * (options.cc) (General_options::finalize): Set icf_status_.
9727         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9728         icf_test and icf_keep_unique_test to use the --icf enum flag.
9729         * testsuite/icf_safe_test.sh: New file.
9730         * testsuite/icf_safe_test.cc: New file.
9731
9732 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9733
9734         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9735         includes to gc.h and icf.h.
9736         * arm.cc: Include gc.h.
9737         * gold.cc: Likewise.
9738         * i386.cc: Likewise.
9739         * powerpc.cc: Likewise.
9740         * sparc.cc: Likewise.
9741         * x86_64.cc: Likewise.
9742         * gc.h: Include icf.h.
9743
9744 2009-10-11  Ian Lance Taylor  <iant@google.com>
9745
9746         * plugin.cc: Include "gold.h" before other header files.
9747
9748 2009-10-10  Chris Demetriou  <cgd@google.com>
9749
9750         * options.h (Input_file_argument::Input_file_type): New enum.
9751         (Input_file_argument::is_lib_): Replace with...
9752         (Input_file_argument::type_): New member.
9753         (Input_file_argument::Input_file_argument): Take Input_file_type
9754         'type' rather than boolean 'is_lib' as second argument.
9755         (Input_file_argument::is_lib): Use type_.
9756         (Input_file_argument::is_searched_file): New function.
9757         (Input_file_argument::may_need_search): Handle is_searched_file.
9758         * options.cc (General_options::parse_library): Support -l:filename.
9759         (General_options::parse_just_symbols): Update for Input_file_argument
9760         changes.
9761         (Command_line::process): Likewise.
9762         * archive.cc (Archive::get_file_and_offset): Likewise.
9763         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9764         * script.cc (read_script_file, script_add_file): Likewise.
9765         * fileread.cc (Input_file::Input_file): Likewise.
9766         (Input_file::will_search_for): Handle is_searched_file.
9767         (Input_file::open): Likewise.
9768         * readsyms.cc (Read_symbols::get_name): Likewise.
9769         * testsuite/Makefile.am (searched_file_test): New test.
9770         * testsuite/Makefile.in: Regenerate.
9771         * testsuite/searched_file_test.cc: New file.
9772         * testsuite/searched_file_test_lib.cc: New file.
9773
9774 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9775             Ian Lance Taylor  <iant@google.com>
9776
9777         * descriptor.cc: Include <cstdio> and "binary-io.h".
9778         (Descriptors::open): Open the files in binary mode always.
9779         * script.cc (Lex::get_token): Treat \r as whitespace.
9780
9781 2009-10-09  Ian Lance Taylor  <iant@google.com>
9782
9783         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9784
9785 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9786             Ian Lance Taylor  <iant@google.com>
9787
9788         * configure.ac: Check for readv function also.
9789         * fileread.cc (readv): Define if not HAVE_READV.
9790         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9791         does not exist.
9792         * config.in: Regenerate.
9793         * configure: Regenerate.
9794
9795 2009-10-09  Doug Kwan  <dougkwan@google.com>
9796
9797         * layout.cc (Layout::make_output_section): Call target hook to make
9798         ordinary output section.
9799         (Layout::finalize): Adjust parameter list of call the
9800         Target::may_relax().
9801         * layout.h (class Layout::section_list): New method.
9802         * merge.h (Output_merge_base::entsize): Change visibility to public.
9803         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9804         New methods.
9805         (Output_merge_string::do_is_string): New method.
9806         * object.cc (Sized_relobj::do_setup): renamed from
9807         Sized_relobj::set_up.
9808         * object.h (Sized_relobj::adjust_shndx,
9809         Sized_relobj::initializ_input_to_output_maps,
9810         Sized_relobj::free_input_to_output_maps): Change visibilities to
9811         protected.
9812         (Sized_relobj::setup): Virtualize.
9813         (Sized_relobj::do_setup): New method declaration.
9814         (Sized_relobj::invalidate_section_offset,
9815         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9816         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9817         * options.cc (parse_int): New function.
9818         * options.h (parse_int): New declaration.
9819         (DEFINE_int): New macro.
9820         (stub_group_size): New option.
9821         * output.cc (Output_section::Output_section): Initialize memebers
9822         merge_section_map_, merge_section_by_properties_map_,
9823         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9824         (Output_section::add_input_section): Handled deferred code-fill
9825         generation and remove an old comment.
9826         (Output_section::add_relaxed_input_section): New method definition.
9827         (Output_section::add_merge_input_section): Use merge section by
9828         properties map to speed to search.  Update merge section maps
9829         as appropriate.
9830         (Output_section::build_relaxation_map): New method definition.
9831         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9832         Same.
9833         (Output_section::relax_input_section): Renamed to
9834         Output_section::convert_input_sections_to_relaxed_sections and change
9835         interface to take a vector of pointers to relaxed sections.
9836         (Output_section::find_merge_section,
9837         Output_section::find_relaxed_input_section): New method definitions.
9838         (Output_section::is_input_address_mapped,
9839         Output_section::output_offset, Output_section::output_address):
9840         Use output section data maps to speed up searching.
9841         (Output_section::find_starting_output_address): Add comments.
9842         (Output_section::do_write,
9843         Output_section::write_to_postprocessing_buffer): Do code-fill
9844         generation as appropriate.
9845         (Output_section::get_input_sections): Invalidate relaxed input section
9846         map.
9847         (Output_section::restore_states): Adjust type of checkpoint .
9848         Invalidate relaxed input section map.
9849         * output.h (Output_merge_base): New class declaration.
9850         (Input_section_specifier): New class defintion.
9851         (class Output_relaxed_input_section) Change base class to
9852         Output_section_data_build.
9853         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9854         base class initializer.
9855         (Output_section::add_relaxed_input_section): New method declaration.
9856         (Output_section::Input_section): Change visibility to protected.
9857         (Output_section::Input_section::relobj,
9858         Output_section::Input_section::shndx): Handle relaxed input sections.
9859         Output_section::input_sections) Change visibility to protected.  Also
9860         define overload to return a non-const pointer.
9861         (Output_section::Merge_section_properties): New class defintion.
9862         (Output_section::Merge_section_by_properties_map,
9863         Output_section::Output_section_data_by_input_section_map,
9864         Output_section::Relaxation_map): New types.
9865         (Output_section::relax_input_section): Rename method to
9866         Output_section::convert_input_sections_to_relaxed_sections and change
9867         interface to take a vector of relaxed section pointers.
9868         (Output_section::find_merge_section,
9869         Output_section::find_relaxed_input_section,
9870         Output_section::build_relaxation_map,
9871         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9872         New method declarations.
9873         (Output_section::merge_section_map_
9874         Output_section::merge_section_by_properties_map_,
9875         Output_section::relaxed_input_section_map_,
9876         Output_section::is_relaxed_input_section_map_valid_,
9877         Output_section::generate_code_fills_at_write_): New data members.
9878         * script-sections.cc
9879         (Output_section_element_input::set_section_addresses): Call
9880         current_data_size and addralign methods of relaxed input sections.
9881         (Orphan_output_section::set_section_addresses): Call current_data_size
9882         and addralign methods of relaxed input sections.
9883         * symtab.cc (Symbol_table::compute_final_value): Extract template
9884         from the body of Symbol_table::sized_finalize_symbol.
9885         (Symbol_table::sized_finalized_symbol): Call
9886         Symbol_table::compute_final_value.
9887         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9888         (Symbol_table::compute_final_value): New templated method declaration.
9889         * target.cc (Target::do_make_output_section): New method defintion.
9890         * target.h (Target::make_output_section): New method declaration.
9891         (Target::relax): Add more parameters for input objects, symbol table
9892         and layout.  Adjust call to do_relax.
9893         (Target::do_make_output_section): New method declaration.
9894         (Target::do_relax): Add parameters for input objects, symbol table
9895         and layout.
9896
9897 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9898
9899         * pread.c: Include stdio.h.
9900
9901 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9902
9903         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9904         defined.
9905
9906 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9907
9908         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9909         Change read_shndx type to unsigned int.
9910         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9911         int.
9912         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9913         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9914         Change read_shndx type to unsigned int.
9915         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9916         int.
9917         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9918         * layout.cc (Layout::create_symtab_sections): Cast the result of
9919         local_symcount * symsize to off_t in the gold_assert.
9920
9921 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9922
9923         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9924         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9925         R_ARM_BASE_ABS.
9926         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9927         (Arm_relocate_functions::thm_abs5): New function.
9928         (Arm_relocate_functions::abs12): New function.
9929         (Arm_relocate_functions::abs16): New function.
9930         (Arm_relocate_functions::base_abs): New function.
9931         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9932         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9933         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9934         R_ARM_BASE_ABS.
9935         (Scan::global): Likewise.
9936         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9937         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9938         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9939         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9940         R_ARM_BASE_ABS.
9941
9942 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9943
9944         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9945         (Arm_relocate_functions::movt_prel): New function.
9946         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9947         (Arm_relocate_functions::thm_movt_prel): New function.
9948         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9949         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9950         (Scan::global, Relocate::relocate): Likewise.
9951         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9952
9953 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9954
9955         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9956         Incremental_checker.
9957         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9958         unsigned int.
9959         (class Incremental_inputs_header): New class.
9960         (Incremental_inputs_header_writer): Edit comment.
9961         (Incremental_inputs_entry): New class.
9962         (Incremental_inputs_entry_writer): Edit comment.
9963         (Sized_incremental_binary::do_find_incremental_inputs_section):
9964         Add *strtab_shndx parameter, fill it.
9965         (Sized_incremental_binary::do_check_inputs): New method.
9966         (Incremental_checker::can_incrementally_link_output_file): Use
9967         Sized_incremental_binary::check_inputs.
9968         (Incremental_inputs::report_command_line): Save command line in
9969         command_line_.
9970         * incremental.h:
9971         (Incremental_binary::find_incremental_inputs_section): New
9972         method.
9973         (Incremental_binary::do_find_incremental_inputs_section): Add
9974         strtab_shndx parameter.
9975         (Incremental_binary::do_check_inputs): New pure virtual method.
9976         (Sized_incremental_binary::do_check_inputs): Declare.
9977         (Incremental_checker::Incremental_checker): Add incremental_inputs
9978         parameter, use it to initialize incremental_inputs_.
9979         (Incremental_checker::incremental_inputs_): New field.
9980         (Incremental_checker::command_line): New method.
9981         (Incremental_checker::inputs): New method.
9982         (Incremental_checker::command_line_): New field.
9983
9984 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9985
9986         * incremental.cc: Include <cstdarg> and "target-select.h".
9987         (vexplain_no_incremental): New function.
9988         (explain_no_incremental): New function.
9989         (Incremental_binary::error): New method.
9990         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9991         method.
9992         (make_sized_incremental_binary): New function.
9993         (open_incremental_binary): New function.
9994         (can_incrementally_link_file): Add checks if output is ELF and has
9995         inputs section.
9996         * incremental.h: Include "elfcpp_file.h" and "output.h".
9997         (Incremental_binary): New class.
9998         (Sized_incremental_binary): New class.
9999         (open_incremental_binary): Declare.
10000         * object.cc (is_elf_object): Use
10001         elfcpp::Elf_recognizer::is_elf_file.
10002         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10003         * output.h (Output_file::filesize): New method.
10004
10005 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10006
10007         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10008         New function.
10009         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10010         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10011         function.
10012         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10013         function.
10014         (Arm_relocate_functions::movw_abs_nc): New function.
10015         (Arm_relocate_functions::movt_abs): New function.
10016         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10017         (Arm_relocate_functions::thm_movt_abs): New function.
10018         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10019         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10020         (Scan::global): Likewise.
10021         (Relocate::relocate): Likewise.
10022         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10023
10024 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10025
10026         * arm.cc (Arm_relocate_functions::got_prel) New function.
10027         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10028         (Relocate::relocate): Likewise.
10029         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10030
10031 2009-10-06  Ian Lance Taylor  <iant@google.com>
10032
10033         * options.h (class General_options): Define
10034         split_stack_adjust_size parameter.
10035         * object.h (class Object): Add uses_split_stack_ and
10036         has_no_split_stack_ fields.  Add uses_split_stack and
10037         has_no_split_stack accessor functions.  Declare
10038         handle_split_stack_section.
10039         (class Reloc_symbol_changes): Define.
10040         (class Sized_relobj): Define Function_offsets.  Declare
10041         split_stack_adjust, split_stack_adjust_reltype, and
10042         find_functions.
10043         * object.cc (Object::handle_split_stack_section): New function.
10044         (Sized_relobj::do_layout): Call handle_split_stack_section.
10045         * dynobj.cc (Sized_dynobj::do_layout): Call
10046         handle_split_stack_section.
10047         * reloc.cc (Sized_relobj::relocate_sections): Call
10048         split_stack_adjust for executable sections in split_stack
10049         objects.  Pass reloc_map to relocate_section.
10050         (Sized_relobj::split_stack_adjust): New function.
10051         (Sized_relobj::split_stack_adjust_reltype): New function.
10052         (Sized_relobj::find_functions): New function.
10053         * target-reloc.h: Include "object.h".
10054         (relocate_section): Add reloc_symbol_changes parameter.  Change
10055         all callers.
10056         * target.h (class Target): Add calls_non_split method.  Declare
10057         do_calls_non_split virtual method.  Declare match_view and
10058         set_view_to_nop.
10059         * target.cc: Include "elfcpp.h".
10060         (Target::do_calls_non_split): New function.
10061         (Target::match_view): New function.
10062         (Target::set_view_to_nop): New function.
10063         * gold.cc (queue_middle_tasks): Give an error if mixing
10064         split-stack and non-split-stack objects with -r.
10065         * i386.cc (Target_i386::relocate_section): Add
10066         reloc_symbol_changes parameter.
10067         (Target_i386::do_calls_non_split): New function.
10068         * x86_64.cc (Target_x86_64::relocate_section): Add
10069         reloc_symbol_changes parameter.
10070         (Target_x86_64::do_calls_non_split): New function.
10071         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10072         parameter.
10073         * powerpc.cc (Target_powerpc::relocate_section): Add
10074         reloc_symbol_changes parameter.
10075         * sparc.cc (Target_sparc::relocate_section): Add
10076         reloc_symbol_changes parameter.
10077         * configure.ac: Call AM_CONDITIONAL for the default target.
10078         * configure: Rebuild.
10079         * testsuite/Makefile.am (TEST_AS): New variable.
10080         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10081         (check_DATA): Add split_i386 and split_x86_64 files.
10082         (SPLIT_DEFSYMS): Define.
10083         (split_i386_[1234n].o): New targets.
10084         (split_i386_[124]): New targets.
10085         (split_i386_[1234r].stdout): New targets.
10086         (split_x86_64_[1234n].o): New targets.
10087         (split_x86_64_[124]): New targets.
10088         (split_x86_64_[1234r].stdout): New targets.
10089         (MOSTLYCLEANFILES): Add new executables.
10090         * testsuite/split_i386.sh: New file.
10091         * testsuite/split_x86_64.sh: New file.
10092         * testsuite/split_i386_1.s: New file.
10093         * testsuite/split_i386_2.s: New file.
10094         * testsuite/split_i386_3.s: New file.
10095         * testsuite/split_i386_4.s: New file.
10096         * testsuite/split_i386_n.s: New file.
10097         * testsuite/split_x86_64_1.s: New file.
10098         * testsuite/split_x86_64_2.s: New file.
10099         * testsuite/split_x86_64_3.s: New file.
10100         * testsuite/split_x86_64_4.s: New file.
10101         * testsuite/split_x86_64_n.s: New file.
10102         * testsuite/testfile.cc (Target_test): Update relocation_section
10103         function.
10104         * testsuite/Makefile.in: Rebuild.
10105
10106 2009-10-06  Ian Lance Taylor  <iant@google.com>
10107
10108         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10109         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10110         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10111         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10112         the address on ldo_addrs_.
10113         (Target_i386::Relocate::fix_up_ldo): New function.
10114
10115 2009-10-06   Rafael Espindola  <espindola@google.com>
10116
10117         * plugin.cc (add_input_library): New.
10118         (Plugin::load): Add add_input_library to tv.
10119         (Plugin_manager::add_input_file): Add the is_lib argument.
10120         (add_input_file): Update call to Plugin_manager::add_input_file.
10121         (add_input_library): New.
10122         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10123
10124 2009-09-30  Doug Kwan  <dougkwan@google.com>
10125
10126         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10127         symbol and call Symbol::may_need_copy_reloc to determine if
10128         a copy reloc is needed.
10129         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10130         nocopyreloc is given in command line.
10131         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10132         given in command line.
10133         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10134         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10135         of the removed Target_i386::may_need_copy_reloc.
10136         * options.h (copyreloc): New option with default value false.
10137         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10138         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10139         instead of the removed Target_powerpc::may_need_copy_reloc.
10140         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10141         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10142         instead of the removed Target_sparc::may_need_copy_reloc.
10143         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10144         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10145         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10146         instead of the removed Target_x86_64::may_need_copy_reloc.
10147
10148 2009-09-30  Ian Lance Taylor  <iant@google.com>
10149
10150         * object.h (class Object): Remove target_ field, and target,
10151         sized_target, and set_target methods.
10152         (Object::sized_target): Remove.
10153         (class Sized_relobj): Update declarations.  Remove sized_target.
10154         * object.cc (Sized_relobj::setup): Remove target parameter.
10155         Change all callers.
10156         (Input_objects::add_object): Don't do anything with the target.
10157         (make_elf_sized_object): Add punconfigured parameter.  Change all
10158         callers.  Set or test parameter target.
10159         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10160         Change all callers.
10161         * parameters.cc (Parameters::set_target): Change parameter type to
10162         be non-const.
10163         (Parameters::default_target): Remove.
10164         (set_parameters_target): Change parameter type to be non-const.
10165         (parameters_force_valid_target): New function.
10166         (parameters_clear_target): New function.
10167         * parameters.h (class Parameters): Update declarations.  Remove
10168         default_target method.  Add sized_target and clear_target
10169         methods.  Change target_ to be non-const.
10170         (set_parameters_target): Update declaration.
10171         (parameters_force_valid_target): Declare.
10172         (parameters_clear_target): Declare.
10173         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10174         as NULL if we aren't searching.
10175         (Add_symbols::run): Don't check for compatible target.
10176         * fileread.cc (Input_file::open_binary): Call
10177         parameters_force_valid_target.
10178         * gold.cc (queue_middle_tasks): Likewise.
10179         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10180         set_target on object.
10181         * dynobj.h (class Sized_dynobj): Update declarations.
10182         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10183         make_elf_object returns NULL.
10184         (Archive::include_member): Don't check whether object target is
10185         compatible.
10186         * output.cc (Output_section::add_input_section): Get target from
10187         parameters.
10188         (Output_section::relax_input_section): Likewise.
10189         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10190         parameters.
10191         (Sized_relobj::do_scan_relocs): Likewise.
10192         (Sized_relobj::relocate_sections): Likewise.
10193         * resolve.cc (Symbol_table::resolve): Likewise.
10194         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10195         parameter.  Change all callers.
10196         (Symbol_table::add_from_object): Get target from parameters.
10197         (Symbol_table::add_from_relobj): Don't check object target.
10198         (Symbol_table::add_from_dynobj): Likewise.
10199         (Symbol_table::define_special_symbol): Get target from
10200         parameters.
10201         * symtab.h (class Symbol_table): Update declaration.
10202         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10203         parameter.  Change all callers.  Clear parameter target.
10204         (Binary_test): Test target here.
10205         * testsuite/object_unittest.cc (gold_testsuite): Remove
10206         target_test_pointer parameter.  Change all callers.
10207         (Object_test): Test target here.
10208
10209 2009-09-26  Ian Lance Taylor  <iant@google.com>
10210
10211         * testsuite/initpri1.c: Don't try to use constructor priorities if
10212         compiling with gcc before 4.3.
10213
10214 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10215
10216         * testsuite/retain_symbols_file_test.sh (check_present): Change
10217         output file name to retain_symbols_file_test.stdout.
10218         (check_absent): Likewise.
10219
10220 2009-09-18  Craig Silverstein  <csilvers@google.com>
10221
10222         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10223         * options.cc: Include <cerrno> and <fstream>.
10224         (General_options::finalize): Parse -retain-symbols-file tag.
10225         * options.h: New flag.
10226         (General_options): New method should_retain_symbol, new
10227         variable symbols_to_retain.
10228         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10229         should_retain_symbol map.
10230         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10231         * testsuite/Makefile.in: Regenerate.
10232         * testsuite/retain_symbols_file_test.sh: New file.
10233
10234 2009-09-18  Nick Clifton  <nickc@redhat.com>
10235
10236         * po/es.po: Updated Spanish translation.
10237
10238 2009-09-17  Doug Kwan  <dougkwan@google.com>
10239
10240         * debug.h (DEBUG_RELAXATION): New constant.
10241         (DEBUG_ALL): Add DEBUG_RELAXATION.
10242         (debug_string_to_enum): Add relaxation debug option.
10243         * layout.cc
10244         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10245         Layout::Relaxation_debug_check::read_sections,
10246         Layout::Relaxation_debug_check::read_sections): New method definitions.
10247         (Layout::Layout): Initialize data members
10248         record_output_section_data_from_scrips_,
10249         script_output_section_data_list_ and relaxation_debug_check_.
10250         (Layout::save_segments, Layout::restore_segments,
10251         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10252         Layout::relaxation_loop_body): New method definitions.
10253         (Layout::finalize): Support relaxation.  Move section layout code to
10254         Layout::relaxation_loop_body.
10255         (Layout::set_asection_address_from_script): Move code for orphan
10256         section placement out.
10257         (Layout::place_orphan_sections_in_script): New method definition.
10258         * layout.h (Output_segment_headers, Output_file_header):
10259         New forward class declarations.
10260         (Layout::~Layout): Define.
10261         (Layout::new_output_section_data_from_script): New method definition.
10262         (Layout::place_orphan_sections_in_script): New method declaration.
10263         (Layout::Segment_states): New type declaration.
10264         (Layout::save_segments, Layout::restore_segments,
10265         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10266         Layout::relaxation_loop_body): New method declarations.
10267         (Layout::Output_section_data_list): New type declaration.
10268         (Layout::Relaxation_debug_check): New class definition.
10269         (Layout::record_output_section_data_from_script_,
10270         Layout::script_output_section_data_list_, Layout::segment_states_,
10271         Layout::relaxation_debug_check_): New data members.
10272         * output.cc: (Output_section_headers::do_size): New method definition.
10273         (Output_section_headers::Output_section_headers): Move size
10274         computation to Output_section_headers::do_size.
10275         (Output_segment_headers::do_size): New method definition.
10276         (Output_file_header::Output_file_header): Move size computation to
10277         Output_file_header::do_size and call it.
10278         (Output_file_header::do_size): New method definition.
10279         (Output_data_group::Output_data_group): Adjust call to
10280         Output_section_data.
10281         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10282         (Output_symtab_xindex::do_write): Add array bound check.
10283         (Output_section::Input_section::print_to_mapfile): Handle
10284         RELAXED_INPUT_SECTION_CODE.
10285         (Output_section::Output_section): Initialize data member checkpoint_.
10286         (Output_section::~Output_section): Delete checkpoint object pointed
10287         by checkpoint_.
10288         (Output_section::add_input_section): Always add an Input_section if
10289         relaxing.
10290         (Output_section::add_merge_input_section): Add assert.
10291         (Output_section::relax_input_section): New method definition.
10292         (Output_section::set_final_data_size): Set load address to zero for
10293         an unallocated section.
10294         (Output_section::do_address_and_file_offset_have_reset_values):
10295         New method definition.
10296         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10297         Handle relaxed input section.
10298         (Output_section::sort_attached_input_sections): Checkpoint input
10299         section list lazily.
10300         (Output_section::get_input_sections): Change type of input_sections to
10301         list of Simple_input_section pointers.  Checkpoint input section list
10302         lazily.  Also handle relaxed input sections.
10303         (Output_section::add_input_section_for_script): Take a reference to
10304         a Simple_input_section object instead of Relobj pointer and section
10305         index as parameter.  Handle relaxed input sections.
10306         (Output_section::save_states, Output_section::restore_states): New
10307         method definitions.
10308         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10309         (Output_data::is_data_size_fixed): New method definition.
10310         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10311         if it is fixed.
10312         (Output_data::address_and_file_offset_have_reset_values): New method
10313         definition.
10314         (Output_data::do_address_and_file_offset_have_reset_values): New method
10315         definition.
10316         (Output_data::set_data_size): Check that data size is not fixed.
10317         (Output_data::fix_data_size): New method definition.
10318         (Output_data::is_data_size_fixed_): New data member.
10319         (Output_section_headers::set_final_data_size): New method definition.
10320         (Output_section_headers::do_size): New method declaration.
10321         (Output_segment_headers::set_final_data_size): New method definition.
10322         (Output_segment_headers::do_size): New method declaration.
10323         (Output_file_header::set_final_data_size)::New method definition.
10324         (Output_file_header::do_size)::New method declaration.
10325         (Output_section_data::Output_section_data): Add new parameter
10326         is_data_size_fixed and use it to fix data size.
10327         (Output_data_const::Output_data_const): Adjust call to base class
10328         constructor and fix data size.
10329         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10330         base class constructor and fix data size.
10331         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10332         base class constructor and fix data size.
10333         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10334         class constructor and fix data size.
10335         (Output_data_group::set_final_data_size): New method definition.
10336         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10337         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10338         class constructor and fix data size.
10339         (Output_relaxed_input_section): New class definition.
10340         (Output_section::Simple_input_section): New class definition.
10341         (Output_section::get_input_sections): Adjust parameter list.
10342         (Output_section::add_input_section_for_script): Same.
10343         (Output_section::save_states, Output_section::restore_states,
10344         Output_section::do_address_and_file_offset_have_reset_values,
10345         (Output_section::Input_section::Input_section): Handle
10346         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10347         Output_relaxed_input_section.
10348         (Output_section::Input_section::is_input_section,
10349         Output_section::Input_section::set_output_section): Handle relaxed
10350         input section.
10351         (Output_section::Input_section::is_relaxed_input_section,
10352         Output_section::Input_section::output_section_data,
10353         Output_section::Input_section::relaxed_input_section): New method
10354         definitions.
10355         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10356         value.
10357         (Output_section::Input_section::u1_): Update comments.
10358         (Output_section::Input_section::u2_): Add new union member poris.
10359         (Output_section::Checkpoint_output_section): New classs definition.
10360         (Output_section::relax_input_section): New method declaration.
10361         (Output_section::checkpoint_): New data member.
10362         (Output_segment): Update comments.
10363         (Output_segment::Output_segment): Un-privatize copy constructor.
10364         (Output_segment::operator=): Un-privatize.
10365         * script-sections.cc (Output_section_element::Input_section_list):
10366         Change element type to Output_section::Simple_input_section.
10367         (Output_section_element_dot_assignment::set_section_addresses):
10368         Register output section data for relaxation clean up.
10369         (Output_data_exression::Output_data_expression): Adjust call to base
10370         constructor to fix data size.
10371         (Output_section_element_data::set_section_addresses): Register
10372         Output_data_expression object for relaxation clean up.
10373         (struct Input_section_info): Replace Relobj pointer and section index
10374         pair with Output_section::Simple_input_section and Convert struct to a
10375         class.
10376         (Input_section_sorter::operator()): Adjust access to
10377         Input_section_info data member to use accessors.
10378         (Output_section_element_input::set_section_addresses): Use layout
10379         parameter.  Adjust code to use Output_section::Simple_input_section
10380         and Input_secction_info classes.  Register filler for relaxation
10381         clean up.
10382         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10383         and section index pair with Output_section::Simple_input_section
10384         class.  Adjust code accordingly.
10385         (Phdrs_element::release_segment): New method definition.
10386         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10387         segment list.
10388         (Script_sections::release_segments): New method definition.
10389         * gold/script-sections.h (Script_sections::release_segments): New
10390         method declaration.
10391         * gold/target.h (Target::may_relax, Target::relax,
10392         Target::do_may_relax, Target::do_relax): New method definitions.
10393
10394 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10395
10396         * arm.cc (has_signed_unsigned_overflow): New function.
10397         (Arm_relocate_functions::abs8): New function.
10398         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10399         (Target_arm::Scan::global): Likewise.
10400         (Target_arm::relocate::relocate): Likewise.
10401         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10402         Likewise.
10403
10404 2009-09-16  Cary Coutant  <ccoutant@google.com>
10405
10406         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10407         * testsuite/Makefile.in: Regenerate.
10408
10409 2009-09-11  Nick Clifton  <nickc@redhat.com>
10410
10411         * po/gold.pot: Updated by the Translation project.
10412
10413 2009-09-08  Cary Coutant  <ccoutant@google.com>
10414
10415         * output.cc (Output_file::open): Add execute permission to empty file.
10416         * testsuite/Makefile.am (permission_test): New test.
10417         * testsuite/Makefile.in: Regenerate.
10418
10419 2009-09-02  Ian Lance Taylor  <iant@google.com>
10420
10421         * output.cc (Output_file::resize): Call map_no_anonymous rather
10422         than map.
10423
10424 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10425
10426         * gold.cc: Include "incremental.h".
10427         (queue_initial_tasks): Call Incremental_checker methods.
10428         * incremental.cc: Include "output.h".
10429         (Incremental_checker::can_incrementally_link_output_file): New
10430         method.
10431         * incremental.h (Incremental_checker): New class.
10432
10433         * output.cc (Output_file::open_for_modification): New method.
10434         (Output_file::map_anonymous): Changed return type to bool.  Record
10435         map in base_ field.
10436         (Output_file::map_no_anonymous): New method, broken out of map.
10437         (Output_file::map): Use map_no_anonymous and map_anonymous.
10438         * output.h (class Output_file): Update declarations.
10439
10440 2009-08-24  Cary Coutant  <ccoutant@google.com>
10441
10442         * options.h (Command_line::Pre_options): New class.
10443         (Command_line::pre_options): New member.
10444         * options.cc (gold::options::ready_to_register): New variable.
10445         (One_option::register_option): Do nothing if not registering options.
10446         Assert if same short option registered twice.
10447         (General_options::General_options): Turn off option registration when
10448         done constructing.
10449         (Command_line::Pre_options::Pre_options): New constructor.
10450
10451 2009-08-24  Cary Coutant  <ccoutant@google.com>
10452
10453         * options.h (General_options::no_keep_memory): Remove incorrect
10454         short option.
10455
10456 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10457
10458         * Makefile.am (am__skiplex, am__skipyacc): New.
10459         * Makefile.in: Regenerate.
10460
10461 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10462
10463         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10464         (INCLUDES): ... this.
10465         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10466         (AM_CPPFLAGS): Renamed from ...
10467         (INCLUDE): ... this.
10468         * Makefile.in, testsuite/Makefile.in: Regenerate.
10469
10470         * Makefile.in: Regenerate.
10471         * aclocal.m4: Likewise.
10472         * config.in: Likewise.
10473         * configure: Likewise.
10474         * testsuite/Makefile.in: Likewise.
10475
10476         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10477         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10478         * Makefile.in: Regenerate.
10479         * testsuite/Makefile.in: Regenerate.
10480
10481 2009-08-19  Cary Coutant  <ccoutant@google.com>
10482
10483         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10484         symbols in shared libraries overridden by hidden or internal symbols
10485         in the main program.
10486
10487 2009-08-19  Chris Demetriou  <cgd@google.com>
10488
10489         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10490         checking source file names in error messages.
10491
10492 2009-08-18  Doug Kwan  <dougkwan@google.com>
10493
10494         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10495         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10496         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10497         an elfcpp::Ehdr as parameter.
10498         * object.cc (Object::set_target): Remove the version that looks up
10499         a target and sets it.
10500         (Sized_relobj::setup): Take a Target object instead of
10501         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10502         (make_elf_sized_object): Find target and ask target to
10503         make an ELF object.
10504         * object.h: (Object::set_target): Remove the version that looks up
10505         a target and sets it.
10506         (Sized_relobj::setup): Take a Target object instead of
10507         an elfcpp:Ehdr as parameter.
10508         * target.cc: Include dynobj.h.
10509         (Target::do_make_elf_object_implementation): New.
10510         (Target::do_make_elf_object): New.
10511         * target.h (Target::make_elf_object): New template declaration.
10512         (Target::do_make_elf_object): New method declarations.
10513         (Target::do_make_elf_object_implementation): New template declaration.
10514
10515 2009-08-14  Ian Lance Taylor  <iant@google.com>
10516
10517         * gold.h (FUNCTION_NAME): Define.
10518         (gold_unreachable): Use FUNCTION_NAME.
10519
10520 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10521
10522         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10523         symbol in the --keep-unique list is not found.
10524
10525 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10526
10527         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10528         been maked as --keep-unique.
10529         (Icf::unfold_section): New function.
10530         * icf.h (Icf::unfold_section): New function.
10531         * options.h (General_options::keep_unique): New option.
10532         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10533         * testsuite/Makefile.in: Regenerate.
10534         * testsuite/icf_keep_unique_test.sh: New file.
10535         * testsuite/icf_keep_unique_test.cc: New file.
10536
10537 2009-08-12  Cary Coutant  <ccoutant@google.com>
10538
10539         PR 10471
10540         * resolve.cc (Symbol_table::resolve): Check for references from
10541         dynamic objects to hidden and internal symbols.
10542         * testsuite/Makefile.am (hidden_test.sh): New test.
10543         * testsuite/Makefile.in: Regenerate.
10544         * testsuite/hidden_test.sh: New script.
10545         * testsuite/hidden_test_1.c: New test source.
10546         * testsuite/hidden_test_main.c: New test source.
10547
10548 2009-08-11  Doug Kwan  <dougkwan@google.com>
10549
10550         * arm.cc: Update comments.
10551         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10552         segment to locate the .ARM.exidx section if present.
10553
10554 2009-08-09  Doug Kwan  <dougkwan@google.com>
10555
10556         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10557         patch.
10558
10559 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10560         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10561         compiler warnings.
10562
10563 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10564
10565         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10566         valid tls_segment only for non-debug-section relocations.
10567         * testsuite/Makefile.am: Add gc_tls_test.
10568         * testsuite/Makefile.in: Regenerate.
10569         * testsuite/gc_tls_test.cc: New file.
10570         * testsuite/gc_tls_test.sh: New file.
10571
10572 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10573
10574         * icf.cc: New file.
10575         * icf.h: New file.
10576         * Makefile.am (CCFILES): Add icf.cc.
10577         (HFILES): Add icf.h
10578         * Makefile.in: Regenerate.
10579         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10580         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10581         section, symbol and addend information for the relocs.
10582         * gold.cc (queue_middle_tasks): Call identical code folding.
10583         * gold.h: Add defines for multimap.
10584         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10585         to the call of finalize_local_symbols.
10586         * main.cc (main): Create object of class Icf.
10587         * object.cc (Sized_relobj::do_layout): Allow this function to be
10588         called twice during icf.
10589         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10590         to sections marked as identical by icf.
10591         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10592         when available.
10593         (Sized_relobj::do_section_entsize): New function.
10594         * object.h (Object::section_entsize): New function.
10595         (Object::do_section_entsize): New pure virtual function.
10596         (Relobj::finalize_local_symbols): Add new parameter.
10597         (Relobj::do_section_entsize): New function.
10598         * options.h (General_options::icf): New option.
10599         (General_options::icf_iterations): New option.
10600         (General_options::print_icf_sections): New option.
10601         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10602         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10603         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10604         icf.
10605         * symtab.cc (Symbol_table::is_section_folded): New function.
10606         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10607         to sections marked as identical by icf.
10608         * symtab.h (Symbol_table::set_icf): New function.
10609         (Symbol_table::icf): New function.
10610         (Symbol_table::is_section_folded): New function.
10611         (Symbol_table::icf_): New data member.
10612         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10613         * testsuite/Makefile.am: Add commands to build icf_test.
10614         * testsuite/Makefile.in: Regenerate.
10615         * testsuite/icf_test.sh: New file.
10616         * testsuite/icf_test.cc: New file.
10617
10618 2009-07-24  Chris Demetriou  <cgd@google.com>
10619
10620         * layout.cc (is_compressible_debug_section): Fix incorrect
10621         comment about compressed section names.
10622
10623 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10624
10625         PR 10419
10626         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10627
10628 2009-07-16  Ian Lance Taylor  <iant@google.com>
10629
10630         PR 10400
10631         * layout.h: #include <map>.
10632         (class Kept_section): Change from struct to class.  Add accessors
10633         and setters.  Add section size to Comdat_group mapping.  Change
10634         Comdat_group to std::map.  Add is_comdat_ field.  Add
10635         linkonce_size field in union.
10636         (class Layout): Update declaration of find_or_add_kept_section.
10637         Don't declare find_kept_object.
10638         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10639         parameter.  Add object, shndx, is_comdat, and is_group_name
10640         parameters.  Change all callers.  Adjust for new Kept_section.
10641         (Layout::find_kept_object): Remove.
10642         * object.cc (Sized_relobj::include_section_group): Update use of
10643         Kept_section.  Rename secnum to shndx.  Only record
10644         Kept_comdat_section if sections are the same size.
10645         (Sized_relobj::include_linkonce_section): Update use of
10646         Kept_section.  Only record Kept_comdat_section if sections are the
10647         same size.  Set size of linkonce section.
10648         (Sized_relobj::map_to_kept_section): Update call to
10649         get_kept_comdat_section.
10650         * object.h (class Sized_relobj): Rename fields in
10651         Kept_comdat_section to drop trailing underscores; change object
10652         field to Relobj*.  Change Kept_comdat_section_table to store
10653         struct rather than pointer.
10654         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10655         Add kept_object and kept_shndx parameters.  Change all callers.
10656         (Sized_relobj::get_kept_comdat_section): Change return type to
10657         bool.  Add kept_object and kept_shndx parameters.  Change all
10658         callers.
10659         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10660         Layout::find_or_add_kept_section.
10661
10662 2009-07-09  Ian Lance Taylor  <iant@google.com>
10663
10664         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10665         Reserve space in the hash table.
10666
10667 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10668
10669         * fileread.cc (File_read::get_mtime): New method.
10670         * fileread.h (Timespec): New structure.
10671         (File_read::get_mtime): New method.
10672         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10673         Renamed from timestamp_nsec.
10674         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10675         Elf_Xword.
10676         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10677         timestamp_nsec.
10678         (Incremental_inputs::report_archive): Save mtime; style fix.
10679         (Incremental_inputs::report_obejct): Save mtime; style fix.
10680         (Incremental_inputs::report_script): Save mtime; style fix.
10681         (Incremental_inputs::finalize_inputs): Style fix.
10682         (Incremental_inputs::finalize): Style fix.
10683         (Incremental_inputs::create_input_section_data): Store inputs
10684         mtime.
10685         * incremental.h (Incremental_inputs::report_script): Add mtime
10686         argument.
10687         (Incremental_inputs::Input_info::Input_info): Intialize only one
10688         union member.
10689         (Incremental_inputs::Input_info::archive): Move to nameless
10690         union.
10691         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10692         (Incremental_inputs::Input_info::script): Move to nameless union.
10693         (Incremental_inputs::mtime): New field.
10694         * script.cc (read_input_script): Pass file mtime to
10695         Incremental_input.
10696         * script.h (Script_info::inputs): Style fix.
10697
10698 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10699
10700         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10701         instead of 32.
10702
10703 2009-06-24  Ian Lance Taylor  <iant@google.com>
10704
10705         PR 10156
10706         * layout.cc (Layout::choose_output_section): If we find an
10707         existing section, update the flags.
10708         (Layout::create_notes): New function, broken out of
10709         Layout::finalize.
10710         (Layout::finalize): Don't create note sections.
10711         (Layout::create_note): Don't crash if linker script discards
10712         section.
10713         (Layout::create_gold_note): Likewise.
10714         (Layout::create_build_id): Likewise.  Don't set
10715         after_input_sections on the section.
10716         (Layout::create_executable_stack_info): Remove target parameter.
10717         Change caller.
10718         * layout.h (class Layout): Declare create_notes.  Update
10719         declaration of create_executable_stack_info.
10720         * gold.cc (queue_middle_tasks): Call create_notes.
10721         * output.cc (Output_section::update_flags_for_input_section): Move
10722         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10723         invalid.
10724         * output.h (Output_data::mark_address_invalid): New function.
10725         (class Output_section): Only declare, not define,
10726         update_flags_for_input_section.  Remove set_flags.
10727
10728 2009-06-24  Ian Lance Taylor  <iant@google.com>
10729
10730         * script-sections.cc (Output_section_definition::
10731         set_section_addresses): Rename shadowing local load_address to
10732         laddr.
10733
10734 2009-06-24  Ian Lance Taylor  <iant@google.com>
10735
10736         PR 10244
10737         * reloc.cc (relocate_sections): Skip empty relocation sections.
10738
10739 2009-06-23  Ian Lance Taylor  <iant@google.com>
10740
10741         PR 10156
10742         * layout.cc (Layout::create_note): Use choose_output_section
10743         rather than make_output_section.
10744
10745 2009-06-23  Ian Lance Taylor  <iant@google.com>
10746
10747         PR 10237
10748         * options.cc (General_options::parse_V): Set printed_version_.
10749         (General_options::General_options): Initialize printed_version_.
10750         * options.h (class General_options): Add printed_version_ field.
10751         * gold.cc (queue_initial_tasks): If there are no input files,
10752         don't give a fatal error if we printed the version information.
10753         (queue_middle_tasks): If using -r with a shared object, give a
10754         fatal error rather than an ordinary error.
10755
10756 2009-06-23  Ian Lance Taylor  <iant@google.com>
10757
10758         PR 10219
10759         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10760         (Layout::make_output_section): Set have_stabstr_section_ if we see
10761         a .stab*str section.
10762         (Layout::finalize): Call link_stabs_sections.
10763         (Layout::link_stabs_sections): New file.
10764         * layout.h (class Layout): Add have_stabstr_section_ field.
10765         Declare link_stabs_sections.
10766
10767 2009-06-23  Doug Kwan  <dougkwan@google.com>
10768
10769         * Makefile.am (libgold_a_LIBADD): New.
10770         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10771         * Makefile.in: Regenerate.
10772         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10773         * configure: Regenerate.
10774         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10775         * fileread.cc: Include sys/state.h
10776         * gold.h: Declare memmem and strndup if found missing.
10777         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10778
10779 2009-06-23  Ian Lance Taylor  <iant@google.com>
10780
10781         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10782         * configure: Rebuild.
10783
10784 2009-06-23  Ian Lance Taylor  <iant@google.com>
10785
10786         PR 10147
10787         * object.cc (Object::section_contents): Don't try to get a view if
10788         the section has length zero.
10789         (Object::handle_gnu_warning_section): If the section is empty, use
10790         the name of the section as the warning.
10791
10792 2009-06-23  Ian Lance Taylor  <iant@google.com>
10793
10794         PR 10133
10795         * stringpool.h (class Stringpool_template): Add optimize_ field.
10796         (Stringpool_template::set_optimize): New function.
10797         * stringpool.cc (Stringpool_template::Stringpool_template):
10798         Initialize optimize_ field.
10799         (Stringpool_template::set_string_offsets): Test local optimize
10800         fild rather than parameter.
10801         * layout.cc (Layout::Layout): Call set_optimize on the section
10802         name stringpool.
10803
10804 2009-06-22  Ian Lance Taylor  <iant@google.com>
10805
10806         PR 10030
10807         * yyscript.y: Parse TARGET.
10808         * script.cc (script_set_target): New function.
10809         * script-c.h (script_set_target): Declare.
10810         * options.cc (General_options::string_to_object_format): Rename
10811         from string_to_object_format in anonymous namespace.  Change
10812         callers.
10813         * options.h (class General_options): Declare
10814         string_to_object_format.
10815
10816 2009-06-22  Ian Lance Taylor  <iant@google.com>
10817
10818         * script-sections.cc (Script_sections::create_segments): Don't put
10819         program headers in a PT_LOAD segment if -n or -N.
10820
10821 2009-06-22  Ian Lance Taylor  <iant@google.com>
10822
10823         PR 10141
10824         * options.h (class General_options): Add -z lazy and -z now.  Sort
10825         -z options into alphabetical order.
10826         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10827
10828 2009-06-21  Ian Lance Taylor  <iant@google.com>
10829
10830         * layout.cc (Layout::make_output_section): Call
10831         Target::new_output_section.
10832         (Layout::attach_allocated_section_to_segment): Put large section
10833         sections in a separate load segment with the large segment flag
10834         set.
10835         (Layout::segment_precedes): Sort large data segments after other
10836         load segments.
10837         (align_file_offset): New static function.
10838         (Layout::set_segment_offsets): Use align_file_offset.
10839         * output.h (class Output_section): Add is_small_section_ and
10840         is_large_section_ fields.
10841         (Output_section::is_small_section): New function.
10842         (Output_section::set_is_small_section):  New function.
10843         (Output_section::is_large_section): New function.
10844         (Output_section::set_is_large_section): New function.
10845         (Output_section::is_large_data_section): New function.
10846         (class Output_segment): Add is_large_data_segment_ field.
10847         (Output_segment::is_large_data_segment): New function.
10848         (Output_segment::set_is_large_data_segment): New function.
10849         * output.cc (Output_section::Output_section): Initialize new
10850         fields.
10851         (Output_segment::Output_segment): Likewise.
10852         (Output_segment::add_output_section): Add assertion that large
10853         data sections always go in large data segments.  Force small data
10854         sections to the end of the list of data sections.  Force small BSS
10855         sections to the start of the list of BSS sections.  For large BSS
10856         sections to the end of the list of BSS sections.
10857         * symtab.h (class Symbol): Declare is_common_shndx.
10858         (Symbol::is_defined): Check Symbol::is_common_shndx.
10859         (Symbol::is_common): Likewise.
10860         (class Symbol_table): Define enum Commons_section_type.  Update
10861         declarations.  Add small_commons_ and large_commons_ fields.
10862         * symtab.cc (Symbol::is_common_shndx): New function.
10863         (Symbol_table::Symbol_table): Initialize new fields.
10864         (Symbol_table::add_from_object): Put small and large common
10865         symbols in the right list.
10866         (Symbol_table::sized_finalized_symbol): Check
10867         Symbol::is_common_shndx.
10868         (Symbol_table::sized_write_globals): Likewise.
10869         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10870         common symbol lists.  Don't call do_allocate_commons_list if the
10871         list is empty.
10872         (Symbol_table::do_allocate_commons_list): Remove is_tls
10873         parameter.  Add comons_section_type parameter.  Change all
10874         callers.  Handle small and large common symbols.
10875         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10876         Symbol::is_common_shndx.
10877         * resolve.cc (symbol_to_bits): Likewise.
10878         * target.h (Target::small_common_shndx): New function.
10879         (Target::small_common_section_flags): New function.
10880         (Target::large_common_shndx): New function.
10881         (Target::large_common_section_flags): New function.
10882         (Target::new_output_section): New function.
10883         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10884         small_common_section_flags, and large_common_section_flags
10885         fields.
10886         (Target::do_new_output_section): New virtual function.
10887         * arm.cc (Target_arm::arm_info): Initialize new fields.
10888         * i386.cc (Target_i386::i386_info): Likewise.
10889         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10890         Likewise.
10891         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10892         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10893         (Target_x86_64::do_new_output_section): New function.
10894         * configure.ac: Define conditional MCMODEL_MEDIUM.
10895         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10896         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10897         (large_LDFLAGS): Define.
10898         * testsuite/large.c: New file.
10899         * testsuite/testfile.cc (Target_test::test_target_info):
10900         Initialize new fields.
10901         * configure, testsuite/Makefile.in: Rebuild.
10902
10903 2009-06-05  Doug Kwan  <dougkwan@google.com>
10904
10905         * Makefile.am (CCFILES): Add target.cc.
10906         * Makefile.in: Regenerate.
10907         * i386.cc (class Target_i386): Define new virtual method to
10908         override do_is_local_label_name in parent.
10909         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10910         local symbols if --discard-locals or -X is given.
10911         * options.h (class General_options): Declare new options
10912         '--discard-locals' and '-X' for discarding locals.
10913         * target.h (class Target): Define new methods is_local_label_name.
10914         Declare new virtual method do_is_local_label_name.
10915         * target.cc: New file.
10916         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10917         (check_SCRIPTS): Add discard_locals_test.sh.
10918         (check_DATA): Add discard_local_tests.syms.
10919         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10920         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10921         * testsuite/Makefile.in: Regenerate.
10922         * testsuite/discard_locals_test.c: New file.
10923         * testsuite/discard_locals_test.sh: Same.
10924
10925 2009-06-05  Doug Kwan  <dougkwan@google.com>
10926
10927         * object.cc (Sized_relobj::Sized_relobj): Initialize
10928         discarded_eh_frame_shndx_ to -1U.
10929         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10930         section.
10931         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10932         a discarded .eh_frame section.
10933         (Sized_relobj::do_finalize_local_symbols): Ditto.
10934         * object.h (class Sized_relobj): Declare new member
10935         discarded_eh_frame_shndx_.
10936         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10937         (local_labels_test.o, local_labels_test): New rules.
10938         * testsuite/Makefile.in: Regenerate.
10939
10940 2009-06-04  Doug Kwan  <dougkwan@google.com>
10941
10942         * layout.cc (Layout::section_name_mapping): Add mapping for
10943         special ARM sections.
10944
10945 2009-06-03  Doug Kwan  <dougkwan@google.com>
10946
10947         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10948         (utils::has_overflow): Same.
10949
10950 2009-06-03  Ian Lance Taylor  <iant@google.com>
10951
10952         * layout.cc (Layout::section_name_mapping): New array, replacing
10953         Layout::linkonce_mapping.
10954         (Layout::section_name_mapping_count): New variable, replacing
10955         Layout::linkonce_mapping_count.
10956         (Layout::linkonce_output_name): Remove.
10957         (Layout::output_section_name): Rewrite.
10958         * layout.h (class Layout): Rename Linkonce_mapping to
10959         Section_name_mapping, linkonce_mapping to section_name_mapping,
10960         linkonce_mapping_count to section_name_mapping_count.  Don't
10961         declare linkonce_output_name.
10962
10963 2009-06-03  Doug Kwan  <dougkwan@google.com>
10964
10965         * gold/arm.cc (namespace utils): New.
10966         (Target_arm::reloc_is_non_pic): Define new method.
10967         (class Arm_relocate_functions): New.
10968         (Target_arm::Relocate::relocate): Handle relocation types used by
10969         Android.
10970
10971 2009-06-03  Ian Lance Taylor  <iant@google.com>
10972
10973         * arm.cc (Target_arm::scan::global): Use || instead of |.
10974
10975 2009-06-02  Doug Kwan  <dougkwan@google.com>
10976
10977         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10978         issued_non_pic_error_.
10979         (class Target_arm::Scan): Declare new method check_non_pic.
10980         Define new method symbol_needs_plt_entry.
10981         Declare new data member issued_non_pic_error_.
10982         (class Target_arm::Relocate): Declare new method
10983         should_apply_static_reloc.
10984         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10985         (Target_arm::Scan::check_non_pic): Define new method.
10986         (Target_arm::Scan::local): Handle a small subset of reloc types used
10987         by Android.
10988         (Target_arm::Scan::local): Same.
10989         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10990
10991 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10992
10993         * incremental.cc (Incremental_inputs::report_command_line): Filter
10994         out --incremental-* options.
10995
10996 2009-05-29  Doug Kwan  <dougkwan@google.com>
10997
10998         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10999         template class.
11000         (class Target_arm): Update comment.
11001         (Target_arm::Target_arm): Initialize new data members GOT_,
11002         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11003         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11004         and Target_arm::rel_dyn_section.
11005         Declare new_enum Target_arm::Got_type.
11006         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11007         and DYNBSS_.
11008         Update commments for member do_dynsym_value.
11009         (Target_arm::got_size, Target_arm::plt_section,
11010         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11011         new methods inside class defintion.
11012         (Target_arm::got_section): Define new method.
11013         (Target_arm::rel_dyn_section): Same.
11014         (Output_data_plt_arm): New template class.
11015         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11016         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11017         (Output_data_plt_arm::add_entry): Same.
11018         (Output_data_plt_arm::first_plt_entry): Define new
11019         static data member for PLT instruction template.
11020         (Output_data_plt_arm::plt_entry): Same.
11021         (Output_data_plt_arm::do_write): Define new method.
11022         (Target_arm::make_plt_entry): Same.
11023         (Target_arm::do_finalize_sections): Same.
11024         (Target_arm::do_dynsym_value): Same.
11025
11026 2009-05-28  Doug Kwan  <dougkwan@google.com>
11027
11028         * Makefile.am (TARGETSOURCES): Add arm.cc.
11029         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11030         * Makefile.in: Regenerate.
11031         * arm.cc: New file.
11032         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11033
11034 2009-05-26  Doug Kwan  <dougkwan@google.com>
11035
11036         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11037         (General_options::check_excluded_libs): Strip off directories in
11038         archive name before matching like GNU ld does.
11039         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11040         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11041         (exclude_libs_test_LDFLAGS): Add linker option
11042         -Wl,--exclude-libs,libexclude_libs_test_3
11043         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11044         an explicit archive without using -l.
11045         (alt/libexclude_libs_test_3.a): New make rule.
11046         * testsuite/Makefile.in: Regenerate.
11047         * testsuite/exclude_libs_test.c : Declare lib3_default().
11048         (main): Call it.
11049         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11050         * exclude_libs_test_3.c: New file.
11051
11052 2009-05-26  Nick Clifton  <nickc@redhat.com>
11053
11054         * po/id.po: New Indonesian translation.
11055         * po/gold.pot: Updated template file.
11056
11057 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11058
11059         * testsuite/Makefile.am: Add -ffunction-sections to compile
11060         gc_comdat_test files.  Add -Wl,--gc-sections to build
11061         gc_comdat_test.
11062         * testsuite/Makefile.in: Regenerate.
11063         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11064
11065 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11066
11067         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11068         kept comdat section was garbage collected.
11069         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11070         * testsuite/Makefile.in: Regenerate.
11071         * testsuite/gc_comdat_test.sh: New file.
11072         * testsuite/gc_comdat_test_1.cc: New file.
11073         * testsuite/gc_comdat_test_2.cc: New file.
11074
11075 2009-05-19  Doug Kwan  <dougkwan@google.com>
11076
11077         * archive.cc (Archive::Archive): Move constructor from archive.h
11078         to here.  Initialize no_export_.
11079         (Archive::get_elf_object_for_member): Set no_export flag of object.
11080         * archive.h (Archive::Archive): Move constructor body to
11081         archive.cc.
11082         (Archive::no_export): New method.
11083         (Archive::no_export_): New field.
11084         * object.h (Object::Object): Initialize no_export_ to false.
11085         (Object::no_export, Object::set_no_export): New methods.
11086         (Object::no_export_): New field.
11087         * options.cc (General_options::parse_exclude_libs): New method.
11088         (General_options::check_excluded_libs) Same.
11089         * options.h (exclude_libs): New option.
11090         (General_options::check_excluded_libs): New method declaration.
11091         (General_options::excluded_libs_): New field.
11092         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11093         default or protected visibility if an object has no-export flag set.
11094         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11095         (check_SCRIPTS): Add exclude_libs_test.sh.
11096         (check_DATA): Add exclude_libs_test.syms.
11097         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11098         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11099         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11100         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11101         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11102         libexclude_libs_test_2.a): New rules.
11103         * testsuite/Makefile.in: Regenerate.
11104         * testsuite/exclude_libs_test.c: New file.
11105         * testsuite/exclude_libs_test.sh: Ditto.
11106         * testsuite/exclude_libs_test_1.c: Ditto.
11107         * testsuite/exclude_libs_test_2.c: Ditto.
11108
11109 2009-05-15  Ian Lance Taylor  <iant@google.com>
11110
11111         * configure.ac: Check for declarations for cases where libiberty.h
11112         checks HAVE_DECL_xxx.
11113         * configure, config.in: Rebuild.
11114
11115 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11116
11117         * gold.h (Incremental_argument_list): Remove (invalid) forward
11118         declaration.
11119         * incremental.cc (Incremental_inputs::report_achive): New method.
11120         (Incremental_inputs::report_object): New method.
11121         (Incremental_inputs::report_script): New method.
11122         (Incremental_inputs::finalize_inputs): New method.
11123         (Incremental_inputs::finalize): Call finalize_inputs().
11124         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11125         Create inputs entries.
11126         * incremental.h (Incremental_input_type): New enum.
11127         (Incremental_inputs::Incremental_input): Initialize new fields.
11128         (Incremental_inputs::report_inputs): New method.
11129         (Incremental_inputs::report_achive): New method.
11130         (Incremental_inputs::report_object): New method.
11131         (Incremental_inputs::report_script): New method.
11132         (Incremental_inputs::finalize_inputs): New method.
11133         (Incremental_inputs::Input_info): New struct.
11134         (Incremental_inputs::Input_info_map): New typedef.
11135         (Incremental_inputs::lock_): New field.
11136         (Incremental_inputs::Inputs_): New field.
11137         (Incremental_inputs::Inputs_map): New field.
11138         * main.cc (main): Call Incremental_input::report_inputs.
11139         * options.h (Input_argument_list): Typedef moved from
11140         Input_arguments.
11141         (Input_file_group::Files): Remove, use ::Input_argument_list.
11142         (Input_file_group::Input_argument_list): Remove, use
11143         ::Input_argument_list.
11144         * plugin.cc (Plugin_manager::add_input_file): Add error in
11145         incremental build.
11146         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11147         functions.
11148         * script.cc (read_input_script): Call
11149         Incremental_input::report_script.
11150         * script.h (Script_info): New class.
11151
11152 2009-04-27  Ian Lance Taylor  <iant@google.com>
11153
11154         * x86_64.cc (do_adjust_output_section): Set entsize to
11155         plt_entry_size.
11156
11157 2009-04-23  Elliott Hughes  <enh@google.com>
11158
11159         * output.cc (Output_file::close): After short writes, continue
11160         writing from the correct offset in the buffer being written.
11161
11162 2009-04-23  Chris Demetriou  <cgd@google.com>
11163
11164         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11165         * configure: Regenerate.
11166         * config.in: Regenerate.
11167         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11168         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11169
11170 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11171
11172         * incremental.cc (Incremental_inputs_header_data): Renamed from
11173         Incremental_input_header_data.
11174         (Incremental_inputs_header_data::data_size): New field.
11175         (Incremental_inputs_header_data::put_input_file_count): Renamed
11176         from input_file_count.
11177         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11178         from command_line_offset.
11179         (Incremental_inputs_header_data::put_reserved): Renamed from
11180         put_reserved.
11181         (Incremental_inputs_entry_data): Renamed from
11182         Incremental_input_entry_data.
11183         (Incremental_inputs_entry_data::data_size): New field.
11184         (Incremental_inputs::report_command_line): New method.
11185         (Incremental_inputs::finalize): New method.
11186         (Incremental_inputs::create_incremental_inputs_data): New method.
11187         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11188         * incremental.h: New file.
11189         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11190         (Layout::finalize): Create incremental inputs section in
11191         incremental builds.
11192         (Layout::create_incremental_info_sections): New method.
11193         * layout.h (Layout::incremental_inputs): New method.
11194         (Layout::create_incremental_info_sections): New method.
11195         (Layout::incremental_inputs_): New field.
11196         * main.cc (main): Notify Incremental_input of the command line.
11197
11198 2009-04-01  Ian Lance Taylor  <iant@google.com>
11199             Mikolaj Zalewski  <mikolajz@google.com>
11200
11201         * gold.h (reserve_unordered_map): Define, three versions, one for
11202         each version of Unordered_map.
11203         * layout.cc (Layout::Layout): Remove options parameter.  Add
11204         number_of_input_files parameter.  Don't initialize options_.
11205         Initialize number_of_input_files_ and resized_signatures_.  Move
11206         sections_are_attached_.
11207         (Layout::layout_group): Reserve space for group_signatures_.
11208         (Layout::find_or_add_kept_section): Change name parameter to be a
11209         reference.  Resize signatures_ map when it gets large enough.
11210         (Layout::layout_eh_frame): Use parameters->options() instead of
11211         this->options_.
11212         (Layout::make_output_section): Likewise.
11213         (Layout::attach_allocated_section_to_segment): Likewise.
11214         (Layout::finalize, Layout::create_executable_stack): Likewise.
11215         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11216         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11217         * layout.h (class Layout): Update declarations.  Remove options_
11218         field.  Add number_of_input_files_ and resized_signatures_
11219         fields.  Move sections_are_attached_ field.
11220         * main.cc (main): Pass number of input files to Layout
11221         constructor.  Don't pass options.
11222
11223 2009-03-30  Ian Lance Taylor  <iant@google.com>
11224
11225         * ffsll.c (ffsll): Correct implementation.
11226
11227 2009-03-27  Ian Lance Taylor  <iant@google.com>
11228
11229         * ffsll.c: New file.
11230         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11231         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11232         * ftruncate.c (ftruncate): Declare before definition.
11233         * mremap.c (mremap): Likewise.
11234         * pread.c (pread): Likewise.
11235         * configure, Makefile.in, config.in: Rebuild.
11236
11237         * mremap.c: New file.
11238         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11239         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11240         (mremap): Declare if HAVE_MREMAP is not defined.
11241         * configure, Makefile.in, config.in: Rebuild.
11242
11243 2009-03-27  Cary Coutant  <ccoutant@google.com>
11244
11245         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11246         position independent.
11247         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11248         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11249
11250 2009-03-24  Cary Coutant  <ccoutant@google.com>
11251
11252         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11253         an executable.
11254         (needs_dynamic_reloc): Likewise.
11255
11256 2009-03-24  Ian Lance Taylor  <iant@google.com>
11257
11258         * yyscript.y (file_cmd): Recognize EXTERN.
11259         (extern_name_list, extern_name_list_body): New nonterminals.
11260         * script.cc (script_add_extern): Define.
11261         * script-c.h (script_add_extern): Declare.
11262
11263 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11264
11265         * object.cc (is_elf_object): Define.
11266         * object.h (is_elf_object): Declare.
11267         * archive.cc (Archive::get_elf_object_for_member): Call
11268         is_elf_object.
11269         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11270
11271 2009-03-24  Elliott Hughes  <enh@google.com>
11272
11273         * output.cc (Output_file::map_anonymous): Define.
11274         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11275         try an anonymous one.  Report the size if the mmap fails.
11276         * output.h (class Output_file): Declare map_anonymous.
11277
11278 2009-03-24  Ian Lance Taylor  <iant@google.com>
11279
11280         * target-select.cc (instantiate_target): Don't acquire the lock if
11281         the instantiated_target_ field has already been set.
11282
11283 2009-03-23  Ian Lance Taylor  <iant@google.com>
11284
11285         * gold-threads.h (class Initialize_lock): Define.
11286         * gold-threads.cc (class Initialize_lock_once): Define.
11287         (initialize_lock_control): New static variable.
11288         (initialize_lock_pointer): New static variable.
11289         (initialize_lock_once): New static function.
11290         (Initialize_lock::Initialize_lock): Define.
11291         (Initialize_lock::initialize): Define.
11292         * target-select.h: Include "gold-threads.h".
11293         (class Target_selector): Add lock_ and initialize_lock_ fields.
11294         Don't define instantiate_target, just declare it.
11295         * target-select.cc (Target_selector::Target_selector): Initialize
11296         new fields.
11297         (Target_selector::instantiate_target): Define.
11298         * descriptors.h: Include "gold-threads.h".
11299         (class Descriptors): Add initialize_lock_ field.
11300         * descriptors.cc (Descriptors::Descriptors): Initialize new
11301         field.
11302         (Descriptors::open): Use initialize_lock_ field
11303         * errors.h (class Errors): Add initialize_lock_ field.
11304         * errors.cc (Errors::Errors): Initialize new field.
11305         (Errors::initialize_lock): Use initialize_lock_ field.
11306         * powerpc.cc (class Target_selector_powerpc): Remove
11307         instantiated_target_ field.  In do_recognize call
11308         instantiate_target rather than do_instantiate_target.  In
11309         do_instantiate_target just allocate a new target.
11310         * sparc.cc (class Target_selector_sparc): Likewise.
11311
11312         * freebsd.h: New file.
11313         * i386.cc: Include "freebsd.h".
11314         (Target_i386): Derive from Target_freebsd rather than
11315         Sized_target.
11316         (Target_selector_i386): Derive from Target_selector_freebsd rather
11317         than Target_selector.
11318         * x86_64.cc: Include "freebsd.h".
11319         (Target_x86_64): Derive from Target_freebsd rather than
11320         Sized_target.
11321         (Target_selector_x86_64): Derive from Target_selector_freebsd
11322         rather than Target_selector.
11323         * target.h (class Target): Add adjust_elf_header and
11324         do_adjust_elf_header.
11325         * output.cc (Output_file_header:: do_sized_write): Call target
11326         adjust_elf_header routine.
11327         * configure.tgt: Set targ_osabi.
11328         * configure.ac: Define GOLD_DEFAULT_OSABI.
11329         * parameters.cc (Parameters::default_target): Pass
11330         GOLD_DEFAULT_OSABI to select_target.
11331         * target-select.h (class Target_selector): Make instantiate_target
11332         protected rather than private.
11333         * Makefile.am (HFILES): Add freebsd.h.
11334         * configure, Makefile.in, config.in: Rebuild.
11335
11336         * merge.cc (do_add_input_section): Correct pend value.  Change
11337         message about last entry not being null terminated from error to
11338         warning.
11339
11340 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11341
11342         * incremental.cc: New file.
11343         * Makefile.am (CCFILES): Add incremental.cc.
11344         * Makefile.in: Rebuild.
11345
11346 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11347
11348         * layout.cc (Layout::output_section_name): Preserve names
11349         of '.note.' sections.
11350
11351 2009-03-19  Ian Lance Taylor  <iant@google.com>
11352
11353         * descriptors.cc (Descriptors::open): Check that the options are
11354         valid before using them.
11355
11356 2009-03-18  Ian Lance Taylor  <iant@google.com>
11357
11358         * script-sections.h: Include <list>.
11359         (class Script_sections): Change Sections_elements from std::vector
11360         to std::list.  Typedef public Elements_iterator.  Add
11361         orphan_section_placement_, data_segment_align_start_, and
11362         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11363         field.
11364         * script-sections.cc (class Orphan_section_placement): New class.
11365         (class Sections_element): Add virtual functions is_relro and
11366         orphan_section_init.  Remove virtual function place_orphan_here.
11367         (class Output_section_definition): Add is_relro and
11368         orphan_section_init.  Remove place_orphan_here.
11369         (class Orphan_output_section): Likewise.
11370         (Script_sections::Script_sections): Update for field changes.
11371         (Script_sections::data_segment_align): Set saw_data_segment_align_
11372         and data_segment_align_start_, not data_segment_align_index.
11373         (Script_sections::data_segment_relro_end): Check
11374         saw_data_segment_align_.  Use data_segment_align_start_ rather
11375         than data_segment_align_index_.
11376         (Script_sections::place_orphan): Rewrite to use
11377         Orphan_section_placement.
11378
11379 2009-03-17  Ian Lance Taylor  <iant@google.com>
11380
11381         * archive.cc (Archive::add_symbols): Check for a version attached
11382         to the symbol name in the archive map.
11383         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11384         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11385         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11386         (ver_test_11.a): New target.
11387         * testsuite/Makefile.in: Rebuild.
11388
11389         * configure.ac: Check for chsize and posix_fallocate.  Replace
11390         ftruncate.
11391         * ftruncate.c: New file, from gnulib.
11392         * output.cc (posix_fallocate): Define dummy version if not
11393         HAVE_POSIX_FALLOCATE.
11394         (Output_file::map): Call posix_fallocate rather than lseek and
11395         write.
11396         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11397         * configure, Makefile.in, config.in: Rebuild.
11398
11399 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11400
11401         * layout.h (Layout::create_note): Add section_name parameter.
11402         * layout.cc (Layout::create_note): Likewise.
11403         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11404
11405 2009-03-17  Ian Lance Taylor  <iant@google.com>
11406
11407         * descriptors.cc: Include "options.h".
11408         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11409         (Descriptors::open): Always use O_CLOEXEC when opening a new
11410         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11411         then set FD_CLOEXEC.
11412
11413         * sparc.cc (class Target_sparc): Add has_got_section.
11414         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11415         make sure we have a GOT section.
11416
11417         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11418         (Target_sparc::Scan::local): Likewise.
11419         (Target_sparc::Scan::global): Likewise.
11420         (Target_sparc::Relocate::relocate): Likewise.
11421         (Target_sparc::Relocate::relocate_tls): Likewise.
11422
11423         * symtab.cc (Symbol_table::define_default_version): New function,
11424         broken out of add_from_object.
11425         (Symbol_table::add_from_object): Call define_default_version.
11426         (Symbol_table::define_special_symbol): Add resolve_oldsym
11427         parameter.  Change all callers.  If the version for a symbol comes
11428         from a version script, resolve it with the symbol with the same
11429         name with no version.  Also add the symbol without a version if
11430         appropriate.
11431         (do_define_in_output_data): If resolving with oldsym, don't delete
11432         sym.
11433         (do_define_in_output_segment): Likewise.
11434         (do_define_as_constant): Likewise.
11435         * symtab.h (class Symbol_table): Update declarations.
11436
11437 2009-03-13  Ian Lance Taylor  <iant@google.com>
11438
11439         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11440         (Read_symbols::requeue): New function.
11441         (Read_symbols::do_read_symbols): If make_elf_object fails because
11442         the target type is not configured, and the file was searched for,
11443         issue a warning and retry with the next directory.
11444         (Add_symbols::run): If the file has an incompatible format, and
11445         it was searched for, requeue the Read_symbols task.  On error,
11446         release the object.
11447         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11448         dirindex parameter to constructor.  Change all callers.  Declare
11449         incompatible_warning and requeue.
11450         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11451         input_argument_ and input_group_ fields.  Add them to
11452         constructor.  Change all callers.
11453         (class Read_script): Add dirindex_ field.  Add it to constructor.
11454         Change all callers.
11455         * archive.cc (Archive::setup): Remove input_objects parameter.
11456         Change all callers.
11457         (Archive::get_file_and_offset): Likewise.
11458         (Archive::read_all_symbols): Likewise.
11459         (Archive::read_symbols): Likewise.
11460         (Archive::get_elf_object_for_member): Remove input_objects
11461         parameter.  Add punconfigured parameter.  Change all callers.
11462         (Archive::add_symbols): Change return type to bool.  Check return
11463         value of include_member.
11464         (Archive::include_all_members): Likewise.
11465         (Archive::include_member): Change return type to bool.  Return
11466         false if first included object has incompatible target.  Set
11467         included_member_ field.
11468         (Add_archive_symbols::run): If add_symbols returns false, requeue
11469         Read_symbols task.
11470         * archive.h (class Archive): Add included_member_ field.
11471         Initialize it in constructor.  Add input_file and searched_for
11472         methods.  Update declarations.
11473         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11474         input_argument_ fields.  Add them to constructor.  Change all
11475         callers.
11476         * script.cc: Include "target-select.h".
11477         (class Parser_closure): Add skip_on_incompatible_target_ and
11478         found_incompatible_target_ fields.  Add
11479         skip_on_incompatible_target parameter to constructor.  Change all
11480         callers.  Add methods skip_on_incompatible_target,
11481         clear_skip_on_incompatible_target, found_incompatible_target, and
11482         set_found_incompatible_target.
11483         (read_input_script): Add dirindex parameter.  Change all callers.
11484         If parser finds an incompatible target, requeue Read_symbols
11485         task.
11486         (script_set_symbol): Clear skip_on_incompatible_target in
11487         closure.
11488         (script_add_assertion, script_parse_option): Likewise.
11489         (script_start_sections, script_add_phdr): Likewise.
11490         (script_check_output_format): New function.
11491         * script.h (read_input_script): Update declaration.
11492         * script-c.h (script_check_output_format): Declare.
11493         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11494         (ignore_cmd): Remove OUTPUT_FORMAT.
11495         * fileread.cc (Input_file::Input_file): Add explicit this.
11496         (Input_file::will_search_for): New function.
11497         (Input_file::open): Add pindex parameter.  Change all callers.
11498         * fileread.h (class Input_file): Add input_file_argument method.
11499         Declare will_search_for.  Update declarations.
11500         * object.cc (make_elf_object): Add punconfigured parameter.
11501         Change all callers.
11502         * object.h (class Object): Make input_file public.  Add
11503         searched_for method.
11504         (make_elf_object): Update declaration.
11505         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11506         restart search.
11507         * dirsearch.h (class Dirsearch): Update declaration.
11508         * options.h (class General_options): Add --warn-search-mismatch.
11509         * parameters.cc (Parameters::is_compatible_target): New function.
11510         * parameters.h (class Parameters): Declare is_compatible_target.
11511         * workqueue.cc (Workqueue::add_blocker): New function.
11512         * workqueue.h (class Workqueue): Declare add_blocker.
11513
11514         * fileread.cc (Input_file::open): Remove options parameter.
11515         Change all callers.
11516         (Input_file::open_binary): Likewise.
11517         * script.cc (read_input_script): Likewise.
11518         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11519         options parameter from constructor.  Change all callers.
11520         (class Read_script): Likewise.
11521         * fileread.h (class Input_file): Update declarations.
11522         * script.h (read_input_script): Update declaration.
11523
11524 2009-03-10  Nick Clifton  <nickc@redhat.com>
11525
11526         * po/es.po: New Spanish translation.
11527
11528 2009-03-06  Cary Coutant  <ccoutant@google.com>
11529
11530         * options.cc (parse_short_option): Keep dash_z from registering itself.
11531
11532 2009-03-03  Ian Lance Taylor  <iant@google.com>
11533
11534         PR 9918
11535         * target-reloc.h (relocate_section): Pass output_section to
11536         relocate.
11537         * i386.cc (Target_i386::should_apply_static_reloc): Add
11538         output_section parameter.  Change all callers.
11539         (Target_i386::Relocate::relocate): Add output_section parameter.
11540         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11541         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11542         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11543         * testsuite/two_file_shared.sh: New script.
11544         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11545         (check_DATA): Add two_file_shared.dbg.
11546         (two_file_shared.dbg): New target.
11547         * testsuite/Makefile.in: Rebuild.
11548
11549 2009-03-01  Ian Lance Taylor  <iant@google.com>
11550
11551         * configure.ac: Check for byteswap.h.
11552         * configure: Rebuild.
11553         * config.in: Rebuild.
11554
11555 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11556
11557         * layout.cc (Layout::find_or_add_kept_section): New function.
11558         (Layout::add_comdat): Removed.
11559         * layout.h (struct Kept_section): Move out of class Layout.
11560         Remove trailing underscores from field names.  Add group_sections
11561         field.  Rename group_ field to is_group.  Change all uses.
11562         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11563         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11564         comdat_groups_ field.
11565         (Sized_relobj::include_section_group): Use
11566         find_or_add_kept_section and Kept_section::group_sections.
11567         (Sized_relobj::include_linkonce_section): Likewise.
11568         * object.cc (class Sized_relobj): Don't define Comdat_group or
11569         Comdat_group_table.  Remove find_comdat_group and
11570         add_comdat_group.  Remove comdat_groups_ field.
11571         * plugin.cc (include_comdat_group): Use
11572         Layout::find_or_add_kept_section.
11573
11574 2009-02-28  Ian Lance Taylor  <iant@google.com>
11575
11576         * README: --gc-sections and map files are now supported.  Document
11577         some build requirements.
11578
11579         PR 6992
11580         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11581         relocatable link set the value of the section symbol to zero.
11582         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11583         relocatable link don't include the section address in the local
11584         symbol value.
11585
11586 2009-02-27  Ian Lance Taylor  <iant@google.com>
11587
11588         PR 6811
11589         * options.h (class Search_directory): Add is_system_directory.
11590         (class General_options): Declare is_in_system_directory.
11591         * options.cc (get_relative_sysroot): Make static.
11592         (get_default_sysroot): Make static.
11593         (General_optoins::is_in_system_directory): New function.
11594         * fileread.cc (Input_file::is_in_system_directory): New function.
11595         * fileread.h (class Input_file): Declare is_in_system_directory.
11596         * object.h (class Object): Add is_in_system_directory.
11597         (class Input_objects): Remove system_library_directory_ field.
11598         * object.cc (Input_objects::add_object): Don't set
11599         system_library_directory_.
11600         (input_objects::found_in_system_library_directory): Remove.
11601         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11602         parameter.  Change all callers.
11603         (Symbol_table::sized_write_globals): Likewise.
11604         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11605         Call Object::is_in_system_directory.
11606         * symtab.h (class Symbol_table): Update declarations.
11607
11608         PR 5990
11609         * descriptors.h (Open_descriptor): Add is_on_stack field.
11610         * descriptors.cc (Descriptors::open): If the descriptor is on the
11611         top of the stack, remove it.  Initialize is_on_stack field.
11612         (Descriptors::release): Only add pod to stack if it is not on the
11613         stack already.
11614         (Descriptors::close_some_descriptor): Clear stack_next and
11615         is_on_stack fields.
11616
11617         PR 7091
11618         * output.cc (Output_section::find_starting_output_address): Rename
11619         from starting_output_address; add PADDR parameter; change return
11620         type.
11621         * output.h (class Output_section): Declare
11622         find_starting_output_address instead of starting_output_address.
11623         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11624         section symbol for which we can't find a merge section.
11625
11626         PR 9836
11627         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11628         hidden or internal, force the symbol to be local.
11629         * resolve.cc (Symbol::override_visibility): Define.
11630         (Symbol::override_base): Use override_visibility.
11631         (Symbol_table::resolve): Likewise.
11632         (Symbol::override_base_with_special): Likewise.
11633         (Symbol_table::override_with_special): If the visibility is hidden
11634         or internal, force the symbol to be local.
11635         * symtab.h (class Symbol): Add set_visibility and
11636         override_visibility.
11637         * testsuite/ver_test_1.sh: New file.
11638         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11639         (check_DATA): Add ver_test_1.syms.
11640         (ver_test_1.syms): New target.
11641         * testsuite/Makefile.in: Rebuild.
11642
11643 2009-02-25  Cary Coutant  <ccoutant@google.com>
11644
11645         * layout.cc (Layout::choose_output_section): Don't rename sections
11646         when using a linker script that has a SECTIONS clause.
11647         * Makefile.in: Regenerate.
11648
11649         * testsuite/Makefile.am (script_test_5.sh): New test case.
11650         * testsuite/Makefile.in: Regenerate.
11651         * testsuite/script_test_5.cc: New file.
11652         * testsuite/script_test_5.sh: New file.
11653         * testsuite/script_test_5.t: New file.
11654
11655 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11656
11657         * archive.cc (Archive::include_member): Update calls to add_symbols.
11658         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11659         the Layout argument.
11660         * dynobj.h (do_add_symbols): Add the Layout argument.
11661         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11662         Layout argument.
11663         * object.h (Object::add_symbols): Add the Layout argument.
11664         (Object::do_add_symbols): Add the Layout argument.
11665         (Sized_relobj::do_add_symbols): Add the Layout argument.
11666         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11667         Unify the two versions.
11668         (Add_plugin_symbols): Remove.
11669         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11670         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11671         (Add_plugin_symbols): Remove.
11672         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11673         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11674         (Add_symbols::run): Make it work with Pulginobj.
11675
11676 2009-02-06  Ian Lance Taylor  <iant@google.com>
11677
11678         * object.cc (Sized_relobj::do_layout): Make info message start
11679         with lower case letter.
11680
11681 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11682
11683         * binary.cc: Fix file comment.
11684
11685         * options.h (enum Incremental_disposition): Define.
11686         (class General_options): Add new options: --incremental,
11687         --incremental_changed, --incremental_unchanged,
11688         --incremental_unknown.  Add incremental_disposition_ and
11689         implicit_incremental_ fields.
11690         (General_options::incremental_disposition): New function.
11691         (class Position_dependent_options): Add incremental_disposition
11692         option.
11693         (Position_dependent_options::copy_from_options): Set incremental
11694         dispositions.
11695         * options.cc (General_options::parse_incremental_changed): New
11696         function.
11697         (General_options::parse_incremental_unchanged): New function.
11698         (General_options::parse_incremental_unknown): New function.
11699         (General_options::General_options): Initialize new fields
11700         incremental_disposition_ and implicit_incremental_.
11701         (General_options::finalize): Check for uasge of --incremental-*
11702         without --incremental.
11703
11704 2009-02-06  Chris Demetriou  <cgd@google.com>
11705
11706         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11707         pointer and to report location as the file name associated with
11708         the symbol.
11709         (gold_undefined_symbol_at_location): New function to replace the
11710         old gold_undefined_symbol functionality.
11711         * target-reloc.h (relocate_section): Update to use
11712         gold_undefined_symbol_at_location.
11713         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11714         Call gold_undefined_symbol function rather than gold_error.
11715         * errors.h (Errors::undefined_symbol): Take location as a
11716         string, rather than calculating it from a relocation.
11717         * errors.cc (Errors::fatal): Print "fatal error:" before the
11718         formatted message.
11719         (Errors::error, Errors::error_at_location): Print "error: "
11720         before the formatted message.
11721         (Errors::undefined_symbol): Take location as a string, rather
11722         than calculating it from a relocation.
11723         (gold_undefined_symbol_at_location): New function akin to
11724         old gold_undefined_symbol, calculates location from relocation.
11725         (gold_undefined_symbol): Change to take only a Symbol pointer
11726         and to report location as the file name associated with the symbol.
11727         * testsuite/debug_msg.sh: Update for changed error messages.
11728         * testsuite/undef_symbol.sh: Likewise.
11729
11730 2009-02-04  Duncan Sands  <baldrick@free.fr>
11731
11732         PR 9812
11733         * reduced_debug_output.h
11734         (Output_reduced_debug_abbrev_section::failed): Use format for
11735         gold_warning.
11736         (Output_reduced_debug_info_section::faild): Likewise.
11737
11738 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11739
11740         * script.cc (Lazy_demangler): New class.
11741         (Version_script_info::get_symbol_version_helper): Demangle a
11742         symbol only once.
11743
11744 2009-01-29  Cary Coutant  <ccoutant@google.com>
11745
11746         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11747         to __tls_get_addr.
11748         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11749
11750 2009-01-28  Ian Lance Taylor  <iant@google.com>
11751
11752         * version.cc (version_string): Bump to 1.9.
11753
11754         * gold.h: Include <cstring> and <stdint.h>.
11755         * version.cc: Include <cstdio>.
11756         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11757         warning.
11758         * reduced_debug_output.cc (insert_into_vector): Rename from
11759         Insert_into_vector; change all callers.  Use Swap_unaligned to
11760         avoid aliasing issue; remove union since it is unnecessary.
11761
11762 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11763
11764         * Makefile.am (CCFILES): Add gc.cc.
11765         (HFILES): Add gc.h.
11766         * Makefile.in: Regenerate.
11767         * gold.cc (Gc_runner): New class.
11768         (queue_initial_tasks): Call garbage collection related tasks
11769         when corresponding options are invoked.
11770         (queue_middle_gc_tasks): New function.
11771         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11772         processed early before laying out sections during garbage collection.
11773         * gold.h (queue_middle_gc_tasks): New function.
11774         (is_prefix_of): Move from "layout.cc".
11775         * i386.cc (Target_i386::gc_process_relocs): New function.
11776         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11777         * main.cc (main): Create object of class "Garbage_collection".
11778         * object.cc (Relobj::copy_symbols_data): New function.
11779         (Relobj::is_section_name_included): New function.
11780         (Sized_relobj::do_layout): Allow this function to be called twice
11781         during garbage collection and defer layout of section during the
11782         first call.
11783         * object.h (Relobj::get_symbols_data): New function.
11784         (Relobj::is_section_name_included): New function.
11785         (Relobj::copy_symbols_data): New function.
11786         (Relobj::set_symbols_data): New function.
11787         (Relobj::get_relocs_data): New function.
11788         (Relobj::set_relocs_data): New function.
11789         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11790         (Relobj::gc_process_relocs): New function.
11791         (Relobj::do_gc_process_relocs): New pure virtual function.
11792         (Relobj::sd_): New data member.
11793         (Sized_relobj::is_output_section_offset_invalid): New function.
11794         (Sized_relobj::do_gc_process_relocs): New function.
11795         * options.h (General_options::gc_sections): Modify to not be a no-op.
11796         (General_options::print_gc_sections): New option.
11797         * plugin.cc (Plugin_finish::run): Remove function call to
11798         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11799         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11800         * reloc.cc (Read_relocs::run): Add task to process relocs and
11801         determine unreferenced sections when doing garbage collection.
11802         (Gc_process_relocs): New class.
11803         (Sized_relobj::do_gc_process_relocs): New function.
11804         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11805         sections that are garbage collected.
11806         * reloc.h (Gc_process_relocs): New class.
11807         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11808         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11809         symbols whose corresponding sections are garbage collected.
11810         (Symbol_table::Symbol_table): Add new parameter for the garbage
11811         collection object.
11812         (Symbol_table::gc_mark_undef_symbols): New function.
11813         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11814         (Symbol_table::gc_mark_dyn_syms): New function.
11815         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11816         as garbage.
11817         (Symbol_table::add_from_object): Likewise.
11818         (Symbol_table::add_from_relobj): When building shared objects, do not
11819         treat externally visible symbols as garbage.
11820         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11821         table information for static and relocatable links.
11822         * symtab.h (Symbol_table::set_gc): New function.
11823         (Symbol_table::gc): New function.
11824         (Symbol_table::gc_mark_undef_symbols): New function.
11825         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11826         (Symbol_table::gc_mark_dyn_syms): New function.
11827         (Symbol_table::gc_): New data member.
11828         * target.h (Sized_target::gc_process_relocs): New pure virtual
11829         function.
11830         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11831         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11832
11833 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11834
11835         * options.h (General_options::gc_sections): Define as a no-op for now.
11836         (General_options::no_keep_memory): Ditto.
11837         (General_options::Bshareable): Define.
11838         * options.cc (General_options::finalize): Honor -Bshareable.
11839
11840 2009-01-20  Andreas Schwab  <schwab@suse.de>
11841
11842         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11843         read the value in the contents, since we don't use it.  Use the
11844         template endianness when writing.
11845         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11846
11847 2009-01-19  Andreas Schwab  <schwab@suse.de>
11848
11849         * configure.tgt (powerpc64-*): Fix targ_obj.
11850
11851 2009-01-15  Ian Lance Taylor  <iant@google.com>
11852
11853         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11854         local symbols when stripping all symbols.
11855
11856 2009-01-14  Cary Coutant  <ccoutant@google.com>
11857
11858         * output.cc (Output_reloc): Add explicit instantiations.
11859
11860 2009-01-14  Cary Coutant  <ccoutant@google.com>
11861
11862         * archive.cc (Archive::get_elf_object_for_member): Remove call
11863         to File_read::claim_for_plugin.
11864         * descriptors.cc (Descriptors::open): Remove reference to
11865         is_claimed.
11866         (Descriptors::claim_for_plugin): Remove.
11867         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11868         (Descriptors::is_claimed): Remove.
11869         (claim_descriptor_for_plugin): Remove.
11870         * fileread.cc (File_read::claim_for_plugin): Remove.
11871         * fileread.h (File_read::claim_for_plugin): Remove.
11872         (File_read::descriptor): Reopen descriptor if necessary.
11873         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11874         (Plugin_manager::all_symbols_read): Add task parameter. Change
11875         all callers.
11876         (Plugin_manager::get_input_file): New function.
11877         (Plugin_manager::release_input_file): New function.
11878         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11879         corresponding data member.
11880         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11881         and pass to base constructor. Change all callers.
11882         (get_input_file, release_input_file): New functions.
11883         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11884         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11885         (Plugin_manager::all_symbols_read): Add task parameter.
11886         (Plugin_manager::get_input_file): New function.
11887         (Plugin_manager::release_input_file): New function.
11888         (Plugin_manager::task_): New data member.
11889         (Pluginobj::Pluginobj): Add filesize parameter.
11890         (Pluginobj::filename): New function.
11891         (Pluginobj::descriptor): New function.
11892         (Pluginobj::filesize): New function.
11893         (Pluginobj::filesize_): New data member.
11894         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11895         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11896         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11897
11898         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11899         with archive libraries.
11900         * testsuite/Makefile.in: Regenerate.
11901         * testsuite/plugin_test.c (struct sym_info): New type.
11902         (get_input_file, release_input_file): New static variables.
11903         (onload): Capture new transfer vector entries.
11904         (claim_file_hook): Stop reading at end of file according to filesize.
11905         Factor out parsing of readelf output into separate function.
11906         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11907         APIs and get the source file name from the symbol table.  Convert
11908         source file name to corresponding object file name.  Print info
11909         message when adding new input files.
11910         (parse_readelf_line): New function.
11911         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11912         * testsuite/plugin_test_2.sh: Likewise.
11913         * testsuite/plugin_test_3.sh: Likewise.
11914         * testsuite/plugin_test_4.sh: New test case.
11915
11916 2009-01-07  Ian Lance Taylor  <iant@google.com>
11917
11918         * version.cc (version_string): Bump to 1.8.
11919
11920 2008-12-23  Cary Coutant  <ccoutant@google.com>
11921
11922         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11923         * plugin.cc (Plugin_manager::finish): Rename as
11924         layout_deferred_objects.  Move cleanup to separate function.
11925         (Plugin_manager::cleanup): New function.
11926         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11927         separately.
11928         * plugin.h (Plugin_manager::finish): Rename as
11929         layout_deferred_objects.
11930         (Plugin_manager::cleanup): New function.
11931         (Plugin_manager::cleanup_done): New field.
11932
11933 2008-12-23  Cary Coutant  <ccoutant@google.com>
11934
11935         * plugin.cc (is_visible_from_outside): New function.
11936         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11937         so we don't return "IR only" status for exported symbols or -r links.
11938
11939         * testsuite/Makefile.am (plugin_test_3): New test case.
11940         * testsuite/Makefile.in: Regenerate.
11941         * testsuite/plugin_test_3.sh: New file.
11942
11943 2008-12-22  Cary Coutant  <ccoutant@google.com>
11944
11945         * object.cc (Sized_relobj::layout_section): New function.
11946         (Sized_relobj::do_layout): Defer layout of input sections until after
11947         plugin has provided replacement files.
11948         (Sized_relobj::do_layout_deferred_sections): New function.
11949         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11950         (Relobj::layout_deferred_sections): New function.
11951         (Relobj::do_layout_deferred_sections): New function.
11952         (Sized_relobj::do_layout_deferred_sections): New function.
11953         (Sized_relobj::layout_section): New function.
11954         (Sized_relobj::Deferred_layout): New structure.
11955         (Sized_relobj::deferred_layout_): New field.
11956         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11957         Change all callers.  Layout deferred sections.
11958         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11959         references.
11960         (Plugin_hook::run): Move code from do_plugin_hook inline.
11961         (Plugin_hook::do_plugin_hook): Remove.
11962         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11963         (Plugin_manager::finish): Renamed, was cleanup.
11964         (Plugin_manager::should_defer_layout): New function.
11965         (Plugin_manager::add_deferred_layout_object): New function.
11966         (Plugin_manager::Deferred_layout_list): New type.
11967         (Plugin_manager::deferred_layout_objects_): New field.
11968         (Plugin_hook::do_plugin_hook): Remove.
11969
11970 2008-12-17  Ian Lance Taylor  <iant@google.com>
11971
11972         * options.h (class General_options): Add --no case for
11973         --export-dynamic.
11974
11975 2008-12-16  Cary Coutant  <ccoutant@google.com>
11976
11977         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11978         vector.
11979         (Plugin_manager::claim_file): Create plugin object even if
11980         plugin did not call the add_symbols callback.
11981         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11982         asking for more symbols than were added.
11983         * testsuite/Makefile.am (plugin_test_1): Add test case with
11984         no global symbols.
11985         (empty.syms): New target.
11986         * testsuite/Makefile.in: Regenerate.
11987         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11988         message. Don't call add_symbols if no globals.
11989         (all_symbols_read_hook): Don't provide replacement for empty
11990         claimed file.
11991
11992 2008-12-12  Ian Lance Taylor  <iant@google.com>
11993
11994         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11995         r_type == 0 for a local symbol with r_sym == 0.
11996         (scan_relocatable_relocs): Pass r_sym to
11997         local_non_section_strategy.
11998         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11999         r_sym parameter.
12000
12001         * configure.ac: Update test for TLS descriptors: they are
12002         supported as of glibc 2.9.
12003         * configure: Rebuild.
12004
12005 2008-12-11  Ian Lance Taylor  <iant@google.com>
12006
12007         PR 7091
12008         * target-reloc.h (Default_scan_relocatable_relocs): For each
12009         function, map r_type == 0 to RELOC_DISCARD.
12010
12011 2008-12-10  Cary Coutant  <ccoutant@google.com>
12012
12013         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12014         object to override a kept COMDAT group from a plugin object.
12015
12016 2008-12-09  Ian Lance Taylor  <iant@google.com>
12017
12018         PR 7088
12019         * yyscript.y (file_cmd): Handle INPUT.
12020
12021         * testsuite/initpri1.c: Change all declarations to be full
12022         prototypes by adding void, to avoid compiler warnings.
12023
12024 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12025
12026         * options.cc (General_options::parse_plugin_opt): New.
12027         (General_options::add_plugin): The argument now is just the filename.
12028         (General_options::add_plugin_option): New.
12029         * options.h (plugin_opt): New.
12030         (add_plugin): Change argument name.
12031         (add_plugin_option): New.
12032         * plugin.cc (Plugin::load): Don't parse the plugin option.
12033         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12034         (Plugin::add_option): New.
12035         (Plugin::args_): Change type.
12036         (Plugin::filename_): New.
12037         (Plugin_manager::add_plugin_option): New.
12038         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12039         * testsuite/Makefile.in: Regenerate.
12040
12041 2008-12-05  Cary Coutant  <ccoutant@google.com>
12042
12043         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12044         Handle --strip-lto-sections option.
12045         * options.h (strip_lto_sections): New option.
12046
12047 2008-12-01  Cary Coutant  <ccoutant@google.com>
12048
12049         * plugin.cc (ld_plugin_message): Change format parameter to const.
12050         Fix mismatch between new[] and delete.
12051
12052 2008-11-14  Cary Coutant  <ccoutant@google.com>
12053
12054         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12055         instead of -1U.
12056
12057 2008-11-05  Craig Silverstein  <csilvers@google.com>
12058
12059         * options.cc (General_options::parse_dynamic_list): New function.
12060         * options.h (General_options): New flags dynamic_list,
12061         dynamic_list_data, dynamic_list_cpp_new, and
12062         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12063         (General_options::in_dynamic_list): New function.
12064         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12065         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12066         (Lex::can_continue_name): Likewise.
12067         (yylex): Likewise.
12068         (read_script_file): New parameter script_options.
12069         (read_dynamic_list): New function.
12070         (Script_options::define_dynamic_list): New function.
12071         (dynamic_list_keyword_parsecodes): New variable.
12072         (dynamic_list_keywords): New variable.
12073         * script.h (Script_options::define_dynamic_list): New function
12074         prototype.
12075         (read_dynamic_list): New function prototype.
12076         * symtab.cc (strprefix): New macro.
12077         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12078         dynamic_list_data, dynamic_list_cpp_new, and
12079         dynamic_list_cpp_typeinfo.
12080         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12081         (dynamic_list_expr): New rule.
12082         (dynamic_list_nodes): Likewise.
12083         (dynamic_list_node): Likewise.
12084         * testsuite/Makefile.am (dynamic_list): New test.
12085         * testsuite/Makefile.in: Regenerated.
12086         * testsuite/dynamic_list.t: New file.
12087         * testsuite/dynamic_list.sh: New file.
12088
12089 2008-11-05  Craig Silverstein  <csilvers@google.com>
12090
12091         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12092         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12093         (t11_last): Likewise.
12094         * testsuite/ver_test_6.c (main): Likewise.
12095
12096 2008-10-07  Cary Coutant  <ccoutant@google.com>
12097
12098         * options.c (General_options::finalize): Add check for -static and
12099         -shared.
12100         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12101         is not empty.
12102
12103 2008-10-02  Cary Coutant  <ccoutant@google.com>
12104
12105         * plugin.cc (make_sized_plugin_object): Fix conditional
12106         compilation to work when not all targets are enabled.
12107
12108 2008-09-29  Cary Coutant  <ccoutant@google.com>
12109
12110         * archive.cc (Archive::get_file_and_offset): Use filename instead
12111         of name to get library path.
12112         (Archive::include_member): Unlock external member of a thin archive.
12113
12114         * testsuite/Makefile.am (TEST_AR): New variable.
12115         (thin_archive_test_1): New test.
12116         (thin_archive_test_2): New test.
12117         * testsuite/Makefile.in: Regenerate.
12118         * testsuite/thin_archive_main.cc: New file.
12119         * testsuite/thin_archive_test_1.cc: New file.
12120         * testsuite/thin_archive_test_2.cc: New file.
12121         * testsuite/thin_archive_test_3.cc: New file.
12122         * testsuite/thin_archive_test_4.cc: New file.
12123
12124 2008-09-29  Cary Coutant  <ccoutant@google.com>
12125
12126         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12127         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12128         instead of -1U.
12129         (Sized_relobj::do_finalize_local_symbols): Likewise.
12130         (Sized_relobj::map_to_kept_section): Likewise.
12131         * object.h (Sized_relobj::invalid_address): New constant.
12132         (Sized_relobj::do_output_section_offset): Check for invalid_address
12133         and return -1ULL.
12134         * output.cc (Output_reloc::local_section_offset): Use constant
12135         invalid_address instead of -1U.
12136         (Output_reloc::get_address): Likewise.
12137         (Output_section::output_address): Change -1U to -1ULL.
12138         * output.h (Output_reloc::invalid_address): New constant.
12139         * reloc.cc (Sized_relobj::write_sections): Use constant
12140         invalid_address instead of -1U.
12141         (Sized_relobj::relocate_sections): Likewise.
12142         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12143         values for merge sections.
12144         * target-reloc.h (relocate_for_relocatable): Use constant
12145         invalid_address instead of -1U.
12146
12147 2008-09-19  Cary Coutant  <ccoutant@google.com>
12148
12149         Add plugin functionality for link-time optimization (LTO).
12150         * configure.ac (plugins): Add --enable-plugins option.
12151         * configure: Regenerate.
12152         * config.in: Regenerate.
12153         * Makefile.am (LIBDL): New variable.
12154         (CCFILES): Add plugin.cc.
12155         (HFILES): Add plugin.h.
12156         (ldadd_var): Add LIBDL.
12157         * Makefile.in: Regenerate.
12158
12159         * archive.cc: Include "plugin.h".
12160         (Archive::setup): Don't preread archive symbols when using a plugin.
12161         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12162         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12163         files.
12164         (Archive::include_member): Add symbols from plugin objects.
12165         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12166         * descriptors.cc (Descriptors::open): Check for file descriptors
12167         abandoned by plugins.
12168         (Descriptors::claim_for_plugin): New function.
12169         * descriptors.h (Descriptors::claim_for_plugin): New function.
12170         (Open_descriptor::is_claimed): New field.
12171         (claim_descriptor_for_plugin): New function.
12172         * fileread.cc (File_read::claim_for_plugin): New function.
12173         * fileread.h (File_read::claim_for_plugin): New function.
12174         (File_read::descriptor): New function.
12175         * gold.cc: Include "plugin.h".
12176         (queue_initial_tasks): Add task to call plugin hooks for generating
12177         new object files.
12178         * main.cc: Include "plugin.h".
12179         (main): Load plugin libraries.
12180         * object.h (Pluginobj): Declare.
12181         (Object::pluginobj): New function.
12182         (Object::do_pluginobj): New function.
12183         (Object::set_target): New function.
12184         * options.cc: Include "plugin.h".
12185         (General_options::parse_plugin): New function.
12186         (General_options::General_options): Initialize plugins_ field.
12187         (General_options::add_plugin): New function.
12188         * options.h (Plugin_manager): Declare.
12189         (General_options): Add --plugin option.
12190         (General_options::has_plugins): New function.
12191         (General_options::plugins): New function.
12192         (General_options::add_plugin): New function.
12193         (General_options::plugins_): New field.
12194         * plugin.cc: New file.
12195         * plugin.h: New file.
12196         * readsyms.cc: Include "plugin.h".
12197         (Read_symbols::do_read_symbols): Check for archive before checking
12198         for ELF file.  Call plugin hooks to claim files.
12199         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12200         from a real object file; force override when processing replacement
12201         files.
12202         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12203         (Symbol::init_base_object): Likewise.
12204         (Symbol::init_base_output_data): Likewise.
12205         (Symbol::init_base_output_segment): Likewise.
12206         (Symbol::init_base_constant): Likewise.
12207         (Symbol::init_base_undefined): Likewise.
12208         (Symbol::output_section): Assert that object is not a plugin.
12209         (Symbol_table::add_from_pluginobj): New function.
12210         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12211         undefined.
12212         (Symbol_table::sized_write_globals): Likewise.
12213         (Symbol_table::add_from_pluginobj): Instantiate template.
12214         * symtab.h (Sized_pluginobj): Declare.
12215         (Symbol::in_real_elf): New function.
12216         (Symbol::set_in_real_elf): New function.
12217         (Symbol::in_real_elf_): New field.
12218         (Symbol_table::add_from_pluginobj): New function.
12219
12220         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12221         (LIBDL): New variable.
12222         (LDADD): Add LIBDL.
12223         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12224         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12225         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12226         (MOSTLYCLEANFILES): Likewise.
12227         * testsuite/Makefile.in: Regenerate.
12228         * testsuite/plugin_test.c: New file.
12229         * testsuite/plugin_test_1.sh: New file.
12230         * testsuite/plugin_test_2.sh: New file.
12231
12232 2008-09-16  Ian Lance Taylor  <iant@google.com>
12233
12234         * target-reloc.h (relocate_section): Check whether a symbol is
12235         defined by the ABI before reporting an undefined symbol error.
12236         * target.h (Target::is_defined_by_abi): Make parameter const.
12237         (Target::do_is_defined_by_abi): Likewise.
12238         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12239         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12240         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12241         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12242         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12243         * testsuite/Makefile.in: Rebuild.
12244
12245         * fileread.cc (make_view): Add casts to avoid warning.
12246
12247 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12248
12249         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12250         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12251
12252 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12253
12254         * options.h (General_options::output_is_executable): New.
12255         (General_options::output_is_pie): New.
12256         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12257         for shared libraries.
12258         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12259
12260 2008-09-11  Chris Demetriou  <cgd@google.com>
12261
12262         * options.h (origin): New -z option.
12263         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12264         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12265         in DT_FLAGS_1.
12266
12267 2008-09-05  Cary Coutant  <ccoutant@google.com>
12268
12269         * fileread.cc (File_read::make_view): Add check for attempt to map
12270         beyond end of file.
12271
12272 2008-09-05  Cary Coutant  <ccoutant@google.com>
12273
12274         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12275         explicit instantiations.
12276
12277 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12278
12279         PR gold/6858
12280         * options.cc (General_options::finalize): Allow undefined symbols
12281         in shlibs if linking -shared.
12282
12283         PR gold/6859
12284         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12285         symbols as not needing a dynsym entry.
12286
12287 2008-08-20  Craig Silverstein  <csilvers@google.com>
12288
12289         * fileread.cc (File_read::open): Do not lock the file unless it
12290         was successfully opened.
12291
12292 2008-08-14  Cary Coutant  <ccoutant@google.com>
12293
12294         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12295         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12296         * testsuite/tls_test.cc (struct int128): 128-bit struct
12297         for testing TLS relocs with non-zero addend.
12298         (v12): New TLS variable.
12299         (t12): New test.
12300         (t_last): Add check for v12.
12301         * testsuite/tls_test.h (t12): New function.
12302         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12303
12304 2008-08-13  Ian Lance Taylor  <iant@google.com>
12305
12306         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12307         set tls_segment_ or relro_segment_.
12308         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12309         when appropriate.
12310         * output.h (Output_section::clear_is_relro): New function.
12311         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12312         sections specially even when output_data_ is empty.
12313         (Output_segment::maximum_alignment): When first section is relro,
12314         only force alignment for PT_LOAD segments.
12315         * script.cc (script_data_segment_align): New function.
12316         (script_data_segment_relro_end): New function.
12317         * script-c.h (script_data_segment_align): Declare.
12318         (script_data_segment_relro_end): Declare.
12319         * script-sections.h (class Script_sections): Declare
12320         data_segment_align and data_segment_relro_end.  Add fields
12321         segment_align_index_ and saw_relro_end_.
12322         * script-sections.cc (class Sections_element): Add set_is_relro
12323         virtual function.  Add new bool* parameter to place_orphan_here.
12324         Add get_output_section virtual function.
12325         (class Output_section_definition): Add set_is_relro.  Add new
12326         bool* parameter to place_orphan_here.  Add get_output_section.
12327         Add is_relro_ field.
12328         (Output_section_definition::Output_section_definition): Initialize
12329         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12330         and is_relro_ fields.
12331         (Output_section_definition::place_orphan_here): Add is_relro
12332         parameter.
12333         (Output_section_definition::set_section_addresses): Set relro for
12334         output section.
12335         (Output_section_definition::alternate_constraint): Likewise.
12336         (class Orphan_output_section): Add new bool* parameter to
12337         place_orphan_here.  Add get_output_section.
12338         (Orphan_output_section::place_orphan_here): Add is_relro
12339         parameter.
12340         (Script_sections::Script_sections): Initialize
12341         data_segment_align_index_ and saw_relro_end_.
12342         (Script_sections::data_segment_align): New function.
12343         (Script_sections::data_segment_relro_end): New function.
12344         (Script_sections::place_orphan): Set or clear is_relro.
12345         (Script_sections::set_section_addresses): Force alignment of first
12346         TLS section.
12347         * yyscript.y (exp): Call script_data_segment_align and
12348         script_data_segment_relro_end.
12349         * testsuite/relro_script_test.t: New file.
12350         * testsuite/relro_test.cc (using_script): Declare.
12351         (t1, t2): Test using_script.
12352         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12353         (relro_script_test_SOURCES): Define.
12354         (relro_script_test_DEPENDENCIES): Define.
12355         (relro_script_test_LDFLAGS): Define.
12356         (relro_script_test_LDADD): Define.
12357         (relro_script_test.so): New target.
12358         * testsuite/Makefile.in: Rebuild.
12359
12360 2008-08-06  Cary Coutant <ccoutant@google.com>
12361
12362         * archive.cc (Archive::total_archives, Archive::total_members)
12363         (Archive::total_members_loaded): New variables.
12364         (Archive::setup): Add parameter.  Add option to preread
12365         archive symbols.
12366         (Archive::read_armap): Add counter.
12367         (Archive::get_file_and_offset): New function.
12368         (Archive::get_elf_object_for_member): New function.
12369         (Archive::read_all_symbols): New function.
12370         (Archive::read_symbols): New function.
12371         (Archive::add_symbols): Add counters.
12372         (Archive::include_all_members): Use armap to find members if it's
12373         already built.
12374         (Archive::include_member): Skip reading symbols if already read.
12375         Factored code into Archive::get_file_and_offset and
12376         Archive::get_elf_object_for_member.  Changed call to
12377         Mapfile::report_include_archive_member.
12378         (Archive::print_stats): New function.
12379         * archive.h: Declare Object and Read_symbols_data classes.
12380         (Archive::Archive): Add initializers for new members.
12381         (Archive::setup): Add parameter.
12382         (Archive::print_stats): New function.
12383         (Archive::total_archives, Archive::total_members)
12384         (Archive::total_members_loaded): New variables.
12385         (Archive::get_file_and_offset): New function.
12386         (Archive::get_elf_object_for_member): New function.
12387         (Archive::read_all_symbols): New function.
12388         (Archive::read_symbols): New function.
12389         (Archive::Archive_member): New class.
12390         (Archive::members_): New member.
12391         (Archive::num_members_): New member.
12392         * main.cc: Include archive.h.
12393         (main): Call Archive::print_stats.
12394         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12395         archive parameter; member_name is now the fully-decorated name.
12396         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12397         * options.h: (General_options): Add --preread-archive-symbols option.
12398         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12399         Archive::setup.
12400
12401 2008-08-04  Ian Lance Taylor  <iant@google.com>
12402
12403         * symtab.h (Symbol::use_plt_offset): New function.
12404         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12405         * powerpc.cc (Relocate::relocate): Likewise.
12406         * sparc.cc (Relocate::relocate): Likewise.
12407         * x86_64.cc (Relocate::relocate): Likewise.
12408         * testsuite/weak_plt.sh: New test.
12409         * testsuite/weak_plt_main.cc: New test.
12410         * testsuite/weak_plt_shared.cc: New test.
12411         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12412         (check_PROGRAMS): Add weak_plt.
12413         (check_DATA): Add weak_plt_shared.so.
12414         (weak_plt_main_pic.o, weak_plt): New targets.
12415         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12416         * testsuite/Makefile.in: Rebuild.
12417
12418         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12419         gcctestdir/ld.
12420         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12421         * testsuite/Makefile.in: Rebuild.
12422
12423 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12424
12425         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12426         * Makefile.in: Regenerate.
12427         * po/POTFILES.in: Regenerate.
12428
12429 2008-07-29  Ian Lance Taylor  <iant@google.com>
12430
12431         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12432         symbols before other symbols.
12433         * testsuite/script_test_2.cc (test_addr): Declare.
12434         (test_addr_alias): Declare.
12435         (main): Check that test_addr and test_addr_alias have the right
12436         values.
12437         * testsuite/script_test_2.t: Define test_addr_alias and
12438         test_addr.
12439
12440 2008-07-24  Ian Lance Taylor  <iant@google.com>
12441
12442         PR 5990
12443         * descriptors.cc: New file.
12444         * descriptors.h: New file.
12445         * gold-threads.h (class Hold_optional_lock): New class.
12446         * fileread.cc: Include "descriptors.h".
12447         (File_read::~File_read): Release descriptor rather than closing
12448         it.
12449         (File_read::open) [file]: Call open_descriptor rather than open.
12450         Set is_descriptor_opened_.
12451         (File_read::open) [memory]: Assert that descriptor is not open.
12452         (File_read::reopen_descriptor): New function.
12453         (File_read::release): Release descriptor.
12454         (File_read::do_read): Make non-const.  Reopen descriptor.
12455         (File_read::read): Make non-const.
12456         (File_read::make_view): Reopen descriptor.
12457         (File_read::do_readv): Likewise.
12458         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12459         Update declarations.
12460         * layout.cc: Include "descriptors.h".
12461         (Layout::create_build_id): Use open_descriptor rather than open.
12462         * output.cc: Include "descriptors.h".
12463         (Output_file::open): Use open_descriptor rather than open.
12464         * archive.cc (Archive::const_iterator): Change Archive to be
12465         non-const.
12466         (Archive::begin, Archive::end): Make non-const.
12467         (Archive::count_members): Likewise.
12468         * archive.h (class Archive): Update declarations.
12469         * object.h (Object::read): Make non-const.
12470         * Makefile.am (CCFILES): Add descriptors.cc.
12471         (HFILES): Add descriptors.h.
12472         * Makefile.in: Rebuild.
12473
12474         PR 6716
12475         * gold.h: Always include <clocale>.  Add Solaris workarounds
12476         following code in binutils/sysdep.h.
12477
12478         PR 6048
12479         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12480         this->eh_frame_hdr_ is NULL before using it.
12481
12482         * dynobj.cc (Versions::Versions): Update comment.
12483
12484         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12485         the base version name.
12486
12487         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12488         array size plus one.
12489         (Stringpool_template::set_string_offsets): Subtract one from key
12490         before using it as an array index.
12491         (Stringpool_template::get_offset_with_length): Likewise.
12492         (Stringpool_template::write_to_buffer): Likewise.
12493         * stringpool.h (Stringpool_template::get_offset_from_key):
12494         Likewise.
12495
12496 2008-07-23  Ian Lance Taylor  <iant@google.com>
12497
12498         PR 6658
12499         * object.h (Merged_symbol_value::value): Do our best to handle a
12500         negative addend.
12501
12502         PR 6647
12503         * script.cc (Version_script_info::get_versions): Don't add empty
12504         version tag to return value.
12505         (Version_script_info::get_symbol_version_helper): Change return
12506         type to bool.  Add pversion parameter.  Change all callers.
12507         (script_register_vers_node): Don't require a non-NULL tag.
12508         * script.h (class Version_script_info): Update declarations.
12509         (Version_script_info::get_symbol_version): Change return type to
12510         bool.  Add version parameter.  Change all callers.
12511         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12512         handling.  Handle an empty version from a version script.
12513         (Symbol_table::define_special_symbol): Likewise.
12514         * testsuite/ver_test_10.script: New file.
12515         * testsuite/ver_test_10.sh: New file.
12516         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12517         (check_DATA): Add ver_test_10.syms.
12518         (ver_test_10.syms, ver_test_10.so): New target.
12519         * testsuite/Makefile.in: Rebuild.
12520
12521 2008-07-23  Simon Baldwin  <simonb@google.com>
12522
12523         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12524         to zero for undefined symbols from dynamic libraries.
12525
12526 2008-07-23  Ian Lance Taylor  <iant@google.com>
12527
12528         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12529         Change all callers.
12530         * symtab.h (class Symbol_table): Update declaration.
12531         * testsuite/ver_test_9.cc: New file.
12532         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12533         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12534         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12535         (ver_test_9.so, ver_test_9.o): New targets.
12536         * testsuite/Makefile.in: Rebuild.
12537
12538 2008-07-22  Ian Lance Taylor  <iant@google.com>
12539
12540         * options.h (class General_options): Define --check-sections.
12541         * layout.cc (Layout::set_segment_offsets): Handle
12542         --check-sections.
12543
12544         * options.h (class General_options): Define -n/--nmagic and
12545         -N/--omagic.
12546         * options.cc (General_options::finalize): For -n/--nmagic or
12547         -N/--omagic, set -static.
12548         * layout.cc (Layout::attach_allocated_section_to_segment): If
12549         -N/--omagic, don't put read-only and read-write sections in
12550         different segments.
12551         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12552         finding a read-only segment.
12553         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12554         don't set the minimum segment alignment to the common page size,
12555         and don't set the file offset to the address modulo the page size.
12556         * script-sections.cc (Script_sections::create_segments): If
12557         -n/--omagic, don't put read-only and read-write sections in
12558         different segments.
12559
12560         * cref.cc: New file.
12561         * cref.h: New file.
12562         * options.h (class General_options): Add --print-symbol-counts.
12563         * main.cc (main): Issue defined symbol report if requested.
12564         * archive.cc (Archive::interpret_header): Make into a const member
12565         function.
12566         (Archive::add_symbols): Call Input_objects::archive_start and
12567         archive_stop.
12568         (Archive::const_iterator): Define new class.
12569         (Archive::begin, Archive::end): New functions.
12570         (Archive::include_all_members): Rewrite to use iterator.
12571         (Archive::count_members): New function.
12572         * archive.h (class Archive): Update declarations.
12573         (Archive::filename): New function.
12574         * object.cc: Include "cref.h".
12575         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12576         (Sized_relobj::do_get_global_symbol_counts): New function.
12577         (Input_objects::add_object): Add object to cross-referencer.
12578         (Input_objects::archive_start): New function.
12579         (Input_objects::archive_stop): New function.
12580         (Input_objects::print_symbol_counts): New function.
12581         * object.h: Declare Cref and Archive.
12582         (Object::get_global_symbol_counts): New function.
12583         (Object::do_get_global_symbol_counts): New pure virtual function.
12584         (class Sized_relobj): Add defined_count_ field.  Update
12585         declarations.
12586         (class Input_objects): Add cref_ field.  Update constructor.
12587         Update declarations.
12588         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12589         defined_count_.
12590         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12591         symbol counts.
12592         (Sized_dynobj::do_get_global_symbol_counts): New function.
12593         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12594         defined_count_.  Update declarations.  Define Symbols typedef.
12595         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12596         parameter.  Change all callers.
12597         (Symbol_table::add_from_dynobj): Add sympointers and defined
12598         parameters.  Change all callers.
12599         * symtab.h (class Symbol_table): Update declarations.
12600         * Makefile.am (CCFILES): Add cref.cc.
12601         (HFILES): Add cref.h.
12602         * Makefile.in: Rebuild.
12603
12604 2008-07-22  Simon Baldwin  <simonb@google.com>
12605
12606         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12607         to zero when writing undefined symbols.
12608
12609 2008-07-22  Ian Lance Taylor  <iant@google.com>
12610
12611         * output.cc (Output_section::add_input_section): Don't try to
12612         merge empty merge sections.
12613
12614 2008-07-21  Craig Silverstein  <csilvers@google.com>
12615
12616         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12617         Include symbol version in error message.
12618
12619 2008-07-20  Chris Demetriou  <cgd@google.com>
12620
12621         * configure.ac (gold_cv_c_random_seed): New configured variable.
12622         (RANDOM_SEED_CFLAGS): New substituted variable.
12623         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12624         * configure: Rebuild.
12625         * Makefile.in: Likewise.
12626         * testsuite/Makefile.in: Likewise.
12627
12628 2008-07-18  Ian Lance Taylor  <iant@google.com>
12629
12630         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12631         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12632         * testsuite/ver_test_main.cc (main): Call t4.
12633         (t4, t4_2a): Define.
12634         * testsuite/ver_test_2.cc (t4_2): Define.
12635         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12636         * testsuite/ver_test_4.cc (t4_2a): Define.
12637         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12638         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12639
12640 2008-07-17  Ian Lance Taylor  <iant@google.com>
12641
12642         * dynobj.cc (Versions::add_def): If we give an error about a
12643         missing version, go ahead and create the version anyhow.
12644
12645 2008-07-10  Ian Lance Taylor  <iant@google.com>
12646
12647         Handle output sections with more than 0x7fffffff bytes.
12648         * object.h (class Relobj): Change map_to_output_ to
12649         output_sections_, and just keep a section pointer.  Change all
12650         uses.  Move comdat group support to Sized_relobj.
12651         (Relobj::is_section_specially_mapped): Remove.
12652         (Relobj::output_section): Remove poff parameter.  Change all
12653         callers.
12654         (Relobj::output_section_offset): New function.
12655         (Relobj::set_section_offset): Rewrite.
12656         (Relobj::map_to_output): Remove.
12657         (Relobj::output_sections): New function.
12658         (Relobj::do_output_section_offset): New pure virtual function.
12659         (Relobj::do_set_section_offset): Likewise.
12660         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12661         group support from Relobj.  Update declarations.
12662         (Sized_relobj::get_output_section_offset): New function.
12663         (Sized_relobj::do_output_section_offset): New function.
12664         (Sized_relobj::do_set_section_offset): New function.
12665         * object.cc (Relobj::output_section_address): Remove.
12666         (Sized_relobj::Sized_relobj): Initialize new fields.
12667         (Sized_relobj::include_section_group): Cast find_kept_object to
12668         Sized_relobj.
12669         (Sized_relobj::include_linkonce_section): Likewise.
12670         (Sized_relobj::do_layout): Use separate arrays for output section
12671         and output offset.
12672         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12673         output_sections.
12674         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12675         output_sections and section_offsets.
12676         (Sized_relobj::write_local_symbols): Likewise.
12677         (map_to_kept_section): Compute output address directly.
12678         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12679         output_sections and section_offsets.
12680         (Sized_relobj::write_sections): Likewise.
12681         (Sized_relobj::relocate_sections): Likewise.
12682         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12683         * output.h (class Output_reloc): Update declarations.  Change
12684         u2_.relobj to Sized_relobj*.
12685         (class Output_data_reloc): Change add functions to use
12686         Sized_relobj*.
12687         * output.cc (Output_reloc::Output_reloc): Change relobj to
12688         Sized_relobj*.
12689         (Output_reloc::local_section_offset): Change return type to
12690         Elf_Addr.  Use get_output_section_offset.
12691         (Output_reloc::get_address): Likewise.
12692         (Output_section::is_input_address_mapped): Don't call
12693         is_section_specially_mapped.
12694         (Output_section::output_offset): Likewise.
12695         (Output_section::output_address): Likewise.
12696         (Output_section::starting_output_address): Likewise.
12697         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12698         parameter to Sized_relobj*.
12699         (Copy_relocs::need_copy_reloc): Likewise.
12700         (Copy_relocs::save): Likewise.
12701         * copy-relocs.h (class Copy_relocs): Update declarations.
12702         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12703         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12704         * target-reloc.h (relocate_for_relocatable): Change
12705         offset_in_output_section type to Elf_Addr.  Change code that uses
12706         it as well.
12707         * layout.cc (Layout::layout): Always set *off.
12708         * mapfile.cc (Mapfile::print_input_section): Use
12709         output_section_offset.
12710         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12711         Sized_relobj*.
12712         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12713         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12714         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12715
12716 2008-07-03  Ian Lance Taylor  <iant@google.com>
12717
12718         * layout.cc (Layout::include_section): Do not discard unrecognized
12719         SHT_STRTAB sections.
12720
12721 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12722
12723         * script.cc (Lex::can_continue_name): Make '?' allowable in
12724         version-script names.
12725         * testsuite/version_script.map: Change glob pattern to use '?'
12726
12727 2008-06-30  Manish Singh  <yosh@gimp.org>
12728
12729         PR 6585
12730         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12731         Correct typo.
12732
12733 2008-06-30  Ian Lance Taylor  <iant@google.com>
12734
12735         PR 6660
12736         PR 6682
12737         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12738         versions]: Don't try to read the value in the contents, since we
12739         don't use it.  Use the template endianness when writing.
12740
12741 2008-06-25  Cary Coutant  <ccoutant@google.com>
12742
12743         * fileread.cc (File_read::make_view): Assert on zero-length view.
12744         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12745         symbol table when there are no symbols to read.
12746
12747 2008-06-23  Craig Silverstein  <csilvers@google.com>
12748
12749         * version.cc (version_string): Bump to 1.7
12750
12751 2008-06-18  Craig Silverstein  <csilvers@google.com>
12752
12753         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12754         constant 0xFFFF to type Valtype.
12755         (Powerpc_relocate_functions::rel16_ha): Likewise.
12756
12757 2008-06-17  Ian Lance Taylor  <iant@google.com>
12758
12759         * output.h (Output_section::Input_section): Initialize p2align_ to
12760         zero for Output_section_data constructors.
12761         (Output_section::Input_section::addralign): If not an input
12762         section, return the alignment of the Output_section_data.
12763         * testsuite/copy_test.cc: New file.
12764         * testsuite/copy_test_1.cc: New file.
12765         * testsuite/copy_test_2.cc: New file.
12766         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12767         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12768         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12769         (copy_test_1_pic.o, copy_test_1.so): New targets.
12770         (copy_test_2_pic.o, copy_test_2.so): New targets.
12771         * testsuite/Makefile.in: Rebuild.
12772
12773         * script-sections.cc (Script_sections::place_orphan): Initialize
12774         local variable exact.
12775
12776 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12777
12778         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12779
12780 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12781             David S. Miller  <davem@davemloft.net>
12782
12783         * powerpc.cc: New file.
12784         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12785         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12786         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12787         * Makefile.in: Rebuild.
12788
12789 2008-06-09  Ian Lance Taylor  <iant@google.com>
12790
12791         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12792         <exception>.
12793         (throwing, orig_terminate): New static variables.
12794         (terminate_handler): New static function.
12795         (t2): Set terminate handler.
12796
12797 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12798
12799         PR 6584
12800         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12801         alignment.
12802
12803 2008-05-30  Cary Coutant  <ccoutant@google.com>
12804
12805         * archive.cc (Archive::include_all_members) Correct to step
12806         over symbol table and extended name table in thin archives.
12807
12808 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12809
12810         PR 6407
12811         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12812         calculation.
12813
12814 2008-05-28  Caleb Howe  <cshowe@google.com>
12815
12816         * reduced_debug_output.cc: New file.
12817         * reduced_debug_output.h: New file.
12818         * options.h (class General_options): Add --strip-debug-non-line.
12819         * options.cc (General_options::finalize): Add strip_debug_non_line
12820         to the strip heirarchy.
12821         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12822         fields.
12823         * layout.cc: Include "reduced_debug_output.h".
12824         (Layout::Layout): Initialize new fields.
12825         (line_only_debug_sections): New static array.
12826         (is_lines_only_debug_sections): New static inline function.
12827         (Layout::include_section): Handle --strip-debug-non-line.
12828         (Layout::make_output_section): If --strip-debug-non-line, build
12829         new output sections for .debug_abbrev and .debug_info.
12830         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12831         gold.  Warn about possible overflow.
12832         (read_signed_LEB_128): Likewise.
12833         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12834         (read_signed_LEB_128): Declare.
12835         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12836         (HFILES): Add reduced_debug_output.h.
12837         * Makefile.in: Rebuild.
12838
12839 2008-05-21  Ian Lance Taylor  <iant@google.com>
12840
12841         * mapfile.cc: New file.
12842         * mapfile.h: New file.
12843         * options.h (class General_options): Add -M/--print-map and -Map.
12844         * options.cc (General_options::finalize): Make -M equivalent to
12845         -Map -.
12846         * main.cc: Include <cstdio> and "mapfile.h".
12847         (main): Open mapfile if requested.
12848         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12849         constructor.  Change caller.
12850         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12851         (queue_middle_tasks): Likewise.
12852         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12853         declarations.
12854         * archive.cc: Include "mapfile.h".
12855         (Archive::add_symbols): Add mapfile parameter.  Change all
12856         callers.  Pass mapfile, symbol, and reason to include_member.
12857         (Archive::include_all_members): Add mapfile parameter.  Change all
12858         callers.
12859         (Archive::include_member): Add mapfile, sym, and why parameters.
12860         Change all callers.  Report inclusion to map file.
12861         * archive.h: Include "fileread.h".
12862         (class Archive): Update declarations.
12863         (Archive::file): New const method.
12864         (class Add_archive_symbols): Add mapfile_ field.  Update
12865         constructor.  Change all callers.
12866         * readsyms.h (class Read_symbols): Likewise.
12867         (class Finish_group): Likewise.
12868         (class Read_script): Likewise.
12869         * common.cc: Include "mapfile.h".
12870         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12871         all callers.
12872         (Symbol_table::do_allocate_commons): Likewise.
12873         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12874         symbol allocation to mapfile.
12875         * common.h (class Allocate_commons_task): Add mapfile_ field.
12876         Update constructor.  Change all callers.
12877         * symtab.h (class Symbol_table): Update declarations.
12878         * layout.cc: Include "mapfile.h".
12879         (Layout_task_runner::run): Print information to mapfile.
12880         (Layout::create_gold_note): Change Output_data_fixed_space to
12881         Output_data_zero_fill.
12882         (Layout::create_build_id): Likewise.
12883         (Layout::print_to_mapfile): New function.
12884         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12885         constructor.  Change caller.
12886         (class Layout): Declare print_to_mapfile.
12887         * output.cc (Output_section::Input_section::print_to_mapfile): New
12888         function.
12889         (Output_section::add_input_section): If producing a map, always
12890         add to input_sections_ list.
12891         (Output_section::do_print_to_mapfile): New function.
12892         (Output_segment::print_sections_to_mapfile): New function.
12893         (Output_segment::print_section_list_to_mapfile): New function.
12894         * output.h: Include "mapfile.h".
12895         (Output_data::print_to_mapfile): New function.
12896         (Output_data::do_print_to_mapfile): New virtual function.
12897         (Output_segment_headers::do_print_to_mapfile): New function.
12898         (Output_file_header::do_print_to_mapfile): New function.
12899         (Output_data_const::do_print_to_mapfile): New function.
12900         (class Output_data_const_buffer): Add map_name_ field.  Update
12901         constructor.  Change all callers.  Add do_print_to_mapfile
12902         function.
12903         (class Output_data_fixed_space): Likewise.
12904         (class Output_data_space): Likewise.
12905         (class Output_data_zero_fill): New class.
12906         (Output_data_strtab::do_print_to_mapfile): New function.
12907         (Output_data_reloc_base::do_print_to_mapfile): New function.
12908         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12909         (Output_data_group::do_print_to_mapfile): New function.
12910         (Output_data_got::do_print_to_mapfile): New function.
12911         (Output_data_dynamic::do_print_to_mapfile): New function.
12912         (Output_symtab_xindex::do_print_to_mapfile): New function.
12913         (class Output_section): Declare do_print_to_mapflie.  Declare
12914         print_to_mapfile in Input_section.
12915         (class Output_segment): Declare new functions.
12916         * object.h (Sized_relobj::symbol_count): New function.
12917         * script-sections.cc
12918         (Output_section_element_dot_assignment::set_section_addresses):
12919         Change Output_data_fixed_space to Output_data_zero_fill.
12920         (Output_data_expression::do_print_to_mapfile): New function.
12921         * script.cc (read_input_script): Add mapfile parameter.  Change
12922         all callers.
12923         * script.h (read_input_script): Update declaration.
12924         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12925         (Eh_frame::do_print_to_mapfile): New function.
12926         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12927         (Output_merge_string::do_print_to_mapfile): New function.
12928         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12929         function.
12930         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12931         function.
12932         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12933         function.
12934         * Makefile.am (CCFILES): Add mapfile.cc.
12935         (HFILES): Add mapfile.h.
12936         * Makefile.in: Rebuild.
12937
12938 2008-05-19  Ian Lance Taylor  <iant@google.com>
12939
12940         * options.h (class General_options): Add -z relro.
12941         * layout.cc (Layout::Layout): Initialize relro_segment_.
12942         (Layout::add_output_section_data): Return the output section.
12943         (Layout::make_output_section): Rcognize relro sections and mark
12944         them appropriately.
12945         (Layout::attach_allocated_section_to_segment): Put relro sections
12946         in a PT_GNU_RELRO segment.
12947         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12948         section as relro.
12949         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12950         PT_TLS segments.
12951         (Layout::linkonce_mapping): Map d.rel.ro.local to
12952         .data.rel.ro.local.
12953         (Layout::output_section_name): Us .data.rel.ro.local for any
12954         section which begins with that.
12955         * layout.h (class Layout): Update add_output_section_data
12956         declaration.  Add relro_segment_ field.
12957         * output.cc (Output_section::Output_section): Initialize is_relro_
12958         and is_relro_local_ fields.
12959         (Output_segment::add_output_section): Group relro sections.
12960         (Output_segment::is_first_section_relro): New function.
12961         (Output_segment::maximum_alignment): If there is a relro section,
12962         align the segment to the common page size.
12963         (Output_segment::set_section_addresses): Track whether we are
12964         looking at relro sections.  If the last section is a relro
12965         section, align to the common page size.
12966         (Output_segment::set_section_list_addresses): Add in_relro
12967         parameter.  Change all callers.  Align to the page size when
12968         moving from relro to non-relro section.
12969         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12970         segment.
12971         * output.h (class Output_section): Add is_relro_ and
12972         is_relro_local_ fields.
12973         (Output_section::is_relro): New function.
12974         (Output_section::set_is_relro): New function.
12975         (Output_section::is_relro_local): New function.
12976         (Output_section::set_is_relro_local): New function.
12977         (class Output_segment): Update declarations.
12978         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12979         * sparc.cc (Target_sparc::got_section): Likewise.
12980         * x86_64.cc (Target_x86_64::got_section): Likewise.
12981         * testsuite/relro_test_main.cc: New file.
12982         * testsuite/relro_test.cc: New file.
12983         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12984         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12985         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12986         (relro_test.so, relro_test_pic.o): New targets.
12987         * testsuite/Makefile.in: Rebuild.
12988
12989 2008-05-16  Ian Lance Taylor  <iant@google.com>
12990
12991         * output.cc (Output_segment::add_output_section): Remove front
12992         parameter.
12993         * output.h (class Output_segment): Remove
12994         add_initial_output_section and overloaded add_output_section.
12995         Update declaration of remaining add_output_section.
12996         * layout.cc (Layout::create_interp): Call add_output_section
12997         rather than add_initial_output_section.
12998         (Layout::finish_dynamic_section): Likewise.
12999
13000         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13001         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13002         know the dynamic type.
13003         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13004         field.  Initialize it in constructor.
13005         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13006         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13007         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13008         reloc.
13009
13010         * output.cc (Output_reloc::get_address): Change return type to
13011         Elf_Addr.
13012         * output.h (class Output_reloc): Update get_address declaration.
13013         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13014         for section addresses.
13015
13016 2008-05-09  Ian Lance Taylor  <iant@google.com>
13017
13018         PR 6493
13019         * gold.cc (gold_nomem): Use return value of write.
13020
13021 2008-05-08  Ian Lance Taylor  <iant@google.com>
13022
13023         * symtab.c (Symbol::init_base_output_data): Add version
13024         parameter.  Change all callers.
13025         (Symbol::init_base_output_segment): Likewise.
13026         (Symbol::init_base_constant): Likewise.
13027         (Symbol::init_base_undefined): Likewise.
13028         (Sized_symbol::init_output_data): Likewise.
13029         (Sized_symbol::init_output_segment): Likewise.
13030         (Sized_symbol::init_constant): Likewise.
13031         (Sized_symbol::init_undefined): Likewise.
13032         (Symbol_table::do_define_in_output_data): If the new symbol has a
13033         version, mark it as the default.
13034         (Symbol_table::do_define_in_output_segment): Likewise.
13035         (Symbol_table::do_define_as_constant): Likewise.
13036         * symtab.h (class Symbol): Update declarations.
13037         (class Sized_symbol): Likewise.
13038         * resolve.cc (Symbol::override_version): New function.
13039         (Symbol::override_base): Call override_version.
13040         (Symbol::override_base_with_special): Likewise.
13041         * testsuite/ver_script_8.script: New file.
13042         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13043         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13044         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13045         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13046
13047 2008-05-06  Ian Lance Taylor  <iant@google.com>
13048
13049         PR 6049
13050         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13051         functions.
13052         (class General_options): Remove existing --undefined, and add
13053         --no-undefined instead.  Add new --undefined as synonym for -u.
13054         * archive.cc (Archive::add_symbols): Check whether symbol was
13055         named with -u.
13056         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13057         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13058         all uses.  Add IS_UNDEFINED.  Update declarations to split
13059         different versions of init_base.  Declare init_base_undefined.
13060         (Symbol::is_defined): Handle IS_UNDEFINED.
13061         (Symbol::is_undefined): Likewise.
13062         (Symbol::is_weak_undefined): Call is_undefined.
13063         (Symbol::is_absolute): Handle IS_CONSTANT.
13064         (class Sized_symbol): Update declarations to split different
13065         versions of init.  Declare init_undefined.
13066         (class Symbol_table): Declare new functions.
13067         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13068         Change all callers.
13069         (Symbol::init_base_output_data): Likewise.
13070         (Symbol::init_base_output_segment): Likewise.
13071         (Symbol::init_base_constant): Likewise.
13072         (Symbol::init_base_undefined): New function.
13073         (Sized_symbol::init_object): Rename from init.  Change all
13074         callers.
13075         (Sized_symbol::init_output_data): Likewise.
13076         (Sized_symbol::init_output_segment): Likewise.
13077         (Sized_symbol::init_constant): Likewise.
13078         (Sized_symbol::init_undefined): New function.
13079         (Symbol_table::add_undefined_symbols_from_command_line): New
13080         function.
13081         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13082         function.
13083         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13084         (Symbol::output_section): Likewise.
13085         (Symbol::set_output_section): Likewise.
13086         (Symbol_table::sized_finalize_symbol): Likewise.
13087         (Symbol_table::sized_write_globals): Likewise.
13088         * resolve.cc (Symbol_table::should_override): Likewise.
13089         (Symbol::override_base_with_special): Likewise.
13090
13091         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13092         symbol, change it to have default visibility.
13093         * testsuite/protected_1.cc: New file.
13094         * testsuite/protected_2.cc: New file.
13095         * testsuite/protected_3.cc: New file.
13096         * testsuite/protected_main_1.cc: New file.
13097         * testsuite/protected_main_2.cc: New file.
13098         * testsuite/protected_main_3.cc: New file.
13099         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13100         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13101         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13102         (protected_1.so): New target.
13103         (protected_1_pic.o, protected_2_pic.o): New targets.
13104         (protected_3_pic.o): New target.
13105         (check_PROGRAMS): Add protected_2.
13106         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13107         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13108         * testsuite/Makefile.in: Rebuild.
13109
13110         * options.h (DEFINE_var): Add set_user_set_##varname__.
13111         (DEFINE_bool_alias): New macro.
13112         (class General_options): Define -Bstatic using DEFINE_bool_alias
13113         rather than DEFINE_special.  Add --undefined as an alias for -z
13114         defs.
13115         * options.cc (General_options::parse_Bstatic): Remove.
13116
13117         * options.h (class General_options): Add --fatal-warnings.
13118         * main.cc (main): Implement --fatal-warnings.
13119         * errors.h (Errors::warning_count): New function.
13120
13121         * options.h (class General_options): Add -Bsymbolic-functions.
13122         * symtab.h (Symbol::is_preemptible): Check for
13123         -Bsymbolic-functions.
13124
13125 2008-05-05  Ian Lance Taylor  <iant@google.com>
13126
13127         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13128         as noVARNAME rather than no-VARNAME.
13129         (class General_options): Add option -z combreloc.
13130         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13131         get_address.
13132         (Output_reloc::sort_before) [SHT_REL]: New function.
13133         (Output_reloc::sort_before) [SHT_RELA]: New function.
13134         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13135         Sort_relocs_comparison.
13136         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13137         parameter.  Change all callers.
13138         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13139         sort_relocs parameter.  Change all callers.
13140         * output.cc (Output_reloc::get_address): New function, broken out
13141         of write_rel.
13142         (Output_reloc::write_rel): Call it.
13143         (Output_reloc::compare): New function.
13144         (Output_data_reloc_base::do_write): Optionally sort relocs.
13145
13146         * configure.ac: If targ_extra_obj is set, link it in.
13147         * configure.tgt: Initialize all variables.
13148         (x86_64*): Set targ_extra_obj and targ_extra_size.
13149         * configure: Rebuild.
13150
13151         * object.cc (Sized_relobj::include_section_group): Adjust section
13152         indexes read from group data.  Build vector to pass to
13153         layout_group.
13154         * layout.cc (Layout::layout_group): Add flags and shndxes
13155         parameters.  Remove contents parameter.  Change caller.  Update
13156         explicit instantiations.
13157         * layout.h (class Layout): Update layout_group declaration.
13158         * output.cc (Output_data_group::Output_data_group): Add flags and
13159         input_shndxes parameters.  Remove contents parameter.  Change
13160         caller.
13161         (Output_data_group::do_write): Change input_sections_ to
13162         input_shndxes_.
13163         * output.h (class Output_data_group): Update constructor
13164         declaration.  Rename input_sections_ to input_shndxes_.
13165         * testsuite/many_sections_test.cc: Add template.
13166
13167 2008-04-30  Cary Coutant  <ccoutant@google.com>
13168
13169         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13170
13171         * layout.cc (Layout::include_section): Refactored check for debug
13172         info section.
13173         (Layout::add_comdat): Add new parameters.  Change type
13174         of signature parameter.  Add object and shndx to signatures table.
13175         (Layout::find_kept_object): New function.
13176         * layout.h: Include <cstring>.
13177         (Layout::is_debug_info_section): New function.
13178         (Layout::add_comdat): Add new parameters.
13179         (Layout::find_kept_object): New function.
13180         (Layout::Kept_section): New struct.
13181         (Layout::Signatures): Change type of map range.
13182         * object.cc (Relobj::output_section_address): New function.
13183         (Sized_relobj::include_section_group): Add new parameters.  Change
13184         calls to Layout::add_comdat.  Change to build table of kept comdat
13185         groups and table mapping discarded sections to kept sections.
13186         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13187         (Sized_relobj::do_layout): Change calls to include_section_group and
13188         include_linkonce_section.
13189         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13190         value to zero when section is discarded.
13191         (Sized_relobj::map_to_kept_section): New function.
13192         * object.h (Relobj::output_section_address): New function.
13193         (Relobj::Comdat_group): New type.
13194         (Relobj::find_comdat_group): New function.
13195         (Relobj::Comdat_group_table): New type.
13196         (Relobj::Kept_comdat_section): New type.
13197         (Relobj::Kept_comdat_section_table): New type.
13198         (Relobj::add_comdat_group): New function.
13199         (Relobj::set_kept_comdat_section): New function.
13200         (Relobj::get_kept_comdat_section): New function.
13201         (Relobj::comdat_groups_): New field.
13202         (Relobj::kept_comdat_sections_): New field.
13203         (Symbol_value::input_value): Update comment.
13204         (Sized_relobj::map_to_kept_section) New function.
13205         (Sized_relobj::include_linkonce_section): Add new parameter.
13206         * target-reloc.h (Comdat_behavior): New type.
13207         (get_comdat_behavior): New function.
13208         (relocate_section): Add code to map a discarded section to the
13209         corresponding kept section when applying a relocation.
13210
13211 2008-04-30  Craig Silverstein  <csilvers@google.com>
13212
13213         * dwarf_reader.cc (next_generation_count): New static var.
13214         (Addr2line_cache_entry): New struct.
13215         (addr2line_cache): New static var.
13216         (Dwarf_line_info::one_addr2line): Added caching.
13217         (Dwarf_line_info::clear_addr2line_cache): New function.
13218         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13219         cache-size parameter.
13220         (Dwarf_line_info::one_addr2line_cache): New function.
13221         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13222         new cache-size argument to one_addr2line(), and clear cache.
13223
13224 2008-04-28  Cary Coutant  <ccoutant@google.com>
13225
13226         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13227         R_386_PC8 relocations.
13228
13229 2008-04-23  Ian Lance Taylor  <iant@google.com>
13230
13231         * object.cc (Sized_relobj::include_section_group): Check for
13232         invalid section group.
13233
13234         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13235         header size.
13236
13237         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13238         than read for file header.
13239         * archive.cc (Archive::include_member): Likewise.
13240
13241 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13242
13243         * aclocal.m4: Regenerate.
13244         * configure: Regenerate.
13245
13246 2008-04-19  Ian Lance Taylor  <iant@google.com>
13247
13248         * version.cc (version_string): Bump to 1.6.
13249
13250         * testsuite/Makefile.am (many_sections_r_test): New target.
13251         (many_sections_r_test_SOURCES): Remove.
13252         (many_sections_r_test_DEPENDENCIES): Remove.
13253         (many_sections_r_test_LDFLAGS): Remove.
13254         (many_sections_r_test_LDADD): Remove.
13255
13256         * object.cc (Sized_relobj::do_add_symbols): Always pass
13257         local_symbol_count_ to add_from_relobj.
13258
13259         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13260         every thousand variables.
13261         * testsuite/Makefile.in: Rebuild.
13262
13263         * object.cc (Xindex::initialize_symtab_xindex): New function.
13264         (Xindex::read_symtab_xindex): New function.
13265         (Xindex::sym_xindex_to_shndx): New function.
13266         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13267         available.
13268         (Sized_relobj::do_initialize_xindex): New function.
13269         (Sized_relobj::do_read_symbols): Adjust section links.
13270         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13271         parameter.  Change all callers.
13272         (Sized_relobj::include_section_group): Adjust section links and
13273         symbol section indexes.
13274         (Sized_relobj::do_layout): Adjust section links.
13275         (Sized_relobj::do_count_local_symbols): Adjust section links and
13276         symbol section indexes.
13277         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13278         ordinary and special symbols.
13279         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13280         dynsym_xindex parameters.  Change all callers.  Adjust section
13281         links.  Use SHN_XINDEX when needed.
13282         (Sized_relobj::get_symbol_location_info): Adjust section links.
13283         Don't get fooled by special symbols.
13284         * object.h (class Xindex): Define.
13285         (class Object): Add xindex_ parameter.  Declare virtual functoin
13286         do_initialize_xindex.
13287         (Object::adjust_sym_shndx): New function.
13288         (Object::set_xindex): New protected function.
13289         (class Symbol_value): Add is_ordinary_shndx_ field.
13290         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13291         (Symbol_value::value): Assert ordinary section.
13292         (Symbol_value::initialize_input_to_output_map): Likewise.
13293         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13294         Change all callers.
13295         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13296         all callers.
13297         (class Sized_relobj): Update declarations.
13298         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13299         parameter.  Change all callers.
13300         (Sized_relobj::adjust_shndx): New function.
13301         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13302         field.
13303         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13304         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13305         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13306         (Sized_dynobj::read_dynsym_section): Adjust section links.
13307         (Sized_dynobj::read_dynamic): Likewise.
13308         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13309         section links.
13310         (Sized_dynobj::do_initialize_xindex): New function.
13311         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13312         do_initialize_xindex.
13313         (Sized_dynobj::adjust_shndx): New function.
13314         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13315         dynsym_xindex_ fields.
13316         (Layout::finalize): Add a call to set_section_indexes before
13317         creating the symtab sections.
13318         (Layout::set_section_indexes): Don't do anything if the section
13319         already has a section index.
13320         (Layout::create_symtab_sections): Add shnum parameter.  Change
13321         caller.  Create .symtab_shndx section if needed.
13322         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13323         caller.
13324         (Layout::allocated_output_section_count): New function.
13325         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13326         needed.
13327         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13328         fields.  Update declarations.
13329         (Layout::symtab_xindex): New function.
13330         (Layout::dynsym_xindex): New function.
13331         (class Write_symbols_task): Add layout_ field.
13332         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13333         Change caller.
13334         * output.cc (Output_section_headers::Output_section_headers): Add
13335         shstrtab_section parameter.  Change all callers.
13336         (Output_section_headers::do_sized_write): Store overflow values
13337         for section count and section string table section index in
13338         section header zero.
13339         (Output_file_header::do_sized_write): Check for overflow of
13340         section count and section string table section index.
13341         (Output_symtab_xindex::do_write): New function.
13342         (Output_symtab_xindex::endian_do_write): New function.
13343         * output.h (class Output_section_headers): Add shstrtab_section_.
13344         Update declarations.
13345         (class Output_symtab_xindex): Define.
13346         (Output_section::has_out_shndx): New function.
13347         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13348         field.
13349         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13350         Change all callers.
13351         (Sized_symbol::init): Likewise.
13352         (Symbol::output_section): Check for ordinary symbol.
13353         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13354         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13355         callers.
13356         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13357         Change all callers.  Simplify handling of symbols from sections
13358         not included in the link.
13359         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13360         distinction.
13361         (Weak_alias_sorter::operator()): Assert that symbols are
13362         ordinary.
13363         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13364         distinction.
13365         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13366         parameters.  Change all callers.
13367         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13368         symbol distinction.  Use SHN_XINDEX when needed.
13369         (Symbol_table::write_section_symbol): Add symtab_xindex
13370         parameter.  Change all callers.
13371         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13372         SHN_XINDEX when needed.
13373         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13374         declarations.
13375         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13376         (Symbol::is_defined): Check is_ordinary.
13377         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13378         (Symbol::is_absolute, Symbol::is_common): Likewise.
13379         (class Sized_symbol): Update declarations.
13380         (class Symbol_table): Update declarations.
13381         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13382         parameters.  Change all callers.
13383         (Sized_symbol::override): Likewise.
13384         (Symbol_table::override): Likewise.
13385         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13386         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13387         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13388         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13389         to be in an ordinary section.
13390         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13391         object and is_ordinary parameters.  Change all callers.
13392         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13393         Change all callers.  Don't add undefined or non-ordinary symbols
13394         to reloc_map_.
13395         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13396         Change all callers.
13397         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13398         declarations.
13399         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13400         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13401         (Sized_relobj::relocate_sections): Likewise.
13402         * target-reloc.h (scan_relocs): Adjust section symbol index.
13403         (scan_relocatable_relocs): Likewise.
13404         * i386.cc (Scan::local): Check for ordinary symbols.
13405         * sparc.cc (Scan::local): Likewise.
13406         * x86_64.cc (Scan::local): Likewise.
13407         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13408         to symbol_section_and_value.
13409         * testsuite/many_sections_test.cc: New file.
13410         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13411         (check_PROGRAMS): Add many_sections_test.
13412         (many_sections_test_SOURCES): Define.
13413         (many_sections_test_DEPENDENCIES): Define.
13414         (many_sections_test_LDFLAGS): Define.
13415         (BUILT_SOURCES): Add many_sections_define.h.
13416         (many_sections_define.h): New target.
13417         (BUILT_SOURCES): Add many_sections_check.h.
13418         (many_sections_check.h): New target.
13419         (check_PROGRAMS): Add many_sections_r_test.
13420         (many_sections_r_test_SOURCES): Define.
13421         (many_sections_r_test_DEPENDENCIES): Define.
13422         (many_sections_r_test_LDFLAGS): Define.
13423         (many_sections_r_test_LDADD): Define.
13424         (many_sections_r_test.o): New target.
13425         * testsuite/Makefile.in: Rebuild.
13426
13427 2008-04-17  Cary Coutant  <ccoutant@google.com>
13428
13429         * errors.cc (Errors::info): New function.
13430         (gold_info): New function.
13431         * errors.h (Errors::info): New function.
13432         * gold.h (gold_info): New function.
13433         * object.cc (Input_objects::add_object): Print trace output.
13434         * options.cc (options::parse_set): New function.
13435         (General_options::parse_wrap): Deleted.
13436         (General_options::General_options): Deleted initializer.
13437         * options.h (options::String_set): New typedef.
13438         (options::parse_set): New function.
13439         (DEFINE_set): New macro.
13440         (General_options::wrap): Changed to use DEFINE_set. Changed
13441         callers of any_wrap_symbols and is_wrap_symbol.
13442         (General_options::trace, General_options::trace_symbol):
13443         New options.
13444         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13445         (General_options::wrap_symbols_): Deleted.
13446         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13447
13448 2008-04-17  David S. Miller  <davem@davemloft.net>
13449
13450         * options.cc (General_options::parse_V): New function.
13451         * options.h: Add entries for -V and -Qy.
13452
13453 2008-04-17  Ian Lance Taylor  <iant@google.com>
13454
13455         * common.cc (Symbol_table::allocate_commons): Remove options
13456         parameter.  Change caller.
13457         (Symbol_table::do_allocate_commons): Remove options parameter.
13458         Change caller.  Just call do_allocate_commons_list twice.
13459         (Symbol_table::do_allocate_commons_list): New function, broken out
13460         of do_allocate_commons.
13461         * common.h (class Allocate_commons_task): Remove options_ field.
13462         Update constructor.
13463         * symtab.cc (Symbol_table::Symbol_table): Initialize
13464         tls_commons_.
13465         (Symbol_table::add_from_object): Put TLS common symbols on
13466         tls_commons_ list.
13467         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13468         which are IN_OUTPUT_DATA.
13469         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13470         allocate_commons and do_allocate_commons declarations.  Declare
13471         do_allocate_commons_list.
13472         * gold.cc (queue_middle_tasks): Update creation of
13473         Allocate_commons_task to not pass options.
13474         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13475         (TLS_TEST_C_FLAGS): New variable.
13476         (tls_test_c_pic.o): New target.
13477         (tls_test_shared.so): Link in tls_test_c_pic.o.
13478         (tls_test_c_pic_ie.o): New target.
13479         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13480         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13481         (tls_test_c.o): New target.
13482         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13483         (tls_pic_test_LDADD): Likewise.
13484         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13485         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13486         (tls_test_c_gnu2.o): New target.
13487         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13488         tls_test_c_gnu2.o.
13489         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13490         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13491         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13492         * testsuite/tls_test.cc: Include "config.h".
13493         (t_last): Call t11_last.
13494         * testsuite/tls_test.h (t11, t11_last): Declare.
13495         * testsuite/tls_test_c.c: New file.
13496         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13497         * configure.ac: Check for OpenMP support.
13498         * configure, config.in, Makefile.in: Rebuild.
13499         * testsuite/Makefile.in: Rebuild.
13500
13501 2008-04-16  Cary Coutant  <ccoutant@google.com>
13502
13503         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13504         (Target_i386::tls_base_symbol_defined_): New field.
13505         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13506         (Target_i386::Scan::global): Likewise.
13507         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13508         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13509         (Target_x86_64::tls_base_symbol_defined_): New field.
13510         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13511         (Target_x86_64::Scan::global): Likewise.
13512
13513 2008-04-16  Cary Coutant  <ccoutant@google.com>
13514
13515         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13516         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13517         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13518         building shared libraries.
13519         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13520         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13521         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13522         * testsuite/Makefile.in: Rebuild.
13523         * testsuite/weak_undef.h: New file.
13524         * testsuite/weak_undef_file1.cc: Add extra test cases.
13525         * testsuite/weak_undef_file2.cc: Likewise.
13526         * testsuite/weak_undef_test.cc: Likewise.
13527
13528 2008-04-16  David S. Miller  <davem@davemloft.net>
13529
13530         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13531         Add issued_non_pic_error_ field.  Declare check_non_pic.
13532         (Target_sparc::Scan::check_non_pic): New function.
13533         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13534         (Target_sparc::Scan::global): Likewise.
13535
13536         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13537         * configure: Rebuild.
13538
13539         * options.h (DEFINE_enable): New macro.
13540         (new_dtags): New enable option.
13541         (initfirst, interpose, loadfltr, nodefaultlib,
13542         nodelete, nodlopen, nodump): New -z options.
13543         * layout.cc (Layout:finish_dynamic_section): If new
13544         dtags enabled, emit DT_RUNPATH.  Also, emit a
13545         DT_FLAGS_1 containing any specified -z flags.
13546
13547 2008-04-16  Ian Lance Taylor  <iant@google.com>
13548
13549         * copy-relocs.cc: New file.
13550         * copy-relocs.h: New file.
13551         * reloc.cc: Remove Copy_relocs code.
13552         * reloc.h: Likewise.
13553         * reloc-types.h (struct Reloc_types) [both versions]: Add
13554         get_reloc_addend_noerror.
13555         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13556         variants of add_global which take an addend which must be zero.
13557         * i386.cc: Include "copy-relocs.h".
13558         (class Target_i386): Change type of copy_relocs_ to variable,
13559         update initializer.
13560         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13561         Change all callers.
13562         (Target_i386::do_finalize_sections): Change handling of
13563         copy_relocs_.
13564         * sparc.cc: Include "copy-relocs.h".
13565         (class Target_sparc): Change type of copy_relocs_ to variable,
13566         update initializer.
13567         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13568         Change all callers.
13569         (Target_sparc::do_finalize_sections): Change handling of
13570         copy_relocs_.
13571         * x86_64.cc: Include "copy-relocs.h".
13572         (class Target_x86_64): Change type of copy_relocs_ to variable,
13573         update initializer.
13574         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13575         class.  Change all callers.
13576         (Target_x86_64::do_finalize_sections): Change handling of
13577         copy_relocs_.
13578         * Makefile.am (CCFILES): Add copy-relocs.cc.
13579         (HFILES): Add copy-relocs.h.
13580
13581         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13582
13583         * testsuite/script_test_4.sh: Permit leading zeroes.
13584
13585 2008-04-15  Ian Lance Taylor  <iant@google.com>
13586
13587         * script-sections.cc (Script_sections::create_segments): Use
13588         header_size_adjustment even when there is enough room for the
13589         headers.
13590         * testsuite/script_test_4.sh: New file.
13591         * testsuite/script_test_4.t: New file.
13592         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13593         (check_DATA): Add script_test_4.stdout.
13594         (MOSTLYCLEANFILES): Likewise.
13595         (script_test_4): New target.
13596         (script_test_4.stdout): New target.
13597         * testsuite/Makefile.in: Rebuild.
13598
13599         * sparc.cc: Add definitions for Output_data_plt_sparc class
13600         constants.
13601
13602 2008-04-14  David S. Miller  <davem@davemloft.net>
13603
13604         * sparc.cc: New file.
13605         * Makefile.am (TARGETSOURCES): Add sparc.cc
13606         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13607         * configure.tgt: Document targ_extra_size and
13608         targ_extra_big_endian.  Add entries for sparc-* and
13609         sparc64-*.
13610         * configure.ac: Handle targ_extra_size and
13611         targ_extra_big_endian.
13612         * Makefile.in: Rebuild.
13613         * configure: Likewise.
13614         * po/POTFILES.in: Likewise.
13615         * po/gold.pot: Likewise.
13616
13617 2008-04-14  Ian Lance Taylor  <iant@google.com>
13618
13619         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13620         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13621         in the name/type/flags to section mapping.  Don't call
13622         allocate_output_section.
13623         (Layout::choose_output_section): Change parameter from adjust_name
13624         to is_input_section.  Don't permit input sections after sections
13625         are attached to segments.  Don't call allocate_output_section.
13626         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13627         not write_enable_output_section.
13628         (Layout::make_output_section): Don't push to
13629         unattached_section_list_ nor call attach_to_segment.  Call
13630         attach_section_to_segment if sections are attached.
13631         (Layout::attach_sections_to_segments): New function.
13632         (Layout::attach_section_to_segment): New function.
13633         (Layout::attach_allocated_section_to_segment): Rename from
13634         attach_to_segment.  Remove flags parameter.
13635         (Layout::allocate_output_section): Remove function.
13636         (Layout::write_enable_output_section): Remove function.
13637         * layout.h (class Layout): Update for above changes.  Add new
13638         field sections_are_attached_.
13639         * output.h (Output_section::update_flags_for_input_section): New
13640         function.
13641         * output.cc (Output_section::add_input_section): Call
13642         update_flags_for_input_section.
13643         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13644
13645 2008-04-11  Cary Coutant  <ccoutant@google.com>
13646
13647         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13648         thought unnecessary.
13649         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13650
13651 2008-04-11  Ian Lance Taylor  <iant@google.com>
13652
13653         * output.h (class Output_section_data): Remove inline definition
13654         of set_addralign.
13655         * output.cc (Output_section_data::set_addralign): New function.
13656
13657 2008-04-11  Cary Coutant  <ccoutant@google.com>
13658
13659         Add support for TLS descriptors for i386 and x86_64.
13660         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13661         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13662         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13663         GOT_TYPE_TLS_DESC.
13664         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13665         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13666         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13667         relocations.
13668         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13669         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13670         Fix problem with initial-exec relocations.
13671         (Target_i386::Relocate::relocate_tls): Likewise.
13672         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13673         relaxation.
13674         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13675         support for section-plus-offset dynamic table entries.
13676         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13677         (Output_data_dynamic::Dynamic_entry): Add support for
13678         section-plus-offset dynamic table entries.
13679         (Output_data_dynamic::Classification): Likewise.
13680         (Output_data_dynamic::classification_): Renamed offset_.
13681         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13682         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13683         (Target_x86_64::make_plt_section): New function.
13684         (Target_x86_64::reserve_tlsdesc_entries): New function.
13685         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13686         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13687         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13688         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13689         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13690         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13691         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13692         add extra PLT entry for TLS descriptors.
13693         (Output_data_plt_x86_64::got_): New field.
13694         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13695         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13696         fields.
13697         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13698         descriptors.
13699         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13700         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13701         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13702         R_386_TLS_DESC_CALL relocations.
13703         (Target_x86_64::Scan::global): Likewise.
13704         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13705         for TLS descriptors.
13706         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13707         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13708         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13709         GD-to-IE relaxation.
13710         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13711         and TLS_DESCRIPTORS.
13712         * Makefile.in: Rebuild.
13713         * configure: Rebuild.
13714         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13715         (tls_test_shared2.so): New target.
13716         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13717         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13718         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13719         (tls_shared_gd_to_ie_test_LDADD): New variable.
13720         (tls_shared_gnu2_gd_to_ie_test): New target.
13721         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13722         New targets.
13723         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13724         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13725         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13726         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13727         (tls_shared_gnu2_test): New target.
13728         (tls_test_gnu2_shared.so): New target.
13729         (tls_shared_gnu2_test_SOURCES): New variable.
13730         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13731         (tls_shared_gnu2_test_LDFLAGS): New variable.
13732         (tls_shared_gnu2_test_LDADD): New variable.
13733         * testsuite/Makefile.in: Rebuild.
13734         * testsuite/Makefile.
13735
13736 2008-04-11  Ian Lance Taylor  <iant@google.com>
13737
13738         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13739         justsyms.t.
13740         * testsuite/Makefile.in: Rebuild.
13741
13742         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13743         long.
13744         * testsuite/script_test_2.cc (main): Adjust test.
13745
13746 2008-04-11  David S. Miller  <davem@davemloft.net>
13747             Ian Lance Taylor  <iant@google.com>
13748
13749         * options.h (General_options): Add entries for '-Y' and
13750         '-relax'.
13751         * options.cc (General_options:finalize): If -Y was used, add those
13752         entries to the library path instead of the default "/lib" and
13753         "/usr/lib".
13754
13755 2008-04-11  David S. Miller  <davem@davemloft.net>
13756
13757         * testsuite/justsyms.t: Start at 0x100.
13758         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13759         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13760         long.
13761         * testsuite/script_test_2.cc: Adjust string and section length
13762         checks.
13763
13764 2008-04-09  Ian Lance Taylor  <iant@google.com>
13765
13766         PR gold/5996
13767         * script-sections.cc (Sections_element::allocate_to_segment): Add
13768         orphan parameter.
13769         (Output_section_definition::allocate_to_segment): Likewise.
13770         (Orphan_output_section::allocate_to_segment): Likewise.
13771         (Script_sections::attach_sections_using_phdrs_clause): Don't
13772         propagate non-PT_LOAD segments to orphan sections.
13773         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13774         readelf rather than objdump.
13775         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13776         .interp section and PT_INTERP segment are the same size.
13777         * testsuite/Makefile.in: Rebuild.
13778
13779         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13780         aliases for symbols defined in the same object.
13781         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13782         (weak_alias_test_SOURCES): New variable.
13783         (weak_alias_test_DEPENDENCIES): New variable.
13784         (weak_alias_test_LDFLAGS): New variable.
13785         (weak_alias_test_LDADD): New variable.
13786         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13787         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13788         (weak_alias_test_3.o): New target.
13789         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13790         * testsuite/weak_alias_test_main.cc: New file.
13791         * testsuite/weak_alias_test_1.cc: New file.
13792         * testsuite/weak_alias_test_2.cc: New file.
13793         * testsuite/weak_alias_test_3.cc: New file.
13794
13795 2008-04-08  Ian Lance Taylor  <iant@google.com>
13796
13797         * options.h (class General_options): Add --noinhibit-exec option.
13798         * main.cc (main): Check --noinhibit-exec.
13799
13800         * options.h (class General_options): Define --wrap as a special
13801         option.  Add wrap_symbols_ field.
13802         (General_options::any_wrap_symbols): New function.
13803         (General_options::is_wrap_symbol): New function.
13804         * options.cc (General_options::parse_wrap): New function.
13805         (General_options::General_options): Initialize wrap_symbols_.
13806         * symtab.cc (Symbol_table::wrap_symbol): New function.
13807         (Symbol_table::add_from_object): Handle --wrap.
13808         * symtab.h (class Symbol_table): Declare wrap_symbol.
13809         * target.h (Target::wrap_char): New function.
13810         (Target::Target_info): Add wrap_char field.
13811         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13812         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13813         * testsuite/testfile.cc (Target_test::test_target_info):
13814         Likewise.
13815
13816         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13817         there is one.
13818
13819         * layout.h (class Layout): Add added_eh_frame_data_ field.
13820         * layout.cc (Layout::Layout): Initialize new field.
13821         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13822         output section until we find a section we merged successfully.
13823         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13824         that the size be non-zero.
13825
13826         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13827         qualifier.
13828
13829 2008-04-08  Craig Silverstein  <csilvers@google.com>
13830
13831         * configure.ac: Export new conditional variable HAVE_ZLIB.
13832         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13833         on HAVE_ZLIB.
13834         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13835         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13836
13837 2008-04-07  Ian Lance Taylor  <iant@google.com>
13838
13839         * version.cc (version_string): Set to "1.5".
13840
13841         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13842         Add issued_non_pic_error_ field.  Declare check_non_pic.
13843         (Target_x86_64::Scan::check_non_pic): New function.
13844         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13845         (Target_x86_64::Scan::global): Likewise.
13846
13847         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13848         addend parameter.  Change caller.  Handle merge sections.
13849         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13850         Address to Addend.  Don't add in the result of
13851         local_section_offset, pass down the addend and use the returned
13852         value.
13853         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13854         Update declarations of local_section_offset and symbol_value.
13855         * testsuite/two_file_test_1.cc (t18): New function.
13856         * testsuite/two_file_test_2.cc (f18): New function.
13857         * testsuite/two_file_test_main.cc (main): Call t18.
13858         * testsuite/two_file_test.h (t18, f18): Declare.
13859
13860         * configure.ac: Don't test for objdump, c++filt, or readelf.
13861         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13862         conditionals.
13863         (TEST_READELF): New variable.
13864         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13865         (check_PROGRAMS): Add two_file_strip_test.
13866         (two_file_strip_test): New target.
13867         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13868         (two_file_same_shared_strip_test_SOURCES): New variable.
13869         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13870         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13871         (two_file_same_shared_strip_test_LDADD): New variable.
13872         (two_file_shared_strip.so): New target.
13873         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13874         (ver_test_5.syms, ver_test_7.syms): Likewise.
13875         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13876         (strip_test_3.stdout): Use TEST_OBJDUMP.
13877         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13878
13879 2008-04-04  Cary Coutant  <ccoutant@google.com>
13880
13881         * symtab.h (Symbol::is_weak_undefined): New function.
13882         (Symbol::is_strong_undefined): New function.
13883         (Symbol::is_absolute): New function.
13884         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13885         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13886         absolute symbols.
13887         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13888         (weak_undef_test): New target.
13889         * testsuite/Makefile.in: Rebuild.
13890         * testsuite/weak_undef_file1.cc: New file.
13891         * testsuite/weak_undef_file2.cc: New file.
13892         * testsuite/weak_undef_test.cc: New file.
13893
13894 2008-04-03  Craig Silverstein  <csilvers@google.com>
13895
13896         * compressed_output.h (class Output_compressed_section): Use
13897         unsigned buffer.
13898         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13899         add zlib header.
13900         (zlib_compressed_suffix): Removed.
13901         (Output_compressed_section::set_final_data_size): Use unsigned
13902         buffers.
13903         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13904         Fix linker invocation.
13905         (flagstest_o_specialfile_and_compress_debug_sections):
13906         Likewise.
13907         * testsuite/Makefile.in: Regenerated.
13908
13909 2008-04-02  David S. Miller  <davem@davemloft.net>
13910
13911         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13912         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13913
13914 2008-04-02  Craig Silverstein  <csilvers@google.com>
13915
13916         * TODO: New file.
13917
13918 2008-04-02  Ian Lance Taylor  <iant@google.com>
13919
13920         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13921         parameters.  Update for new key type to views_.  Change all
13922         callers.
13923         (File_read::read): Adjust for byteshift in returned view.
13924         (File_read::add_view): New function, broken out of
13925         find_and_make_view.
13926         (File_read::make_view): New function, broken out of
13927         find_and_make_view.
13928         (File_read::find_or_make_view): Add offset and aligned
13929         parameters.  Rewrite accordingly.  Change all callers.
13930         (File_read::get_view): Add offset and aligned parameters.  Adjust
13931         for byteshift in return value.
13932         (File_read::get_lasting_view): Likewise.
13933         * fileread.h (class File_read): Update declarations.
13934         (class File_read::View): Add byteshift_ field.  Add byteshift to
13935         constructor.  Add byteshift method.
13936         * archive.h (Archive::clear_uncached_views): New function.
13937         (Archive::get_view): Add aligned parameter.  Change all callers.
13938         * object.h (Object::get_view): Add aligned parameter.  Change all
13939         callers.
13940         (Object::get_lasting_view): Likewise.
13941
13942         * fileread.cc (File_read::release): Don't call clear_views if
13943         there are multiple objects.
13944         * fileread.h (File_read::clear_uncached_views): New function.
13945         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13946         on the archive.
13947
13948 2008-03-31  Cary Coutant  <ccoutant@google.com>
13949
13950         Add thin archive support.
13951         * archive.cc (Archive::armagt): New const.
13952         (Archive::setup): Remove task parameter and calls to unlock.
13953         (Archive::unlock_nested_archives): New function.
13954         (Archive::read_header): Add nested_off parameter. Change
13955         all callers.
13956         (Archive::interpret_header): Likewise.
13957         (Archive::include_all_members): Change to handle thin
13958         archives.
13959         (Archive::include_member): Likewise.
13960         * archive.h (Archive::Archive): Add new parameters and
13961         initializers.
13962         (Archive::armagt): New const.
13963         (Archive::setup): Remove task parameter.
13964         (Archive::unlock_nested_archives): New function.
13965         (Archive::read_header): Add nested_off parameter.
13966         (Archive::interpret_header): Likewise.
13967         (Archive::Nested_archive_table): New typedef.
13968         (Archive::is_thin_archive_): New field.
13969         (Archive::nested_archives_): New field.
13970         (Archive::options_): New field.
13971         (Archive::dirpath_): New field.
13972         (Archive::task_): New field.
13973         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13974         for thin archives.  Pass additional parameters to
13975         Archive::Archive.  Unlock the archive file after calling
13976         Archive::setup.
13977
13978 2008-03-29  Ian Lance Taylor  <iant@google.com>
13979
13980         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13981         version symbol to be local.
13982         * testsuite/ver_test_4.sh: New file.
13983         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13984         (check_DATA): Add ver_test_4.syms.
13985         (ver_test_4.syms): New target.
13986         * testsuite/Makefile.in: Rebuild.
13987
13988         * output.cc
13989         (Output_section::Input_section_sort_entry::has_priority): New
13990         function.
13991         (Output_section::Input_section_sort_entry::match_file_name): New
13992         function.
13993         (Output_section::Input_section_sort_entry::match_section_name):
13994         Remove.
13995         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13996         Remove.
13997         (Output_section::Input_section_sort_entry::match_section_file):
13998         Remove.
13999         (Output_section::Input_section_sort_compare::operator()): Rewrite
14000         using new Input_section_sort_entry functions.  Sort crtbegin and
14001         crtend first.  Sort sections with no priority before sections with
14002         a priority.
14003         * testsuite/initpri1.c (d3): Check j != 4.
14004         (cd5): New constructor/destructor function.
14005         (main): Check j != 2.
14006
14007         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14008         new symbol when resolving, don't call set_is_default.
14009         * testsuite/ver_test_7.cc: New file.
14010         * testsuite/ver_test_7.sh: New file.
14011         * testsuite/Makefile.am (ver_test_7.so): New target.
14012         (ver_test_7.o): New target.
14013         (check_SCRIPTS): Add ver_test_7.sh.
14014         (check_DATA): Add ver_test_7.syms.
14015         (ver_test_7.syms): New target.
14016
14017 2008-03-28  Ian Lance Taylor  <iant@google.com>
14018
14019         * layout.cc (Layout::layout): If we see an input section with a
14020         name that needs sorting, set the must_sort flag for the output
14021         section.
14022         (Layout::make_output_section): If the name of the output section
14023         indicates that it might require sorting, set the may_sort flag.
14024         * output.h (Output_section::may_sort_attached_input_sections): New
14025         function.
14026         (Output_section::set_may_sort_attached_input_sections): New
14027         function.
14028         (Output_section::must_sort_attached_input_sections): New
14029         function.
14030         (Output_section::set_must_sort_attached_input_sections): New
14031         function.
14032         (class Output_section): Declare Input_section_sort_entry.  Define
14033         Input_section_sort_compare.  Declare
14034         sort_attached_input_sections.  Add new fields:
14035         may_sort_attached_input_sections_,
14036         must_sort_attached_input_sections_,
14037         attached_input_sections_are_sorted_.
14038         * output.cc (Output_section::Output_section): Initialize new
14039         fields.
14040         (Output_section::add_input_section): Add an entry to
14041         input_sections_ if may_sort or must_sort are true.
14042         (Output_section::set_final_data_size): Call
14043         sort_attached_input_sections if necessary.
14044         (Output_section::Input_section_sort_entry): Define new class.
14045         (Output_section::Input_section_sort_compare::operator()): New
14046         function.
14047         (Output_section::sort_attached_input_sections): New function.
14048         * configure.ac: Check whether the compiler supports constructor
14049         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14050         * testsuite/initpri1.c: New file.
14051         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14052         CONSTRUCTOR_PRIORITY.
14053         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14054         (initpri1_LDFLAGS): New variable.
14055         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14056
14057 2008-03-27  Ian Lance Taylor  <iant@google.com>
14058
14059         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14060         * testsuite/common_test_1.c: New file.
14061         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14062         (common_test_1_SOURCES): New variable.
14063         (common_test_1_DEPENDENCIES): New variable.
14064         (common_test_1_LDFLAGS): New variable.
14065
14066         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14067         and commons_ correctly when NAME/VERSION does not override
14068         NAME/NULL.
14069         * testsuite/ver_test_6.c: New file.
14070         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14071         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14072         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14073
14074 2008-03-26  Ian Lance Taylor  <iant@google.com>
14075
14076         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14077         of an undefined symbol from a version script.
14078         * testsuite/Makefile.am (ver_test_5.so): New target.
14079         (ver_test_5.o): New target.
14080         (check_SCRIPTS): Add ver_test_5.sh.
14081         (check_DATA): Add ver_test_5.syms.
14082         (ver_test_5.syms): New target.
14083         * testsuite/ver_test_5.cc: New file.
14084         * testsuite/ver_test_5.script: New file.
14085         * testsuite/ver_test_5.sh: New file.
14086         * Makefile.in, testsuite/Makefile.in: Rebuild.
14087
14088         PR gold/5986
14089         Fix problems building gold with gcc 4.3.0.
14090         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14091         (gold_error_at_location, gold_warning_at_location): Use it.
14092         * configure.ac: Check whether we can compile and use a template
14093         function with a printf attribute.
14094         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14095         when jumping over bytes.
14096         * object.cc: Instantiate Object::read_section_data.
14097         * debug.h: Include <cstring>
14098         * dwarf_reader.cc: Include <algorithm>
14099         * main.cc: Include <cstring>.
14100         * options.cc: Include <cstring>.
14101         * output.cc: Include <cstring>.
14102         * script.cc: Include <cstring>.
14103         * script.h: Include <string>.
14104         * symtab.cc: Include <cstring> and <algorithm>.
14105         * target-select.cc: Include <cstring>.
14106         * version.cc: Include <string>.
14107         * testsuite/testmain.cc: Include <cstdlib>.
14108         * configure, config.in: Rebuild.
14109
14110 2008-03-25  Ian Lance Taylor  <iant@google.com>
14111
14112         * options.cc: Include "../bfd/bfdver.h".
14113         (options::help): Print bug reporting address.
14114
14115         * version.cc (print_version): Adjust output for current value of
14116         BFD_VERSION_STRING.
14117
14118         * NEWS: New file.
14119
14120         * options.cc (options::help): Print list of supported targets.
14121         * target-select.h: Include <vector>.
14122         (class Target_selector): Make machine_, size_, and is_big_endian_
14123         fields const.  Add bfd_name_ and instantiated_target_ fields.
14124         (Target_selector::Target_selector): Add bfd_name parameter.
14125         (Target_selector::recognize): Make non-virtual, call
14126         do_recognize.
14127         (Target_selector::recognize_by_name): Make non-virtual, call
14128         do_recognize_by_name.
14129         (Target_selector::supported_names): New function.
14130         (Target_selector::bfd_name): New function.
14131         (Target_selector::do_instantiate_target): New pure virtual
14132         function.
14133         (Target_selector::do_recognize): New virtual function.
14134         (Target_selector::do_recognize_by_name): New virtual function.
14135         (Target_selector::instantiate_target): New private function.
14136         (supported_target_names): Declare.
14137         * target-select.cc (Target_selector::Target_selector): Update for
14138         new parameter and fields.
14139         (select_target_by_name): Check that the name matches before
14140         calling recognize_by_name.
14141         (supported_target_names): New function.
14142         * i386.cc (class Target_selector_i386): Update Target_selector
14143         constructor call.  Remove recognize and recognize_by_name.  Add
14144         do_instantiate_target.
14145         * x86_64.cc (class Target_selector_x86_64): Likewise.
14146         * testsuite/testfile.cc (class Target_selector_test): Update for
14147         changes to Target_selector.
14148
14149         * README: Rewrite, with some notes on unsupported features.
14150
14151 2008-03-24  Cary Coutant  <ccoutant@google.com>
14152
14153         * i386.cc (Target_i386::Got_type): New enum declaration.
14154         (Target_i386::Scan::local): Updated callers of Output_data_got
14155         member functions.
14156         (Target_i386::Scan::global): Likewise.
14157         (Target_i386::Relocate::relocate): Likewise.
14158         (Target_i386::Relocate::relocate_tls): Likewise.
14159         * object.h (Got_offset_list): New class.
14160         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14161         (Sized_relobj::local_got_offset): Likewise.
14162         (Sized_relobj::set_local_got_offset): Likewise.
14163         (Sized_relobj::local_has_tls_got_offset): Removed.
14164         (Sized_relobj::local_tls_got_offset): Removed.
14165         (Sized_relobj::set_local_tls_got_offset): Removed.
14166         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14167         * output.cc (Output_data_got::add_global): Added got_type parameter.
14168         (Output_data_got::add_global_with_rel): Likewise.
14169         (Output_data_got::add_global_with_rela): Likewise.
14170         (Output_data_got::add_global_pair_with_rel): New function.
14171         (Output_data_got::add_global_pair_with_rela): New function.
14172         (Output_data_got::add_local): Added got_type parameter.
14173         (Output_data_got::add_local_with_rel): Likewise.
14174         (Output_data_got::add_local_with_rela): Likewise.
14175         (Output_data_got::add_local_pair_with_rel): New function.
14176         (Output_data_got::add_local_pair_with_rela): New function.
14177         (Output_data_got::add_global_tls): Removed.
14178         (Output_data_got::add_global_tls_with_rel): Removed.
14179         (Output_data_got::add_global_tls_with_rela): Removed.
14180         (Output_data_got::add_local_tls): Removed.
14181         (Output_data_got::add_local_tls_with_rel): Removed.
14182         (Output_data_got::add_local_tls_with_rela): Removed.
14183         * output.h (Output_data_got::add_global): Added got_type parameter.
14184         (Output_data_got::add_global_with_rel): Likewise.
14185         (Output_data_got::add_global_with_rela): Likewise.
14186         (Output_data_got::add_global_pair_with_rel): New function.
14187         (Output_data_got::add_global_pair_with_rela): New function.
14188         (Output_data_got::add_local): Added got_type parameter.
14189         (Output_data_got::add_local_with_rel): Likewise.
14190         (Output_data_got::add_local_with_rela): Likewise.
14191         (Output_data_got::add_local_pair_with_rel): New function.
14192         (Output_data_got::add_local_pair_with_rela): New function.
14193         (Output_data_got::add_global_tls): Removed.
14194         (Output_data_got::add_global_tls_with_rel): Removed.
14195         (Output_data_got::add_global_tls_with_rela): Removed.
14196         (Output_data_got::add_local_tls): Removed.
14197         (Output_data_got::add_local_tls_with_rel): Removed.
14198         (Output_data_got::add_local_tls_with_rela): Removed.
14199         * resolve.cc (Symbol::override_base_with_special): Removed
14200         reference to has_got_offset_ field.
14201         * symtab.cc (Symbol::init_fields): Replaced initialization
14202         of got_offset_ with got_offsets_.  Removed initialization
14203         of has_got_offset_
14204         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14205         (Symbol::got_offset): Likewise.
14206         (Symbol::set_got_offset): Likewise.
14207         (Symbol::has_tls_got_offset): Removed.
14208         (Symbol::tls_got_offset): Removed.
14209         (Symbol::set_tls_got_offset): Removed.
14210         (Symbol::got_offset_): Removed.
14211         (Symbol::tls_mod_got_offset_): Removed.
14212         (Symbol::tls_pair_got_offset_): Removed.
14213         (Symbol::got_offsets_): New field.
14214         (Symbol::has_got_offset): Removed.
14215         (Symbol::has_tls_mod_got_offset): Removed.
14216         (Symbol::has_tls_pair_got_offset): Removed.
14217         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14218         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14219         member functions.
14220         (Target_x86_64::Scan::global): Likewise.
14221         (Target_x86_64::Relocate::relocate): Likewise.
14222         (Target_x86_64::Relocate::relocate_tls): Likewise.
14223
14224 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14225
14226         * yyscript.y: Fix spelling error in comment.
14227
14228 2008-03-24  Ian Lance Taylor  <iant@google.com>
14229
14230         * options.h (class General_options): Define build_id option.
14231         * layout.h (class Layout): Declare write_build_id, create_note,
14232         create_build_id.  Add build_id_note_ member.
14233         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14234         "libiberty.h", "md5.h", "sha1.h".
14235         (Layout::Layout): Initialize eh_frame_data_,
14236         eh_frame_hdr_section_, and build_id_note_.
14237         (Layout::finalize): Call create_build_id.
14238         (Layout::create_note): New function, broken out of
14239         Layout::create_gold_note.
14240         (Layout::create_gold_note): Call create_note.
14241         (Layout::create_build_id): New function.
14242         (Layout::write_build_id): New function.
14243         (Close_task_runner::run): Call write_build_id.
14244
14245         * x86_64.cc: Correct license to GPLv3.
14246
14247 2008-03-23  Ian Lance Taylor  <iant@google.com>
14248
14249         * options.cc: Include "demangle.h".
14250         (parse_optional_string): New function.
14251         (parse_long_option): Handle takes_optional_argument.
14252         (parse_short_option): Update dash_z initializer.  Handle
14253         takes_optional_argument.
14254         (General_options::General_options): Initialize do_demangle_.
14255         (General_options::finalize): Set do_demangle_.  Handle demangling
14256         style.
14257         * options.h (parse_optional_string): Declare.
14258         (struct One_option): Add optional_arg field.  Update constructor.
14259         Update call constructor calls.  Add takes_optional_argument
14260         function.
14261         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14262         (DEFINE_optional_string): Define.
14263         (General_options::demangle): Change from DEFINE_bool to
14264         DEFINE_optional_string.
14265         (General_options::no_demangle): New function.
14266         (General_options::do_demangle): New function.
14267         (General_options::set_do_demangle): New function.
14268         (General_options::execstack_status_): Move definition to end of
14269         class definition.
14270         (General_options::static_): Likewise.
14271         (General_options::do_demangle_): New field.
14272         * object.cc (big_endian>::get_symbol_location_info): Call
14273         Options::do_demangle, not Options::demangle.
14274         * symtab.cc (demangle): Likewise.
14275
14276 2008-03-22  Ian Lance Taylor  <iant@google.com>
14277
14278         * gold.h: Include <cstddef> and <sys/types.h>
14279         * options.h: Include <cstring>.
14280
14281 2008-03-21  Ian Lance Taylor  <iant@google.com>
14282
14283         * Added source code to GNU binutils.
14284 \f
14285 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14286
14287 Copying and distribution of this file, with or without modification,
14288 are permitted in any medium without royalty provided the copyright
14289 notice and this notice are preserved.
14290
14291 Local Variables:
14292 mode: change-log
14293 left-margin: 8
14294 fill-column: 74
14295 version-control: never
14296 End: