9d48cd0f0264a4195f3425b67c11b4b44860da53
[platform/upstream/binutils.git] / gold / ChangeLog
1 2013-01-07  Cary Coutant  <ccoutant@google.com>
2
3         PR gold/14993
4         * output.cc (Output_section::add_input_section): For incremental
5         updates, don't track input sections that are allocated from patch
6         space.
7
8 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
9             Ian Lance Taylor  <iant@google.com>
10
11         PR gold/14897
12         * configure.ac (--enable-ld): Removed.
13         (install_as_default): Set to yes only for --enable-gold=default
14         or --disable-ld.
15         * configure: Regenerated.
16
17 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
18
19         * options.h (General_options): Add -fuse-ld= for GCC linker
20         option compatibility.
21
22 2013-01-04  Cary Coutant  <ccoutant@google.com>
23
24         * configure.ac: Fix typo restoring CXXFLAGS.
25         * configure: Regenerate.
26
27 2013-01-04  Cary Coutant  <ccoutant@google.com>
28
29         * testsuite/Makefile.am (CXXLINK_S): New macro.
30         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
31         * testsuite/Makefile.in: Regenerate.
32
33 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
34
35         * version.cc (print_version): Update copyright year to 2013.
36
37 2012-12-20  Ian Lance Taylor  <iant@google.com>
38
39         * layout.cc (Layout::special_ordering_of_input_section): New
40         function.
41         (Layout::layout): If input section requires special ordering, must
42         sort input sections.
43         (Layout::make_output_section): May sort .text input sections.
44         (Layout::is_section_name_prefix_grouped): Remove.
45         * layout.h (class Layout): Declare
46         special_ordering_of_input_section.  Don't declare
47         is_section_name_prefix_grouped.
48         * output.cc (Output_section::add_input_section): Revert last
49         change.
50         (Output_section::Input_section_sort::match_file_name): Don't crash
51         if called on output section data.
52         (Output_section::Input_section_sort_compare): Sort based on
53         special ordering.
54         (Output_section::Input_section_sort_section_order_index_compare):
55         Revert last patch.
56         (Output_section::sort_attached_input_sections): Likewise.
57
58 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
59
60         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
61         * layout.h (Layout::is_section_name_prefix_grouped): New function.
62         * output.cc (Output_section::add_input_section): Check if section
63         name contains special prefix.  Keep input sections to sort such
64         sections.
65         (Output_section::Input_section_sort_section_order_index_compare
66          ::operator()): Group sections according to prefixes.
67         (Output_section::sort_attached_input_sections): Add condition to
68         Input_section_entry constructor call.
69         * testsuite/Makefile.am (text_section_grouping): New test.
70         * testsuite/Makefile.in: Regenerate.
71         * testsuite/text_section_grouping.cc: New file.
72         * testsuite/text_section_grouping.sh: New file.
73
74 2012-12-17  Nick Clifton  <nickc@redhat.com>
75
76         * Makefile.am: Add copyright notice.
77         * NEWS: Likewise.
78         * README: Likewise.
79         * configure.ac: Likewise.
80         * ftruncate.c: Likewise.
81         * Makefile.in: Regenerate.
82
83 2012-12-14  Cary Coutant  <ccoutant@google.com>
84
85         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
86         --no-as-needed flag.
87         (exception_separate_shared_12_test): Likewise.
88         (incremental_copy_test): Likewise.
89         * testsuite/Makefile.in: Regenerate.
90
91 2012-12-14  Cary Coutant  <ccoutant@google.com>
92
93         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
94         (Dwp_output_file::Dwp_index::enter_set): Add assert.
95
96 2012-12-12  Alan Modra  <amodra@gmail.com>
97
98         * powerpc.cc (class Track_tls): New.
99         (class Relocate, class Scan): Inherit Track_tls.
100         (Target_powerpc::Scan::local, global): Track tls optimization
101         and avoid creating plt entry for __tls_get_addr if all uses
102         are optimized away.
103         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
104
105 2012-12-12  Alan Modra  <amodra@gmail.com>
106
107         * options.h (General_options): Add --toc-sort/--no-toc-sort.
108         Replace no_toc_optimize with toc_optimize.
109         * output.h (Output_section::input_sections): Provide non-const variant.
110         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
111         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
112         accessors.
113         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
114         (class Sort_toc_sections): New.
115         (Target_powerpc::do_finalize_sections): Sort toc sections.
116         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
117
118 2012-12-10  Roland McGrath  <mcgrathr@google.com>
119
120         * testsuite/binary_unittest.cc (read_all): New function.
121         (Sized_binary_test): Use it instead of ::read.
122         * fileread.cc (do_read): Don't assume pread always reads the whole
123         amount in a single call.
124
125 2012-12-10  Alan Modra  <amodra@gmail.com>
126
127         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
128         Set EM_PPC64 or EM_PPC here.
129         (Target_selector_powerpc::do_recognize): Delete.
130
131 2012-12-10  Alan Modra  <amodra@gmail.com>
132
133         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
134         stub_table_.
135         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
136
137 2012-12-07  Roland McGrath  <mcgrathr@google.com>
138
139         * testsuite/binary_unittest.cc (Sized_binary_test):
140         Use open_descriptor rather than ::open.
141
142 2012-12-07  Alan Modra  <amodra@gmail.com>
143
144         * powerpc.cc (Stub_table::do_write): Delete redundant Address
145         typedef and invalid_address constant.
146         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
147         instantiate constants.
148
149 2012-12-06  Roland McGrath  <mcgrathr@google.com>
150
151         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
152         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
153         * aclocal.m4: Regenerate.
154         * configure: Regenerate.
155         * Makefile.in: Regenerate.
156         * testsuite/Makefile.in: Regenerate.
157
158 2012-12-07  Alan Modra  <amodra@gmail.com>
159
160         * options.h (General_options): Add no_toc_optimize.
161         * powerpc.cc (ok_lo_toc_insn): New function.
162         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
163
164 2012-12-06  Alan Modra  <amodra@gmail.com>
165
166         * options.h (General_options): Add plt_align, plt_static_chain,
167         plt_thread_safe.  Update stub_group_size help text.
168         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
169         for new plt_thread_safe_ var.
170         (use_plt_offset): Correct comments.
171         (Target_powerpc::do_relax): Look for thread creation symbols to
172         determine default plt_thread_safe value.  Clear plt call stubs
173         as well as branch stubs each iteration.
174         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
175         insn constants.
176         (l, hi, ha, write_insn): Move earlier.
177         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
178         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
179         plt stubs too.
180         (Stub_table::update_size): Adjust.
181         (Stub_table::prev_size, set_prev_size): Delete.
182         (Stub_table::stub_align): Let --plt-align affect result.
183         (Stub_table::plt_call_size): Calculate sizes for various stubs.
184         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
185         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
186         (Stub_table::do_write): Support more stub variants.
187
188 2012-12-04  Alan Modra  <amodra@gmail.com>
189
190         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
191         (Target_powerpc::do_define_standard_symbols): New function.
192
193 2012-12-03  Alan Modra  <amodra@gmail.com>
194
195         * output.h: Formatting, whitespace.
196
197 2012-12-03  Alan Modra  <amodra@gmail.com>
198
199         * layout.h (Layout::get_executable_sections): Declare.
200         * layout.cc (Layout::get_executable_sections): New function.
201         * arm.cc (Target_arm::group_sections): Use it.
202         (Arm_output_section::group_sections): Delete now redundant test.
203         * output.cc (Output_reloc::Output_reloc): Add is_relative.
204         param to handle relative relocs.
205         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
206         (Output_data_reloc::add_absolute): Adjust.
207         (Output_data_reloc::add_relative): New function.
208         (Output_data::reset_data_size): New function.
209         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
210         (Output_section::set_addralign): New function.
211         (Output_section::checkpoint_set_addralign): New function.
212         (Output_section::clear_section_offsets_need_adjustment): New function.
213         (Output_section::input_sections): Make public.
214         * powerpc.cc (class Output_data_brlt_powerpc): New.
215         (class Stub_table, class Stub_control): New.
216         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
217         stub_table_, set_stub_table, stub_table): New vectors and accessor
218         functions.
219         (Target_powerpc::do_may_relax, do_relax, push_branch,
220         new_stub_table, stub_tables, brlt_section, group_sections,
221         add_branch_lookup_table, find_branch_lookup_table,
222         write_branch_lookup_table, make_brlt_section): New functions.
223         (Target_powerpc::struct Sort_sections, class Branch_info): New.
224         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
225         branch_info_): New vars.
226         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
227         make call stubs here.
228         (Output_data_glink): Remove all call stub handling from this class.
229         (Target_powerpc::Scan::local, global): Save interesting branch
230         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
231         (Target_powerpc::do_finalize_sections): Only make reg save/restore
232         functions on final link.
233         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
234         Handle long branch destinations too.
235         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
236         do_plt_address_for_local): Adjust lookup of plt call stubs.
237
238 2012-11-30  Alan Modra  <amodra@gmail.com>
239
240         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
241         relocs against protected symbols when building 32-bit shared libs.
242
243 2012-11-30  Alan Modra  <amodra@gmail.com>
244
245         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
246         param.  Call got_section() to make .got.  Update all callers
247         and their callers and so on.
248
249 2012-11-30  Alan Modra  <amodra@gmail.com>
250
251         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
252         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
253         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
254         value if it already exists.
255
256 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
257
258         PR gold/14858
259         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
260
261 2012-11-14  Roland McGrath  <mcgrathr@google.com>
262
263         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
264         than bfc instruction for data sandboxing.
265
266 2012-11-08  Alan Modra  <amodra@gmail.com>
267
268         * po/POTFILES.in: Regenerate.
269
270 2012-11-05  Alan Modra  <amodra@gmail.com>
271
272         * configure.ac: Apply 2012-09-10 change to config.in here.
273         * configure: Regenerate.
274
275 2012-11-05  Alan Modra  <amodra@gmail.com>
276
277         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
278         (struct Opd_ent): Use "Address" rather than "Offset".
279         (Output_data_got_powerpc::got_base_offset): Return Valtype.
280         (Target_powerpc::got_section): Make public.
281         (Target_powerpc::scan_relocs): Move code setting symbols..
282         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
283         Create _SDA_BASE_ only when referenced.
284
285 2012-11-02  Roland McGrath  <mcgrathr@google.com>
286
287         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
288         from last change.
289
290 2012-11-01  Roland McGrath  <mcgrathr@google.com>
291
292         * target.h (Sized_target::relocate_relocs): Use Elf_Off
293         for offset_in_output_section parameter.
294         (Sized_target::relocate_special_relocatable): Likewise.
295         * arm.cc (Target_arm::relocate_relocs): Likewise.
296         (Target_arm::relocate_special_relocatable): Likewise.
297         * i386.cc (Target_i386::relocate_relocs): Likewise.
298         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
299         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
300         * target-reloc.h (relocate_relocs): Likewise.
301         * testsuite/testfile.cc (Target_test): Likewise.
302         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
303         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
304
305         * system.h: Move inclusion of <clocale> to after <libintl.h> in
306         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
307
308         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
309         parameter, which is unused in the [!F_SETFD] case.
310
311         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
312         SYMNDX to off_t before comparing it to this->data_size().
313         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
314         * incremental.cc (Output_section_incremental_inputs::do_write):
315         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
316
317         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
318
319 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
320
321         * gold.cc (Target_arm::do_adjust_elf_header): Add the
322         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
323         in EABI_VER5.
324
325 2012-10-29  Cary Coutant  <ccoutant@google.com>
326
327         * dwp.cc (usage): Add file and exit status parameters;
328         add --help and --version options.
329         (print_version): New function.
330         (main): Add --help and --version options.
331
332 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
333
334         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
335         final_layout_sequence.txt.
336         * testsuite/Makefile.in: Regenerated.
337
338 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
339
340         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
341         COMPILE generated by automake.
342         (LINK1): Likewise.
343         (CXXCOMPILE1): Likewise.
344         (CXXLINK1): Likewise.
345         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
346         (LINK): Likewise.
347         (CXXCOMPILE): Likewise.
348         (CXXLINK): Likewise.
349         * testsuite/Makefile.in: Regenerated.
350
351 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
352
353         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
354         on bad fwrite return.
355
356 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
357
358         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
359         on val.
360
361 2012-10-23  Cary Coutant  <ccoutant@google.com>
362
363         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
364         * testsuite/Makefile.in: Regenerate.
365         * testsuite/dwp_test.h: New source file.
366         * testsuite/dwp_test_1.cc: New source file.
367         * testsuite/dwp_test_1.s: New source file.
368         * testsuite/dwp_test_1.sh: New source file.
369         * testsuite/dwp_test_1b.cc: New source file.
370         * testsuite/dwp_test_1b.s: New source file.
371         * testsuite/dwp_test_2.cc: New source file.
372         * testsuite/dwp_test_2.s: New source file.
373         * testsuite/dwp_test_2.sh: New source file.
374         * testsuite/dwp_test_main.cc: New source file.
375         * testsuite/dwp_test_main.s: New source file.
376
377 2012-10-23  Cary Coutant  <ccoutant@google.com>
378
379         * dwp.h: New header file.
380         * dwp.cc: New source file.
381         * gold.h: Move shared declarations to system.h.
382         * system.h: New header file.
383         * Makefile.am: Add dwp.
384         * Makefile.in: Regenerate.
385
386 2012-10-23  Cary Coutant  <ccoutant@google.com>
387
388         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
389         Dwarf_info_reader::read_from_pointer.
390         (Dwarf_pubnames_table::read_header): Likewise.
391         (Dwarf_pubnames_table::next_name): Likewise.
392         (Dwarf_die::read_attributes): Likewise.
393         (Dwarf_die::skip_attributes): Likewise.
394         (Dwarf_info_reader::read_from_pointer): New function template.
395         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
396         (Dwarf_pubnames_table): Likewise.
397         (Dwarf_info_reader::read_from_pointer): New function template.
398         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
399         Dwarf_pubnames_table ctor.
400
401 2012-10-23  Cary Coutant  <ccoutant@google.com>
402
403         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
404         abbrev_shndx.
405         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
406         abbrev_shndx_.
407         (Dwarf_info_reader::set_abbrev_shndx): New method.
408         (Dwarf_info_reader::abbrev_shndx_): New data member.
409
410 2012-10-23  Cary Coutant  <ccoutant@google.com>
411
412         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
413         from object, not parameters.
414         (Dwarf_info_reader::parse): Likewise.
415         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
416         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
417         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
418         methods.
419
420 2012-10-23  Cary Coutant  <ccoutant@google.com>
421
422         * fileread.cc (Input_file::Input_file): New constructor.
423         * fileread.h (class Input_file): Add new constructor.
424
425 2012-10-18  Alan Modra  <amodra@gmail.com>
426
427         PR gold/14727
428         * object.cc (Relobj::is_section_name_included): Also match
429         .sdata personality section.
430
431 2012-10-18  Alan Modra  <amodra@gmail.com>
432
433         * target-reloc.h (class Default_comdat_behavior): New, package up..
434         (get_comdat_behaviour): ..this.
435         (relocate_section): Add Relocate_comdat_behavior template arg,
436         adjust code to suit.
437         * arm.cc (Target_arm::relocate_section): Adjust to suit.
438         (Target_arm::scan_reloc_section): Likewise.
439         * i386.cc (Target_i386::relocate_section): Likewise.
440         * sparc.cc (Target_sparc::relocate_section): Likewise.
441         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
442         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
443         * powerpc.cc (class Relocate_comdat_behavior): New.
444         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
445         gold::relocate_section with new template arg.
446
447 2012-10-18  Alan Modra  <amodra@gmail.com>
448
449         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
450         dynamic relocs for GOT_TPREL got entries, without symbol if
451         resolving locally.
452         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
453         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
454         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
455
456 2012-10-17  Alan Modra  <amodra@gmail.com>
457
458         PR gold/14726
459         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
460
461 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
462
463         * layout.cc (Layout::include_section): Keep sections marked
464         SHF_EXCLUDE when doing relocatable links.
465
466 2012-10-16  Alan Modra  <amodra@gmail.com>
467
468         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
469         (Target_powerpc::do_finalize_sections): Call it.
470         (Output_data_save_res): New class and supporting functions.
471         (Target_powerpc::symval_for_branch): Only look up .opd entry for
472         normal symbols defined in object files.
473
474 2012-10-12  Alan Modra  <amodra@gmail.com>
475
476         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
477         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
478         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
479         section if scan_opd_relocs not yet called.
480         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
481
482 2012-10-12  Alan Modra  <amodra@gmail.com>
483
484         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
485         add_local_ifunc_entry): Revert last change.
486         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
487
488 2012-10-05  Alan Modra  <amodra@gmail.com>
489
490         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
491         do_plt_address_for_global): New functions.
492         (Output_data_got_powerpc::do_write): Don't segfault when linking
493         statically.
494         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
495         add_local_ifunc_entry): Return true on adding entry..
496         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
497         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
498         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
499         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
500         set up symbols here.
501         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
502         syms here.  Do so even when no .iplt.  Don't segfault when linking
503         statically.
504         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
505         new variants without reloc param.
506         (Glink_sym_ent::Glink_sym_ent): Likewise.
507         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
508         reloc when refs will resolve to plt call stub.
509         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
510         R_PPC_PLTREL24 to resolve locally.
511         (Target_powerpc::Scan::global): Correct ifunc handling.
512         (Target_powerpc::Relocate::relocate): Correct local sym glink
513         lookup.  Don't destroy "value" when we have a plt call stub,
514         and when checking plt call validity.
515         (Target_powerpc::do_dynsym_value): Simplify.
516
517 2012-10-05  Alan Modra  <amodra@gmail.com>
518
519         * i386.cc (Output_data_plt_i386::address_for_global,
520         address_for_local): Add plt offset to returned value.  Adjust uses.
521         * sparc.cc (Output_data_plt_sparc::address_for_global,
522         address_for_local): Likewise.
523         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
524         address_for_local): Likewise.
525         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
526         address_for_local): Likewise.
527         * target.h (Target::plt_address_for_global, plt_address_for_local):
528         Update comment.
529         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
530         (Output_data_got::Got_entry::write): Nor here.
531         * output.h: Comment fix.
532
533 2012-10-02  Jiong Wang  <jiwang@tilera.com>
534
535         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
536         global_offset_table_ value for larget got.
537         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
538
539 2012-09-29  Alan Modra  <amodra@gmail.com>
540
541         * powerpc.cc (Target_powerpc::iplt_): New output section.
542         (Target_powerpc::iplt_section, make_iplt_section,
543         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
544         (Target_powerpc::make_plt_entry): Handle ifunc syms.
545         Target_powerpc::plt_entry_count): Count iplt entries too.
546         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
547         reloc section in constructor.  New params.
548         (Target_powerpc::make_plt_section): Create reloc section here instead.
549         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
550         functions.
551         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
552         (Output_data_glink::add_entry, find_entry): New functions to
553         deal with local syms.
554         (Glink_sym_ent): Add support for local syms.
555         (Output_data_glink::do_write): Handle ifunc plt entries.
556         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
557         (Target_powerpc::Scan::local, global): Handle ifunc syms.
558         (Target_powerpc::Relocate::relocate): Likewise.
559         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
560
561 2012-09-25  Alan Modra  <amodra@gmail.com>
562
563         * object.h (Sized_relobj_file::adjust_local_symbol,
564         do_adjust_local_symbol): New functions.
565         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
566         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
567         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
568         and irregular opd entry spacing.
569         (Powerpc_relobj::do_read_relocs): Add opd size checks.
570         (Global_symbol_visitor_opd): New functor.
571         (Target_powerpc::do_finalize_sections): Omit global symbols defined
572         on deleted opd entries.
573
574 2012-09-15  Jiong Wang  <jiwang@tilera.com>
575
576         * tilegx.cc: New file.
577         * Makefile.am (TARGETSOURCES): Add tilegx.cc
578         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
579         * configure.tgt: Add entries for tilegx*.
580         * configure.ac: Likewise.
581         * Makefile.in: Rebuild.
582         * configure: Likewise.
583         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
584         tilegx.
585
586 2012-09-13  Alan Modra  <amodra@gmail.com>
587
588         * target-reloc.h (scan_relocs): Call scan.local for relocs
589         against symbols in discarded sections.  Pass is_discarded
590         param.
591         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
592         Add is_discarded param.
593         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
594         is_discarded to flag opd entry as discarded.  Don't emit dyn
595         relocs on such entries.
596         (Target_powerpc::Scan::global): Similarly detect and handle
597         such opd entries.
598         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
599         opd_ent_.  Update all uses.
600         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
601         (Target_powerpc::relocate_section): Zero out discarded opd
602         entry relocs.
603
604 2012-09-12  Ian Lance Taylor  <iant@google.com>
605
606         PR gold/14570
607         * output.cc: Rename Output_data_got template parameter from size
608         to got_size for all functions.  Compile all variants of
609         Output_data_got.
610         (Output_data_got::Got_entry::write): Correct use of size for
611         symbol value.  Use local_is_tls rather than casting to
612         Sized_relobj_file.
613         * object.h (class Object): Add local_is_tls and do_local_is_tls.
614         (class Sized_relobj_file): Add do_local_is_tls.
615         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
616
617 2012-09-11  Alan Modra  <amodra@gmail.com>
618
619         PR gold/14566
620         * layout.cc (Layout::set_segment_offsets): When using
621         common-page-size alignment, ensure we are on a new max-page-size
622         page.
623         * output.cc (Output_segment::set_section_addresses): Use
624         abi_pagesize, not common_pagesize for relro boundary.
625         (Output_segment::set_offset): Likewise.
626
627 2012-09-11  Alan Modra  <amodra@gmail.com>
628
629         * output.h (Output_data_got::add_global_tls, add_local_tls,
630         add_local_tls_pair): New functions.
631         (Output_data_got::add_local_pair_with_rel): Remove second
632         reloc param.  Expand comment.
633         (Output_data_got::Got_entry): Rename use_plt_offset_ to
634         use_plt_or_tls_offset_, similarly for constructor param.
635         (Output_data_got::Got_entry::write): Add got_index param.
636         * output.cc (Output_data_got::add_global_tls, add_local_tls,
637         add_local_tls_pair): New functions.
638         (Output_data_got::Got_entry::write): Handle tls symbols
639         with use_plt_or_tls_offset_ set specially.
640         (Output_data_got::add_local_pair_with_rel): Only one reloc.
641         (Output_data_got::do_write): Replace iterator with index, pass
642         index to entry write function.
643         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
644         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
645         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
646         call.
647         * i386.cc (Target_i386::Scan::local): Likewise.
648         * sparc.cc (Target_sparc::Scan::local): Likewise.
649         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
650         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
651         do_tls_offset_for_global): New functions.
652         (Target_powerpc::Scan::local): Correct TLS relocations and got
653         entry values.
654         (Target_powerpc::Scan::global): Don't emit unnecessary
655         dynamic relocations on TLS GOT entries.
656
657 2012-09-10  Matthias Klose  <doko@ubuntu.com>
658
659         * config.in: Disable sanity check for kfreebsd.
660
661 2012-09-10  Sterling Augustine  <saugustine@google.com>
662
663         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
664         (Gdb_index::pubtypes_read): New parameter.
665         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
666         to calls.
667         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
668         pubtypes_object_.
669
670 2012-09-09  Alan Modra  <amodra@gmail.com>
671
672         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
673         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
674         * gc.h (gc_process_relocs): Call target gc_add_reference.
675         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
676         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
677         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
678         unnecessary cast.
679         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
680         to cater for when we don't need code offset.  Update use.
681         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
682         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
683         set_opd_valid): New functions.
684         (Target_powerpc::do_gc_add_reference): New function.
685         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
686         stashed refs.
687         (Target_powerpc::do_gc_mark_symbol): New function.
688
689 2012-09-06  Cary Coutant  <ccoutant@google.com>
690
691         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
692         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
693         (Dwarf_die::skip_attributes): Likewise.
694         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
695         * testsuite/gdb_index_test.cc (inline_func_1): New function.
696         (main): Call it.
697         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
698
699 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
700
701         * testsuite/script_test_3.t: Add .got.plt output section
702         statement.
703         * testsuite/script_test_4.t: Likewise.
704
705 2012-09-05  Alan Modra  <amodra@gmail.com>
706
707         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
708         update all uses and lose "enum" when using type.
709
710 2012-09-05  Alan Modra  <amodra@gmail.com>
711
712         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
713         * configure: Regenerate.
714         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
715         (plugin_final_layout.stdout): Likewise.
716         (memory_test): Set page sizes to 0x1000.
717         * testsuite/Makefile.in: Regenerate.
718         * testsuite/discard_locals_test.sh: Add FIXME comment.
719         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
720         * testsuite/pr14265.t: Add .got output section statement.
721         * testsuite/script_test_2.t: Likewise.
722         * testsuite/script_test_3.t: Likewise.
723         * testsuite/script_test_4.t: Likewise.
724         * testsuite/script_test_5.t: Likewise.
725         * testsuite/script_test_6.t: Likewise.
726         * testsuite/script_test_7.t: Likewise.
727         * testsuite/script_test_9.t: Likewise.
728
729 2012-09-05  Alan Modra  <amodra@gmail.com>
730
731         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
732         (Powerpc_relocate_functions::Status): New typedef.
733         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
734         (Target_powerpc::Scan::local): Handle REL64.
735         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
736         for REL32 and REL64.
737         (Target_powerpc::symval_for_branch): New function, extracted from..
738         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
739         checks.  Report overflow errors.
740
741 2012-09-05  Alan Modra  <amodra@gmail.com>
742
743         * object.h (Sized_relobj_file::emit_relocs): Delete.
744         (Sized_relobj_file::emit_relocs_reltype): Delete.
745         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
746         relocate_relocs for --emit-relocs.
747         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
748         * output.h: Update comment.
749         (Output_segment::first_section): New function.
750         (Output_segment::first_section_load_address): Use first_section.
751         * output.cc (Output_segment::first_section): New function extracted..
752         (Output_segment::first_section_load_address): ..from here.  Delete.
753         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
754         * target.h (Sized_target::relocate_for_relocatable): Likewise.
755         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
756         adjust call to target.h function.
757         * i386.cc (Target_i386): Likewise.
758         * sparc.cc (Target_sparc): Likewise.
759         * x86_64.cc (Target_x86_64): Likewise.
760         * powerpc.cc (Target_powerpc): Likewise.
761         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
762         first tls section has section symbol for optimised local dynamic
763         output relocs.
764         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
765         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
766         optimised tls code.
767         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
768         Rename to relocate_relocs.  Update error message.
769
770 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
771
772         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
773         --just-symbols.
774
775 2012-08-31  Alan Modra  <amodra@gmail.com>
776
777         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
778         (Powerpc_relobj::toc_base_offset): New stub function.
779         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
780         got_mod_index_offset to tlsld_got_offset.  Update all refs.
781         (Target_powerpc::Relocate::enum skip_tls): New.
782         (Target_powerpc::call_tls_get_addr_): New var.
783         (Target_powerpc::is_branch_reloc): Move to file scope.
784         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
785         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
786         New functions.
787         (Target_powerpc::enum Got_type): Delete old values, add new ones.
788         (powerpc_info): Correct common_pagesize for ppc64.
789         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
790         (Powerpc_relocate_functions): Add overflow check enums and functions.
791         Add non-shift version of rela, rela_ua.  Delete all rel public
792         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
793         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
794         addr16_ha3, addr14 functions.
795         (Output_data_got_powerpc::add_constant_pair): New function.
796         (Output_data_got_powerpc::got_base_offset): Likewise.
797         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
798         (instruction constants): Sort, add some more.
799         (Output_data_glink::do_write): Add and use Address typedef.  Use
800         object->toc_base_offset() stub for 64-bit.
801         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
802         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
803         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
804         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
805         Always treat .opd relocs as against locally defined symbol.
806         Correct condition for RELATIVE relocs.
807         (Target_powerpc::do_finalize_sections): Test for NULL sections.
808         (Target_powerpc::Relocate::relocate): Use plt call stub as value
809         for 32-bit syms with a plt entry.  Correct ppc64 toc base
810         calculations.  Handle TLS relocs, and more.  Add overflow
811         checking and adjust for Powerpc_relocate_functions changes.
812         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
813         Reinstate --emit-relocs code with FIXME.
814
815 2012-08-30  Alan Modra  <amodra@gmail.com>
816
817         * layout.cc (Layout::set_segment_offsets): Set p_align to
818         abi_pagesize, not common_pagesize.
819         (Layout::relaxation_loop_body): Similarly use abi_pagesize
820         to determine whether file header can go in segment.
821
822 2012-08-30  Alan Modra  <amodra@gmail.com>
823
824         * output.h (Output_reloc::Output_reloc <output section>): Add
825         is_relative param.  Adjust calls.
826         (Output_reloc::add_output_section_relative): New functions.
827         * output.cc (Output_reloc::Output_reloc <output section>): Handle
828         is_relative.
829         (Output_reloc::symbol_value): Handle SECTION_CODE.
830
831 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
832
833         * gold.cc (queue_middle_tasks): Call layout again when unique
834         segments for sections is desired.
835         * layout.cc (Layout::Layout): Initialize new members.
836         (Layout::get_output_section_flags): New function.
837         (Layout::choose_output_section): Call get_output_section_flags.
838         (Layout::layout): Make output section for mapping to a unique segment.
839         (Layout::insert_section_segment_map): New function.
840         (Layout::attach_allocated_section_to_segment): Make unique segment for
841         output sections marked so.
842         (Layout::segment_precedes): Check for unique segments when sorting.
843         * layout.h (Layout::Unique_segment_info): New struct.
844         (Layout::Section_segment_map): New typedef.
845         (Layout::insert_section_segment_map): New function.
846         (Layout::get_output_section_flags): New function.
847         (Layout::is_unique_segment_for_sections_specified): New function.
848         (Layout::set_unique_segment_for_sections_specified): New function.
849         (Layout::unique_segment_for_sections_specified_): New member.
850         (Layout::section_segment_map_): New member.
851         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
852         Rename is_gc_pass_one to is_pass_one.
853         Rename is_gc_pass_two to is_pass_two.
854         Rename is_gc_or_icf to is_two_pass.
855         Check for which pass based on whether symbols data is present.
856         Make it two pass when unique segments for sections is desired.
857         * output.cc (Output_section::Output_section): Initialize new
858         members.
859         * output.h (Output_section::is_unique_segment): New function.
860         (Output_section::set_is_unique_segment): New function.
861         (Output_section::is_unique_segment_): New member.
862         (Output_section::extra_segment_flags): New function.
863         (Output_section::set_extra_segment_flags): New function.
864         (Output_section::extra_segment_flags_): New member.
865         (Output_section::segment_alignment): New function.
866         (Output_section::set_segment_alignment): New function.
867         (Output_section::segment_alignment_): New member.
868         (Output_segment::Output_segment): Initialize is_unique_segment_.
869         (Output_segment::is_unique_segment): New function.
870         (Output_segment::set_is_unique_segment): New function.
871         (Output_segment::is_unique_segment_): New member.
872         * plugin.cc (allow_unique_segment_for_sections): New function.
873         (unique_segment_for_sections): New function.
874         (Plugin::load): Add new functions to transfer vector.
875         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
876         * Makefile.in: Regenerate.
877         * testsuite/plugin_final_layout.sh: Check if unique segment
878         functionality works.
879         * testsuite/plugin_section_order.c (onload): Check if new interfaces
880         are available.
881         (allow_unique_segment_for_sections): New global.
882         (unique_segment_for_sections): New global.
883         (claim_file_hook): Call allow_unique_segment_for_sections.
884         (all_symbols_read_hook): Call unique_segment_for_sections.
885
886 2012-08-22  Cary Coutant  <ccoutant@google.com>
887
888         * layout.cc (Layout::include_section): Don't assert on GROUP
889         sections with --emit-relocs.
890
891 2012-08-21  Cary Coutant  <ccoutant@google.com>
892
893         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
894         if --export-dynamic-symbol names an undef symbol.
895
896 2012-08-18  Alan Modra  <amodra@gmail.com>
897
898         * powerpc.cc: Formatting and white space.
899         (Powerpc_relobj): Rename got2_section_ to special_.
900         Add opd_ent_shndx_ and opd_ent_off_ vectors.
901         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
902         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
903         (Target_powerpc): Add Address typedef and invalid_address.  Use
904         throughout.
905         (Target_powerpc::is_branch_reloc): New function.
906         (Powerpc_relocate_functions): Add Address typedef, use throughout.
907         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
908         for dst_mask, value and addend.
909         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
910         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
911         (Output_data_glink::do_write): Correct toc base.  Don't try to use
912         uint16_t for 24-bit offset.  Use get_output_section_offset and
913         check return.
914         (Target_powerpc::Scan::local): Handle more relocs.
915         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
916         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
917         Plug in toc restoring insn after plt calls.  Translate branches
918         to function descriptor symbols to corresponding entry point.
919         (Target_powerpc::relocate_for_relocatable): Check return from
920         get_output_section_offset.
921         * symtab.h: Comment typo.
922
923 2012-08-14  Ian Lance Taylor  <iant@google.com>
924
925         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
926         unsupported_relocal_local to call unsupported_reloc_global.
927
928 2012-08-14  Nick Clifton  <nickc@redhat.com>
929
930         PR ld/14265
931         * script-sections.cc (Sections_element::output_section_name): Add
932         keep return parameter.
933         (Output_section_element::match_name): Add keep return parameter.
934         Return the value of the keep_ member.
935         * script-sections.h (class Output_section): Update
936         output_section_name prototype.
937         * layout.cc (Layout::keep_input_section): New public member
938         function.
939         (Layout::choose_output_section): Pass keep parameter to
940         output_section_name.
941         * layout.h (class Layout): Add keep_input_section.
942         * object.cc (Sized_relobj_file::do_layout): Check for kept input
943         sections.
944         * testsuite/Makefile.am: Add a test.
945         * testsuite/Makefile.in: Regenerate.
946         * testsuite/pr14265.c: Source file for the test.
947         * testsuite/pr14265.t: Linker script for the test.
948         * testsuite/pr14265.sh: Shell script for the test.
949
950 2012-08-14  Alan Modra  <amodra@gmail.com>
951
952         * target.h (Target::output_section_name): New function.
953         (Target::do_output_section_name): New function.
954         * layout.cc (Layout::choose_output_section): Call the above.
955         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
956
957 2012-08-14  Alan Modra  <amodra@gmail.com>
958
959         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
960         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
961         for replace_constant call.
962         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
963         (Output_data_glink::do_print_to_mapfile): New function.
964         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
965         (Target_powerpc::Relocate::relocate): Likewise.
966
967 2012-08-14  Alan Modra  <amodra@gmail.com>
968
969         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
970         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
971         (Output_data_glink::add_entry,find_entry): Remove shndx param.
972         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
973         all references to shndx_.  Handle special case for R_PPC_PLTREL24
974         here.
975         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
976         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
977         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
978         here.
979         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
980         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
981
982 2012-08-12  Alan Modra  <amodra@gmail.com>
983
984         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
985         (glink insn constants): Use uint32_t.
986         (Output_data_glink::add_entry): Use insert, not [] operator.
987
988 2012-08-11  Alan Modra  <amodra@gmail.com>
989
990         * object.h (Sized_relobj_file::find_shdr): New function.
991         (Sized_relobj_file::find_special_sections): New function.
992         * object.cc (Sized_relobj_file::find_shdr): New function.
993         (Sized_relobj_file::find_eh_frame): Use find_shdr.
994         (Sized_relobj_file::find_special_sections): New function, split out..
995         (Sized_relobj_file::do_read_symbols): ..from here.
996         * output.h (Output_data_got::replace_constant): New function.
997         (Output_data_got::num_entries): New function.
998         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
999         (Output_data_got::got_offset): Protected rather than private.
1000         (Output_data_got::replace_got_entry): New function.
1001         * output.cc (Output_data_got::replace_got_entry): New function.
1002         * powerpc.cc (class Powerpc_relobj): New.
1003         (class Powerpc_relocate_functions): Delete all psymval variants or
1004         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1005         Implement _ha functions using corresponding _hi function.
1006         (Powerpc_relobj::find_special_sections): New function.
1007         (Target_powerpc::do_make_elf_object): New function.
1008         (class Output_data_got_powerpc): New.
1009         (class Output_data_glink): New.
1010         (class Powerpc_scan_relocatable_reloc): New.
1011         Many more changes througout file.
1012
1013 2012-08-09  Nick Clifton  <nickc@redhat.com>
1014
1015         * po/vi.po: Updated Vietnamese translation.
1016
1017 2012-08-07  Ian Lance Taylor  <iant@google.com>
1018
1019         * layout.cc (Layout::add_target_dynamic_tags): If
1020         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1021         plt_rel.
1022
1023 2012-07-30  Nick Clifton  <nickc@redhat.com>
1024
1025         * po/gold.pot: Updated template.
1026         * po/es.po: Updated Spanish translation.
1027
1028 2012-07-18  Cary Coutant  <ccoutant@google.com>
1029
1030         PR gold/14344
1031         * configure.ac: Add check for -gpubnames support.
1032         * configure: Regenerate.
1033         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1034         support; force -gno-pubnames.
1035         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1036         support.
1037         (gdb_index_test_4): New test.
1038         * testsuite/Makefile.in: Regenerate.
1039         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1040         * testsuite/gdb_index_test_2.sh: Likewise.
1041         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1042         * testsuite/gdb_index_test_4.sh: New script.
1043         * testsuite/gdb_index_test_comm.sh: New script with common code;
1044         don't look for space after colon.
1045
1046 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1047
1048         * gold.cc (queue_middle_tasks): Update function order only after
1049         deferred objects due to plugins are processed.
1050
1051 2012-07-11  Ian Lance Taylor  <iant@google.com>
1052
1053         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1054         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1055         (Target_arm::scan_reloc_for_stub): Likewise.
1056         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1057         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1058         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1059         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1060         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1061
1062 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1063             Ian Lance Taylor  <iant@google.com>
1064
1065         PR gold/14309
1066         * configure.ac: Test whether std::tr1::hash<off_t> works.
1067         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1068         needed.
1069         * output.h (class Output_fill): Add virtual destructor.
1070         * configure, config.in: Rebuild.
1071
1072 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1073
1074         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1075
1076 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1077
1078         * plugin.cc (Plugin::load): Handle position independent executables.
1079
1080 2012-06-06  Cary Coutant  <ccoutant@google.com>
1081
1082         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1083         add .debug_macro.
1084         (lines_only_debug_sections): Likewise.
1085         (gdb_fast_lookup_sections): New static array.
1086         (is_gdb_debug_section): Rename formal parameter.
1087         (is_lines_only_debug_section): Likewise.
1088         (is_gdb_fast_lookup_section): New function.
1089         (Layout::include_section): Check for ".zdebug_" prefix; pass
1090         section name suffix to is_gdb_debug_section, et al.; check for
1091         fast-lookup sections when building .gdb_index.
1092         * options.h (--strip-debug-gdb): Update GDB version number.
1093
1094 2012-06-06  Cary Coutant  <ccoutant@google.com>
1095
1096         * configure.ac: Add check for fallocate.
1097         * configure: Regenerate.
1098         * config.in: Regenerate.
1099
1100         * options.h (class General_options): Add --mmap-output-file and
1101         --posix-fallocate options.
1102         * output.cc: (posix_fallocate): Remove; replace with...
1103         (gold_fallocate): New function.
1104         (Output_file::map_no_anonymous): Call gold_fallocate.
1105         (Output_file::map): Check --mmap-output-file option.
1106
1107 2012-06-05  Jing Yu  <jingyu@google.com>
1108
1109         * gold.h (textdomain): Add do {} to empty while(0).
1110         (bindtextdomain): Likewise.
1111
1112 2012-06-04  Cary Coutant  <ccoutant@google.com>
1113
1114         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1115         has_dynsym_index.
1116
1117 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1118
1119         * symtab.cc (Symbol_table::define_special_symbol):
1120         Initialize *poldsym to prevent uninitialized variable errors.
1121
1122 2012-05-23  Cary Coutant  <ccoutant@google.com>
1123
1124         * layout.cc (Layout::section_name_mapping): Add rules to handle
1125         exact match on .data.rel.ro.local or .data.rel.ro.
1126         (Layout::output_section_name): Check for exact matches.
1127
1128 2012-05-23  Cary Coutant  <ccoutant@google.com>
1129
1130         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1131         more carefully.
1132
1133 2012-05-22  Cary Coutant  <ccoutant@google.com>
1134
1135         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1136         object before exporting symbol.
1137
1138 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1139
1140         * testsuite/tls_test.cc: Include "config.h" first.
1141         * testsuite/tls_test_c.c: Likewise.
1142
1143 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1144             Nick Clifton  <nickc@redhat.com>
1145
1146         PR 14072
1147         * configure.in: Add check that sysdep.h has been included before
1148         any system header files.
1149         * configure: Regenerate.
1150         * config.in: Regenerate.
1151
1152 2012-05-14  Cary Coutant  <ccoutant@google.com>
1153
1154         * layout.cc (Layout::make_output_section): Mark .tdata section
1155         as RELRO.
1156         * testsuite/relro_test.cc: Add a TLS variable.
1157
1158 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1159
1160         PR gold/14091
1161         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1162         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1163         R_X86_64_64.
1164
1165 2012-05-08  Cary Coutant  <ccoutant@google.com>
1166
1167         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1168         (lines_only_debug_sections): Likewise.
1169
1170 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1171
1172         * nacl.cc: New file.
1173         * nacl.h: New file.
1174         * Makefile.am (CCFILES, HFILES): Add them.
1175         * Makefile.in: Regenerate.
1176         * i386.cc (Output_data_plt_i386_nacl): New class.
1177         (Output_data_plt_i386_nacl_exec): New class.
1178         (Output_data_plt_i386_nacl_dyn): New class.
1179         (Target_i386_nacl): New class.
1180         (Target_selector_i386_nacl): New class.
1181         (target_selector_i386): Use it instead of Target_selector_i386.
1182         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1183         (Target_x86_64_nacl): New class.
1184         (Target_selector_x86_64_nacl): New class.
1185         (target_selector_x86_64, target_selector_x32): Use it instead of
1186         Target_selector_x86_64.
1187         * arm.cc (Output_data_plt_arm_nacl): New class.
1188         (Target_arm_nacl): New class.
1189         (Target_selector_arm_nacl): New class.
1190         (target_selector_arm, target_selector_armbe): Use it instead of
1191         Target_selector_arm.
1192
1193         * target-select.cc (select_target): Take new Input_file* and off_t
1194         arguments, pass them on to recognize method of selector.
1195         * object.cc (make_elf_sized_object): Update caller.
1196         * parameters.cc (parameters_force_valid_target): Likewise.
1197         * incremental.cc (make_sized_incremental_binary): Likewise.
1198         * target-select.h: Update decl.
1199         (Target_selector::recognize): Take new Input_file* argument,
1200         pass it on to do_recognize.
1201         (Target_selector::do_recognize): Take new Input_file* argument.
1202         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1203         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1204         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1205         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1206
1207         * target.h (Target::Target_info): New members isolate_execinstr
1208         and rosegment_gap.
1209         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1210         * arm.cc (Target_arm::arm_info): Update initializer.
1211         * i386.cc (Target_i386::i386_info): Likewise.
1212         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1213         * sparc.cc (Target_sparc::sparc_info): Likewise.
1214         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1215         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1216         * layout.cc (Layout::attach_allocated_section_to_segment):
1217         Take new const Target* argument.  If target->isolate_execinstr(), act
1218         like --rosegment.
1219         (Layout::find_first_load_seg): Take new const Target* argument;
1220         if target->isolate_execinstr(), reject PF_X segments.
1221         (Layout::relaxation_loop_body): Update caller.
1222         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1223         reset file offset to zero when we hit LOAD_SEG, and then do a second
1224         loop over the segments before LOAD_SEG to reassign offsets after
1225         addresses have been determined.  Handle target->rosegment_gap().
1226         (Layout::attach_section_to_segment): Take new const Target* argument;
1227         pass it to attach_allocated_section_to_segment.
1228         (Layout::make_output_section): Update caller.
1229         (Layout::attach_sections_to_segments): Take new const Target* argument;
1230         pass it to attach_section_to_segment.
1231         * gold.cc (queue_middle_tasks): Update caller.
1232         * layout.h (Layout): Update method decls with new arguments.
1233
1234         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1235         Target_info pointer to use.
1236         (Target_arm::do_make_data_plt): New virtual method.
1237         (Target_arm::make_data_plt): New method that calls it.
1238         (Target_arm::make_plt_entry): Use it.
1239         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1240         for the section alignment.
1241         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1242         method.
1243         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1244         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1245         method.
1246         (Output_data_plt_arm::get_plt_entry_size): Call it.
1247         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1248         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1249         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1250         method.
1251         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1252         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1253         method instead of sizeof(plt_entry).
1254         (Output_data_plt_arm::add_entry): Likewise.
1255         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1256         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1257         than static method.
1258         (Target_arm::plt_entry_size): Likewise.
1259         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1260         Move to ...
1261         (Output_data_plt_arm_standard): ... here, new class.
1262         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1263         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1264         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1265
1266         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1267         Take additional argument for the PLT entry size.
1268         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1269         Use get_plt_entry_size method rather than plt_entry_size variable.
1270         (Output_data_plt_x86_64::reserve_slot): Likewise.
1271         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1272         (Output_data_plt_x86_64::add_entry): Likewise.
1273         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1274         (Output_data_plt_x86_64::address_for_global): Likewise.
1275         (Output_data_plt_x86_64::address_for_local): Likewise.
1276         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1277         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1278         Make method non-static.
1279         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1280         method.
1281         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1282         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1283         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1284         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1285         virtual method.
1286         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1287         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1288         virtual method.
1289         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1290         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1291         virtual method.
1292         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1293         (Output_data_plt_x86_64::plt_entry_size)
1294         (Output_data_plt_x86_64::first_plt_entry)
1295         (Output_data_plt_x86_64::plt_entry)
1296         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1297         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1298         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1299         (Output_data_plt_x86_64_standard): ... here, new class.
1300         (Target_x86_64::Target_x86_64): Take optional argument for the
1301         Target_info pointer to use.
1302         (Target_x86_64::do_make_data_plt): New virtual method.
1303         (Target_x86_64::make_data_plt): New method to call it.
1304         (Target_x86_64::init_got_plt_for_update): Use that.
1305         Call this->plt_->add_eh_frame method here.
1306         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1307         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1308         rather than static method.
1309         (Target_x86_64::plt_entry_size): Likewise.
1310         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1311         rather than plt_entry_size variable.  Move guts of PLT filling to...
1312         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1313         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1314         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1315
1316         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1317         additional argument for the section alignment.
1318         Don't do add_eh_frame_for_plt here.
1319         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1320         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1321         variable.
1322         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1323         method.
1324         (Output_data_plt_i386::get_plt_entry_size): Call it.
1325         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1326         (Output_data_plt_i386::add_eh_frame): New method to call it.
1327         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1328         method.
1329         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1330         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1331         method.
1332         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1333         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1334         method instead of plt_entry_size.
1335         (Output_data_plt_i386::plt_entry_size)
1336         (Output_data_plt_i386::plt_eh_frame_fde_size)
1337         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1338         (Output_data_plt_i386_standard): ... here, new class.
1339         (Output_data_plt_i386_exec): New class.
1340         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1341         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1342         (Output_data_plt_i386::exec_plt_entry): Move to ...
1343         (Output_data_plt_i386_exec::plt_entry): ... here.
1344         (Output_data_plt_i386_dyn): New class.
1345         (Output_data_plt_i386::first_plt_entry): Move to ...
1346         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1347         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1348         (Output_data_plt_i386_dyn::plt_entry): ... here.
1349         (Target_i386::Target_i386): Take optional argument for the Target_info
1350         pointer to use.
1351         (Target_i386::do_make_data_plt): New virtual method.
1352         (Target_i386::make_data_plt): New method to call it.
1353         (Target_i386::make_plt_section): Use that.
1354         Call this->plt_->add_eh_frame method here.
1355         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1356         rather than plt_entry_size variable.
1357         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1358         (Output_data_plt_i386::address_for_local): Likewise.
1359         (Output_data_plt_i386::do_write): Likewise.
1360         Move guts of PLT filling to...
1361         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1362         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1363         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1364         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1365
1366 2012-05-01  Cary Coutant  <ccoutant@google.com>
1367
1368         * dwarf_reader.cc (Dwarf_die::read_attributes)
1369         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1370         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1371         * reduced_debug_output.cc
1372         (Output_reduced_debug_info_section::get_die_end): Remove
1373         DW_FORM_GNU_ref_index.  Add default case.
1374
1375 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1376
1377         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1378         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1379         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1380         DW_AT_high_pc as offset from DW_AT_low_pc.
1381
1382         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1383         * testsuite/Makefile.in: Regenerate.
1384         * testsuite/gdb_index_test_3.c: New test source file.
1385         * testsuite/gdb_index_test_3.sh: New test source file.
1386
1387 2012-04-25  Ian Lance Taylor  <iant@google.com>
1388
1389         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1390         pointer.
1391         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1392         as a class, not a struct.
1393         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1394         (Target_arm::apply_cortex_a8_workaround): Likewise.
1395         * gc.h: Declare Reloc_types as a struct, not a class.
1396         * object.h: Declare Symbols_data as a struct.
1397         * reloc.h: Declare Read_relocs_data as a struct.
1398         * target.h: Declare Relocate_info as a struct.
1399
1400 2012-04-24  David S. Miller  <davem@davemloft.net>
1401
1402         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1403         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1404         and R_SPARC_WPLT30.
1405
1406 2012-04-24  Cary Coutant  <ccoutant@google.com>
1407
1408         * incremental-dump.cc (find_input_containing_global): Replace
1409         magic number with symbolic constant.
1410         (dump_incremental_inputs): Update version number.
1411         * incremental.cc (Output_section_incremental_inputs): Update version
1412         number; import symbolic constants from Incremental_inputs_reader.
1413         (Incremental_inputs::create_data_sections): Align relocations
1414         section correctly for 64-bit targets.
1415         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1416         constants; add padding.
1417         (Output_section_incremental_inputs::write_header): Add assert for
1418         header_size.
1419         (Output_section_incremental_inputs::write_input_files): Add assert
1420         for input_entry_size.
1421         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1422         add assert for object_info_size, input_section_entry_size,
1423         global_sym_entry_size.
1424         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1425         for data structure sizes; use them.
1426         (Incremental_input_entry_reader): Import symbolic constants from
1427         Incremental_inputs_reader; use them.
1428
1429 2012-04-23  David S. Miller  <davem@davemloft.net>
1430
1431         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1432         and elf_flags_set_.
1433         (Target_sparc::Target_sparc): Initialize new fields.
1434         (Target_sparc::do_make_elf_object): New function.
1435         (Target_sparc::do_adjust_elf_header): New function.
1436
1437 2012-04-23  Cary Coutant  <ccoutant@google.com>
1438
1439         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1440         CU range table of gdb index.
1441
1442 2012-04-20  David S. Miller  <davem@davemloft.net>
1443
1444         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1445         instead of false.
1446
1447 2012-04-16  David S. Miller  <davem@davemloft.net>
1448
1449         * sparc.cc (Target_sparc::got_address): New function.
1450         (Sparc_relocate_functions::gdop_hix22): New function.
1451         (Sparc_relocate_functions::gdop_lox10): New function.
1452         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1453         relocs.
1454         (Target_sparc::Scan::local): Likewise if the global symbol is not
1455         preemptible and is not IFUNC.
1456         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1457         transformations for local and non-preemptible non-IFUNC global
1458         symbols.
1459
1460         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1461         writing out 64-bit part of ranges.
1462
1463         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1464         -fpic and -fpie respectively.
1465         * Makefile.in: Regenerate.
1466
1467         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1468         (Target_sparc::Target_sparc): Initialize new field.
1469         (Target_sparc::do_plt_section_for_global): New function.
1470         (Target_sparc::do_plt_section_for_local): New function.
1471         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1472         (Target_sparc::make_plt_section): New function, broken out of
1473         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1474         (Target_sparc::make_plt_entry): Call make_plt_section.
1475         (Target_sparc::make_local_ifunc_plt_entry): New function.
1476         (Target_sparc::rela_ifunc_section): New function.
1477         (Target_sparc::plt_section): Remove const.
1478         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1479         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1480         and ifunc_count_ fields.
1481         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1482         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1483         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1484         (Output_data_plt_sparc::rela_ifunc): New function.
1485         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1486         (Output_data_plt_sparc::has_ifunc_section): New function.
1487         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1488         (Output_data_plt_sparc::address_for_global): New function.
1489         (Output_data_plt_sparc::address_for_local): New function.
1490         (Output_data_plt_sparc::plt_index_to_offset): New function.
1491         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1492         and entry_count.
1493         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1494         entry_count.
1495         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1496         R_SPARC_JMP_IREL to switch.
1497         (Target_sparc::Scan::check_non_pic): Likewise.
1498         (Target_sparc::Scan::local): Handle IFUNC symbols.
1499         (Target_sparc::Scan::local): Likewise.
1500         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1501         and plt_address_for_local.
1502         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1503         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1504
1505         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1506         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1507         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1508         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1509         global relocs too.
1510         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1511         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1512         calls.
1513         * sparc.cc (Target_sparc::Scan::global): Likewise.
1514         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1515
1516 2012-04-16  Cary Coutant  <ccoutant@google.com>
1517
1518         * archive.cc (Library_base::should_include_member): Check for
1519         --export-dynamic-symbol.
1520         * options.h (class General_options): Add --export-dynamic-symbol.
1521         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1522         --export-dynamic-symbol.
1523         (Symbol_table::gc_mark_undef_symbols): Likewise.
1524         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1525
1526 2012-04-12  David S. Miller  <davem@davemloft.net>
1527
1528         * sparc.cc (Reloc::wdisp10): New relocation method.
1529         (Reloc::h34): Likewise.
1530         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1531         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1532         R_SPARC_WDISP10.
1533         (Target_sparc::Scan::local): Likewise.
1534         (Target_sparc::Scan::global): Likewise.
1535         (Target_sparc::Relocate::relocate): Likewise.
1536
1537 2012-04-09  Cary Coutant  <ccoutant@google.com>
1538
1539         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1540         low_pc == 0.
1541
1542 2012-04-06  Ian Lance Taylor  <iant@google.com>
1543
1544         * timer.cc: #include <unistd.h>.
1545
1546 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1547
1548         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1549         * config.in: Regenerate.
1550         * configure: Regenerate.
1551
1552 2012-04-05  Nick Clifton  <nickc@redhat.com>
1553
1554         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1555         (AM_LC_MESSAGES): Add.
1556         * aclocal.m4: Regenerate.
1557         * config.in: Regenerate.
1558         * configure: Regenerate.
1559
1560 2012-03-21  Cary Coutant  <ccoutant@google.com>
1561
1562         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1563         * Makefile.in: Regenerate.
1564         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1565         (Sized_elf_reloc_mapper::symbol_section): New function.
1566         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1567         (make_elf_reloc_mapper): New function.
1568         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1569         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1570         (Dwarf_abbrev_table::do_get_abbrev): New function.
1571         (Dwarf_ranges_table::read_ranges_table): New function.
1572         (Dwarf_ranges_table::read_range_list): New function.
1573         (Dwarf_pubnames_table::read_section): New function.
1574         (Dwarf_pubnames_table::read_header): New function.
1575         (Dwarf_pubnames_table::next_name): New function.
1576         (Dwarf_die::Dwarf_die): New function.
1577         (Dwarf_die::read_attributes): New function.
1578         (Dwarf_die::skip_attributes): New function.
1579         (Dwarf_die::set_name): New function.
1580         (Dwarf_die::set_linkage_name): New function.
1581         (Dwarf_die::attribute): New function.
1582         (Dwarf_die::string_attribute): New function.
1583         (Dwarf_die::int_attribute): New function.
1584         (Dwarf_die::uint_attribute): New function.
1585         (Dwarf_die::ref_attribute): New function.
1586         (Dwarf_die::child_offset): New function.
1587         (Dwarf_die::sibling_offset): New function.
1588         (Dwarf_info_reader::check_buffer): New function.
1589         (Dwarf_info_reader::parse): New function.
1590         (Dwarf_info_reader::do_parse): New function.
1591         (Dwarf_info_reader::do_read_string_table): New function.
1592         (Dwarf_info_reader::lookup_reloc): New function.
1593         (Dwarf_info_reader::get_string): New function.
1594         (Dwarf_info_reader::visit_compilation_unit): New function.
1595         (Dwarf_info_reader::visit_type_unit): New function.
1596         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1597         Sized_elf_reloc_mapper.
1598         (Sized_dwarf_line_info::symbol_section): Remove function.
1599         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1600         (Sized_dwarf_line_info::read_line_mappings): Remove object
1601         parameter, adjust callers.
1602         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1603         * dwarf_reader.h: Include <sys/types.h>.
1604         (class Track_relocs): Remove forward declaration.
1605         (class Elf_reloc_mapper): New class.
1606         (class Sized_elf_reloc_mapper): New class.
1607         (class Dwarf_abbrev_table): New class.
1608         (class Dwarf_range_list): New class.
1609         (class Dwarf_ranges_table): New class.
1610         (class Dwarf_pubnames_table): New class.
1611         (class Dwarf_die): New class.
1612         (class Dwarf_info_reader): New class.
1613         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1614         (Sized_dwarf_line_info::symbol_section): Remove member function.
1615         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1616         base class.
1617         * gdb-index.cc: New source file.
1618         * gdb-index.h: New source file.
1619         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1620         and .debug_types sections, call Layout::add_to_gdb_index.
1621         (Sized_relobj_incr::do_section_name): Implement.
1622         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1623         return type; Implement.
1624         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1625         return type.
1626         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1627         parameter list and return type.
1628         (Sized_incr_dynobj::do_section_contents): Likewise.
1629         * layout.cc: Include gdb-index.h.
1630         (Layout::Layout): Initialize gdb_index_data_.
1631         (Layout::init_fixed_output_section): Check for .gdb_index section.
1632         (Layout::add_to_gdb_index): New function. Instantiate.
1633         * layout.h: Add forward declaration for class Gdb_index.
1634         (Layout::add_to_gdb_index): New member function.
1635         (Layout::gdb_index_data_): New data member.
1636         * main.cc: Include gdb-index.h.
1637         (main): Print statistics for gdb index.
1638         * object.cc (Object::section_contents): Move code into
1639         do_section_contents.
1640         (need_decompressed_section): Check for sections needed when building
1641         gdb index.
1642         (build_compressed_section_map): Likewise.
1643         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1644         gdb index.
1645         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1646         sections; call Layout::add_to_gdb_index.
1647         (Sized_relobj_file::do_decompressed_section_contents): Call
1648         do_section_contents directly.
1649         * object.h (Object::do_section_contents): Adjust parameter list and
1650         return type.
1651         (Object::do_decompressed_section_contents): Call do_section_contents
1652         directly.
1653         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1654         return type.
1655         * options.h (class General_options): Add --gdb-index option.
1656         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1657         list and return type.
1658         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1659         * reloc.h (Track_relocs::checkpoint): New function.
1660         (Track_relocs::reset): New function.
1661
1662         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1663         New test cases.
1664         * testsuite/Makefile.in: Regenerate.
1665         * testsuite/gdb_index_test.cc: New test source file.
1666         * testsuite/gdb_index_test_1.sh: New test source file.
1667         * testsuite/gdb_index_test_2.sh: New test source file.
1668
1669 2012-03-19  Doug Kwan  <dougkwan@google.com>
1670
1671         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1672         (Target_arm::do_finalize_sections): Remove code which defines
1673         __exidx_start and __exidx_end.  Make symbol table parameter
1674         anonymous as it is not used.
1675         * gold.cc (queue_middle_tasks): Call target hook to define any
1676         target-specific symbols.
1677         * target.h (Target::define_standard_symbols): New method.
1678         (Target::do_define_standard_symbols): Same.
1679         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1680         * testsuite/Makefile.in: Regenerate.
1681         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1682         and __exidx_end.
1683         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1684         relocations are generated for __exidx_start and __exidx_end.
1685
1686 2012-03-16  Doug Kwan  <dougkwan@google.com>
1687
1688         * testsuite/Makefile.am: Disable test initpri3b.
1689         * testsuite/Makefile.in: Regenerate.
1690
1691 2012-03-15  Doug Kwan  <dougkwan@google.com>
1692
1693         * arm.cc (Target_arm::got_section): Make .got section read-only
1694         if -z now is given.
1695
1696 2012-03-15  Ian Lance Taylor  <iant@google.com>
1697
1698         PR gold/13850
1699         * layout.cc (Layout::make_output_section): Correctly mark
1700         SHT_INIT_ARRAY, et. al., as relro.
1701
1702 2012-03-14  Doug Kwan  <dougkwan@google.com>
1703
1704         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1705         dynamic relocations for protected symbols in shared objects.
1706
1707 2012-03-13  Ian Lance Taylor  <iant@google.com>
1708
1709         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1710         keep the larger alignment.
1711
1712 2012-03-12  Cary Coutant  <ccoutant@google.com>
1713
1714         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1715         handling of DW_LNE_define_file.
1716
1717 2012-03-12  Cary Coutant  <ccoutant@google.com>
1718
1719         * reduced_debug_output.cc
1720         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1721         codes to switch.
1722
1723 2012-02-29  Cary Coutant  <ccoutant@google.com>
1724
1725         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1726
1727 2012-02-29  Cary Coutant  <ccoutant@google.com>
1728
1729         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1730         Call Object::decompressed_section_contents.
1731         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1732         New dtor.
1733         (Sized_dwarf_line_info::buffer_start_): New data member.
1734         * merge.cc (Output_merge_data::do_add_input_section): Call
1735         Object::decompressed_section_contents.
1736         (Output_merge_string::do_add_input_section): Likewise.
1737         * object.cc (need_decompressed_section): New function.
1738         (build_compressed_section_map): Decompress sections needed later.
1739         (Sized_relobj_file::do_decompressed_section_contents): New function.
1740         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1741         * object.h (Object::decompressed_section_contents): New function.
1742         (Object::discard_decompressed_sections): New function.
1743         (Object::do_decompressed_section_contents): New function.
1744         (Object::do_discard_decompressed_sections): New function.
1745         (Compressed_section_info): New type.
1746         (Compressed_section_map): Include decompressed section contents.
1747         (Sized_relobj_file::do_decompressed_section_contents): New function.
1748         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1749
1750 2012-02-16  Cary Coutant  <ccoutant@google.com>
1751
1752         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1753         * testsuite/Makefile.in: Regenerate.
1754
1755 2012-02-14  Cary Coutant  <ccoutant@google.com>
1756
1757         * options.cc (General_options::finalize): Disallow -pie and -static.
1758
1759 2012-02-03  Doug Kwan  <dougkwan@google.com>
1760
1761         * arm.cc (Arm_relocate_functions::abs8,
1762         Arm_relocate_functions::abs16): Use
1763         Bits::has_signed_unsigned_overflow32.
1764         (Arm_relocate_functions::thm_abs8): Correct range of
1765         overflow check.
1766         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1767         in assertions.
1768
1769 2012-02-02  Doug Kwan  <dougkwan@google.com>
1770
1771         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1772         position independent outputs, not just shared objects.
1773
1774 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1775
1776         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1777         * configure: Regenerated.
1778
1779 2012-01-27  Ian Lance Taylor  <iant@google.com>
1780
1781         * reloc.h (Bits): New class with static functions, copied from
1782         namespace utils in arm.cc.
1783         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1784         instead.
1785
1786 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1787
1788         * incremental.cc (write_info_blocks): Correct relocation offset.
1789
1790 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1791
1792         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1793         (Relocate::tls_gd_to_le): Likewise.
1794
1795 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1796
1797         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1798
1799 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1800
1801         * configure.ac: Check if -mcmodel=medium works.
1802         * configure: Regenerated.
1803
1804 2012-01-24  Cary Coutant  <ccoutant@google.com>
1805
1806         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1807         definition and ...
1808         (read_unsigned_LEB_128_x): ... this new function.
1809         (read_signed_LEB_128): Replaced with inline definition and ...
1810         (read_signed_LEB_128_x): ... this new function.
1811         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1812         (read_unsigned_LEB_128): Add inline definition.
1813         (read_signed_LEB_128_x): New function.
1814         (read_signed_LEB_128): Add inline definition.
1815         * testsuite/Makefile.am (leb128_unittest): New unit test.
1816         * testsuite/Makefile.in: Regenerate.
1817         * testsuite/leb128_unittest.cc: New unit test.
1818
1819 2012-01-23  Ian Lance Taylor  <iant@google.com>
1820
1821         PR gold/13617
1822         * i386.cc (Target_i386::do_code_fill): When using a jmp
1823         instruction, pad with nop instructions.
1824         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1825
1826 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1827
1828         * x86_64.cc (gc_process_relocs): Add typename on types used in
1829         template.
1830         (scan_relocs): Likewise.
1831         (relocate_section): Likewise.
1832         (apply_relocation): Likewise.
1833
1834 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1835
1836         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1837         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1838         under x32.
1839
1840 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1841
1842         * x86_64.cc: Initial support for x32.
1843
1844 2012-01-03  Cary Coutant  <ccoutant@google.com>
1845
1846         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1847         Use abstract base class for GOT.
1848         * gold/output.h (class Output_data_got_base): New abstract base class.
1849         (class Output_data_got): Derive from new base class, adjust ctors.
1850         (Output_data_got::reserve_slot): Make virtual; rename to
1851         do_reserve_slot; Adjust callers.
1852         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1853         pointer to abstract base class.
1854         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1855
1856 2011-12-18  Ian Lance Taylor  <iant@google.com>
1857
1858         * object.h (Relobj::local_symbol_value): New function.
1859         (Relobj::local_plt_offset): New function.
1860         (Relobj::local_has_got_offset): New function.
1861         (Relobj::local_got_offset): New function.
1862         (Relobj::set_local_got_offset): New function.
1863         (Relobj::do_local_symbol_value): New pure virtual function.
1864         (Relobj::do_local_plt_offset): Likewise.
1865         (Relobj::do_local_has_got_offset): Likewise.
1866         (Relobj::do_local_got_offset): Likewise.
1867         (Relobj::do_set_local_got_offset): Likewise.
1868         (Sized_relobj::do_local_has_got_offset): Rename from
1869         local_has_got_offset.
1870         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1871         (Sized_relobj::do_set_local_got_offset): Rename from
1872         set_local_got_offset.
1873         (Sized_relobj_file::do_local_plt_offset): Rename from
1874         local_plt_offset.
1875         (Sized_relobj_file::do_local_symbol_value): New function.
1876         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1877         local_plt_offset.
1878         * output.cc (Output_data_got::Got_entry::write): Change object to
1879         Relobj.  Use local_symbol_value.
1880         (Output_data_got::add_global_with_rel): Change rel_dyn to
1881         Output_data_reloc_generic*.  Use add_global_generic.
1882         (Output_data_got::add_global_with_rela): Remove.  Change all
1883         callers to use add_global_with_rel.
1884         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1885         Output_data_reloc_generic*.  Use add_global_generic.
1886         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1887         callers to use add_global_pair_with_rel.
1888         (Output_data_got::add_local): Change object to Relobj*.
1889         (Output_data_got::add_local_plt): Likewise.
1890         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1891         change rel_dyn to Output_data_reloc_generic*.  Use
1892         add_local_generic.
1893         (Output_data_got::add_local_with_rela): Remove.  Change all
1894         callers to use all_local_with_rel.
1895         (Output_data_got::add_local_pair_with_rel): Change object to
1896         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1897         add_output_section_generic.
1898         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1899         callers to use add_local_pair_with_rel.
1900         (Output_data_got::reserve_local): Change object to Relobj*.
1901         * output.h: (class Output_data_reloc_generic): Add pure virtual
1902         declarations for add_global_generic, add_local_generic,
1903         add_output_section_generic.
1904         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1905         functions for Output_data_reloc_generic.  Update declarations for
1906         changes listed in output.cc.
1907         (class Output_data_got): Change template parameter to got_size.
1908         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1909         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1910         function.
1911         (Sized_relobj_incr::do_local_plt_offset): New function.
1912         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1913         add_global_generic.
1914
1915 2011-12-17  Cary Coutant  <ccoutant@google.com>
1916
1917         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1918         * resolve.cc (Symbol_table::resolve): Likewise.
1919         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1920         arrays.
1921         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1922
1923 2011-12-16  Ian Lance Taylor  <iant@google.com>
1924
1925         * output.h (Output_data_reloc_generic::add): Only call
1926         add_dynamic_reloc if this is a dynamic reloc section.
1927
1928 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1929
1930         PR gold/13505
1931         * target-reloc.h (apply_relocation): Replace <64, false> with
1932         <size, big_endian>.
1933
1934 2011-11-25  Nick Clifton  <nickc@redhat.com>
1935
1936         * po/it.po: New Italian translation.
1937
1938 2011-11-17  Sterling Augustine  <saugustine@google.com>
1939
1940         * script.cc (script_include_directive): Implement.
1941         (read_script_file): New local variables name and search_path. Update
1942         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1943         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1944         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1945
1946 2011-11-11  Sterling Augustine  <saugustine@google.com>
1947
1948         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1949         (file_or_sections_cmd): Likewise.
1950
1951 2011-11-11  Doug Kwan  <dougkwan@google.com>
1952
1953         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1954         if --just-symbols is given.
1955
1956 2011-11-10  Doug Kwan  <dougkwan@google.com>
1957
1958         PR gold/13362
1959         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1960         when processing data relocs.
1961         * reloc.h (Relocate_functions::rel_unaligned): New method.
1962         (Relocate_functions::pcrel_unaligned): Ditto.
1963         (Relocate_functions::rel32_unaligned): Ditto.
1964         (Relocate_functions::pcrel32_unaligned): Ditto.
1965
1966 2011-11-09  Doug Kwan  <dougkwan@google.com>
1967
1968         PR gold/13362
1969         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1970         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1971         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1972         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1973         (Relocate_functions::rel_unaligned): New.
1974         (Relocate_functions::rel32_unaligned): New.
1975         * target-reloc.h (relocate_for_relocatable): Add code to handle
1976         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1977         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1978         arm_unaligned_reloc_r): New targets.
1979         * testsuite/Makefile.in: Regenerate.
1980         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1981         linking.
1982
1983 2011-11-02  Ian Lance Taylor  <iant@google.com>
1984
1985         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1986         NATIVE_LINKER.
1987         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1988         * options.cc (General_options::finalize): Use library search path
1989         from configure script if specified.  If not native and no sysroot,
1990         only search TOOLLIBDIR.
1991         * options.h (Search_directory::Search_directory): Change name to
1992         const std::string&.
1993         (General_options::add_to_library_path_with_sysroot): Change arg to
1994         const std::string&.
1995         * configure, Makefile.in, config.in: Rebuild.
1996
1997 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1998
1999         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2000         we are working around the ARM1176 Erratum.
2001         * options.h (General_options::fix_arm1176): Add option.
2002         * testsuite/Makefile.am: Add testcases, and keep current ones
2003         working.
2004         * testsuite/Makefile.in: Regenerate.
2005         * testsuite/arm_fix_1176.s: New file.
2006         * testsuite/arm_fix_1176.sh: Likewise.
2007
2008 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2009
2010         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2011         may_use_blx_.
2012         (Target_arm::may_use_blx): Remove method.
2013         (Target_arm::set_may_use_blx): Likewise.
2014         (Target_arm::may_use_v4t_interworking): New method.
2015         (Target_arm::may_use_v5t_interworking): Likewise.
2016         (Target_arm::may_use_blx_): Remove member variable.
2017         (Arm_relocate_functions::arm_branch_common): Check for v5T
2018         interworking.
2019         (Arm_relocate_functions::thumb_branch_common): Likewise.
2020         (Reloc_stub::stub_type_for_reloc): Likewise.
2021         (Target_arm::do_finalize_sections): Correct interworking checks.
2022         * testsuite/Makefile.am: Add new tests.
2023         * testsuite/Makefile.in: Regenerate.
2024         * testsuite/arm_farcall_arm_arm.s: New test.
2025         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2026         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2027         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2028         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2029         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2030         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2031         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2032
2033 2011-10-31  Cary Coutant  <ccoutant@google.com>
2034
2035         PR gold/13023
2036         * expression.cc (Expression::eval_with_dot): Add
2037         is_section_dot_assignment parameter.
2038         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2039         absolute and assigning to dot within a section.
2040         * script-sections.cc
2041         (Output_section_element_assignment::set_section_addresses): Pass
2042         dot_section to set_if_absolute.
2043         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2044         as is_section_dot_assignment flag to eval_with_dot.
2045         (Output_section_element_dot_assignment::set_section_addresses):
2046         Likewise.
2047         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2048         parameter.  Also set value if relative to dot_section; set the
2049         symbol's output_section.
2050         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2051         parameter.  Adjust all callers.
2052         (Expression::eval_maybe_dot): Likewise.
2053         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2054         Adjust all callers.
2055         * testsuite/script_test_2.t: Test assignment of an absolute value
2056         to dot within an output section element.
2057
2058 2011-10-31  Cary Coutant  <ccoutant@google.com>
2059
2060         * options.h (class General_options): Add --[no-]gnu-unique options.
2061         * symtab.cc (Symbol_table::sized_write_globals): Convert
2062         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2063
2064 2011-10-31  Cary Coutant  <ccoutant@google.com>
2065
2066         PR gold/13359
2067         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2068         unnecessary assertion.
2069         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2070
2071 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2072
2073         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2074         gc_mark_symbol.
2075         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2076         gc_mark_symbol.
2077         Change to just keep the section associated with symbol.
2078         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2079         they are externally visible and --export-dynamic is turned on.
2080         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2081
2082 2011-10-19  Ian Lance Taylor  <iant@google.com>
2083
2084         PR gold/13163
2085         * script-sections.cc
2086         (Output_section_element_dot_assignment::needs_output_section): New
2087         function.
2088
2089 2011-10-19  Ian Lance Taylor  <iant@google.com>
2090
2091         PR gold/13204
2092         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2093         --section-start option was seen.
2094         * options.h (General_options::any_section_start): New function.
2095
2096 2011-10-18  David S. Miller  <davem@davemloft.net>
2097
2098         PR binutils/13301
2099         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2100         member to track relocation locations that have moved during TLS
2101         reloc optimizations.
2102         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2103         (Target_sparc::Relocate::relocate): Adjust view down by 4
2104         bytes if it matches reloc_adjust_addr_.
2105         (Target_sparc::Relocate::relocate_tls): Always move the
2106         __tls_get_addr call delay slot instruction forward 4 bytes when
2107         performing relaxation.
2108
2109 2011-10-18  Cary Coutant  <ccoutant@google.com>
2110
2111         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2112         (Output_file::map_no_anonymous): Check for non-zero
2113         return code from posix_fallocate.
2114
2115 2011-10-17  Cary Coutant  <ccoutant@google.com>
2116
2117         PR gold/13245
2118         * plugin.cc (is_visible_from_outside): Check for symbols
2119         referenced from dynamic objects.
2120         * resolve.cc (Symbol_table::resolve): Don't count references
2121         from dynamic objects as references from real ELF files.
2122         * testsuite/plugin_test_2.sh: Adjust expected result.
2123
2124 2011-10-17  Cary Coutant  <ccoutant@google.com>
2125
2126         * gold.cc: Include timer.h.
2127         (queue_middle_tasks): Stamp time.
2128         (queue_final_tasks): Likewise.
2129         * main.cc (main): Store timer in parameters.  Print timers
2130         for each pass.
2131         * parameters.cc (Parameters::Parameters): Initialize timer_.
2132         (Parameters::set_timer): New function.
2133         (set_parameters_timer): New function.
2134         * parameters.h (Parameters::set_timer): New function.
2135         (Parameters::timer): New function.
2136         (Parameters::timer_): New data member.
2137         (set_parameters_timer): New function.
2138         * timer.cc (Timer::stamp): New function.
2139         (Timer::get_pass_time): New function.
2140         * timer.h (Timer::stamp): New function.
2141         (Timer::get_pass_time): New function.
2142         (Timer::pass_times_): New data member.
2143
2144 2011-10-17  Cary Coutant  <ccoutant@google.com>
2145
2146         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2147         task for members of lib groups.
2148
2149 2011-10-17  Cary Coutant  <ccoutant@google.com>
2150
2151         PR gold/13288
2152         * fileread.cc (File_read::find_view): Add assert.
2153         (File_read::make_view): Move bounds check (replace with assert)...
2154         (File_read::find_or_make_view): ... to here.
2155
2156 2011-10-12  Cary Coutant  <ccoutant@google.com>
2157
2158         * output.cc (Output_file::open_base_file): Handle case where
2159         ::read returns less than requested size.
2160
2161 2011-10-10  Cary Coutant  <ccoutant@google.com>
2162
2163         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2164         Initialize defined_count_.
2165         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2166         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2167         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2168         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2169         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2170         * incremental.h (Sized_relobj_incr::defined_count_): New data
2171         member.
2172         (Sized_incr_dynobj::defined_count_): New data member.
2173         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2174         Return zeroes instead of internal error.
2175
2176 2011-10-10  Cary Coutant  <ccoutant@google.com>
2177
2178         PR gold/13249
2179         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2180         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2181         * output.h (class Output_reloc): Add use_plt_offset flag.
2182         (Output_reloc::type_): Adjust size of bit field.
2183         (Output_reloc::use_plt_offset_): New bit field.
2184         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2185         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2186         flag.  Adjust all callers.
2187         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2188         creating RELATIVE relocations.
2189
2190 2011-10-10  Nick Clifton  <nickc@redhat.com>
2191
2192         * po/es.po: Updated Spanish translation.
2193         * po/fi.po: Updated Finnish translation.
2194
2195 2011-10-03   Diego Novillo  <dnovillo@google.com>
2196
2197         * options.cc (parse_uint): Fix dereference of RETVAL.
2198
2199 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2200
2201         * layout.h (section_order_map_): New member.
2202         (get_section_order_map): New member function.
2203         * output.cc (Output_section::add_input_section): Check for patterns
2204         only when --section-ordering-file is specified.
2205         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2206         output_sections have been formed.
2207         * layout.cc (Layout_Layout): Initialize section_order_map_.
2208         * plugin.cc (update_section_order): Store order in order_map. Do not
2209         update the order.
2210         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2211         * testsuite/Makefile.in: Regenerate.
2212         * testsuite/plugin_section_order.c: New file.
2213         * testsuite/plugin_final_layout.cc: New file.
2214         * testsuite/plugin_final_layout.sh: New file.
2215
2216 2011-09-29  Cary Coutant  <ccoutant@google.com>
2217
2218         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2219         Check for NULL.
2220         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2221         symbols during incremental update.
2222         (Symbol_table::add_from_dynobj): Likewise.
2223
2224 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2225             Ian Lance Taylor  <iant@google.com>
2226
2227         * symtab.cc (Symbol_table::define_special_symbol): Always
2228         canonicalize version string.
2229
2230 2011-09-26  Cary Coutant  <ccoutant@google.com>
2231
2232         * gold.cc (queue_initial_tasks): Move option checks ...
2233         * options.cc (General_options::finalize): ... to here. Disable
2234         some options; make others fatal.
2235
2236 2011-09-26  Cary Coutant  <ccoutant@google.com>
2237
2238         gcc PR lto/47247
2239         * plugin.cc (get_symbols_v2): New function.
2240         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2241         (is_referenced_from_outside): New function.
2242         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2243         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2244         (get_symbols): Pass version parameter.
2245         (get_symbols_v2): New function.
2246         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2247         parameter.
2248         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2249         (onload): Add LDPT_GET_SYMBOLS_V2.
2250         (all_symbols_read_hook): Use get_symbols_v2; check for
2251         LDPR_PREVAILING_DEF_IRONLY_EXP.
2252         * testsuite/plugin_test_3.sh: Update expected results.
2253
2254 2011-09-23  Simon Baldwin  <simonb@google.com>
2255
2256         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2257         configuration options.
2258         * configure: Regenerate.
2259         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2260         * Makefile.in: Regenerate.
2261         * testsuite/Makefile.in: Regenerate.
2262
2263 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2264
2265         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2266
2267 2011-09-19  Cary Coutant  <ccoutant@google.com>
2268
2269         * incremental.cc (can_incremental_update): Fix typo in comment.
2270         * incremental.h (can_incremental_update): Likewise.
2271
2272 2011-09-18  Cary Coutant  <ccoutant@google.com>
2273
2274         * incremental.cc (can_incremental_update): New function.
2275         * incremental.h (can_incremental_update): New function.
2276         * layout.cc (Layout::init_fixed_output_section): Call it.
2277         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2278         * object.cc (Sized_relobj_file::do_layout): Call
2279         can_incremental_update.
2280
2281 2011-09-13  Cary Coutant  <ccoutant@google.com>
2282
2283         * configure.ac: Check for glibc support for gnu_indirect_function
2284         support with static linking, setting automake conditional
2285         IFUNC_STATIC.
2286         * Makefile.in: Regenerate.
2287         * configure: Regenerate.
2288
2289         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2290         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2291         for IFUNC_STATIC.
2292         * testsuite/Makefile.in: Regenerate.
2293
2294 2011-09-13  Cary Coutant  <ccoutant@google.com>
2295
2296         * incremental.cc (Sized_relobj_incr::do_layout): Call
2297         report_comdat_group for kept comdat sections.
2298         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2299         * testsuite/Makefile.in: Regenerate.
2300         * testsuite/incr_comdat_test_1.cc: New source file.
2301         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2302         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2303         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2304
2305 2011-09-13  Ian Lance Taylor  <iant@google.com>
2306
2307         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2308         variable external_symbols_offset.
2309
2310 2011-09-12  Ian Lance Taylor  <iant@google.com>
2311
2312         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2313         triggered if object has no symbols.
2314
2315 2011-09-09  David S. Miller  <davem@davemloft.net>
2316
2317         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2318         (Output_fill_debug_line::do_write): Likewise.
2319
2320 2011-08-29  Cary Coutant  <ccoutant@google.com>
2321
2322         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2323         casts to match formatting specs.
2324         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2325
2326 2011-08-26  Cary Coutant  <ccoutant@google.com>
2327
2328         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2329         remaining hole size when allocating.
2330         (Layout::make_output_section): Set fill methods for debug sections.
2331         * layout.h (Free_list::Free_list_node): Move from private to
2332         public.
2333         (Free_list::set_min_hole_size): New function.
2334         (Free_list::begin, Free_list::end): New functions.
2335         (Free_list::min_hole_): New data member.
2336         * output.cc: Include dwarf.h.
2337         (Output_fill_debug_info::do_minimum_hole_size): New function.
2338         (Output_fill_debug_info::do_write): New function.
2339         (Output_fill_debug_line::do_minimum_hole_size): New function.
2340         (Output_fill_debug_line::do_write): New function.
2341         (Output_section::Output_section): Initialize new data member.
2342         (Output_section::set_final_data_size): Ensure patch space is larger
2343         than minimum hole size.
2344         (Output_section::do_write): Fill holes in debug sections.
2345         * output.h (Output_fill): New class.
2346         (Output_fill_debug_info): New class.
2347         (Output_fill_debug_line): New class.
2348         (Output_section::set_free_space_fill): New function.
2349         (Output_section::free_space_fill_): New data member.
2350         * testsuite/Makefile.am (incremental_test_3): Add
2351         --incremental-patch option.
2352         (incremental_test_4): Likewise.
2353         (incremental_test_5): Likewise.
2354         (incremental_test_6): Likewise.
2355         (incremental_copy_test): Likewise.
2356         (incremental_common_test_1): Likewise.
2357         * testsuite/Makefile.in: Regenerate.
2358
2359 2011-08-26  Nick Clifton  <nickc@redhat.com>
2360
2361         * po/es.po: Updated Spanish translation.
2362
2363 2011-08-01  Cary Coutant  <ccoutant@google.com>
2364
2365         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2366         * gold/testsuite/Makefile.in: Regenerate.
2367         * gold/testsuite/justsyms_exec.c: New source file.
2368         * gold/testsuite/justsyms_lib.c: New source file.
2369
2370 2011-08-01  Cary Coutant  <ccoutant@google.com>
2371
2372         * layout.cc (Layout::set_segment_offsets): Don't realign text
2373         segment if -Ttext was specified.
2374         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2375         file type.
2376         * object.h (Sized_relobj_file::e_type): New function.
2377         (Sized_relobj_file::e_type_): New data member.
2378         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2379         base address for ET_EXEC files.
2380         * target.cc (Target::do_make_elf_object_implementation): Allow
2381         ET_EXEC files with --just-symbols option.
2382
2383 2011-07-28  Cary Coutant  <ccoutant@google.com>
2384
2385         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2386         Add thread_number parameter.
2387         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2388         * workqueue-threads.cc
2389         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2390         current thread if its thread number is greater than desired thread
2391         count.
2392         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2393         Add thread_number parameter.
2394         (Workqueue::should_cancel_thread): Likewise.
2395         (Workqueue::find_runnable_or_wait): Pass thread_number to
2396         should_cancel_thread.
2397         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2398         parameter.
2399
2400 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2401
2402         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2403         only after checking if it cannot be forced local.
2404         * symtab.h (is_externally_visible): Check if the symbol is not forced
2405         local.
2406
2407 2011-07-15  Ian Lance Taylor  <iant@google.com>
2408
2409         * options.h (class General_options): Add --print-output-format.
2410         Move -EL next to -EB, for  better --help output.
2411         * target-select.cc: Include <cstdio>, "options.h", and
2412         "parameters.h".
2413         (Target_selector::do_target_bfd_name): New function.
2414         (print_output_format): New function.
2415         * target-select.h (class Target_selector): Update declarations.
2416         (Target_selector::target_bfd_name): New function.
2417         (print_output_format): Declare.
2418         * main.cc: Include "target-select.h".
2419         (main): Handle --print-output-format.
2420         * gold.cc: Include "target-select.h".
2421         (queue_initial_tasks): Handle --print-output-format when there are
2422         no input files.
2423         * parameters.cc (parameters_force_valid_target): Give a better
2424         error message if -EB/-EL does not match target.
2425         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2426         function.
2427
2428 2011-07-15  Ian Lance Taylor  <iant@google.com>
2429
2430         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2431         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2432         (Output_data_plt_i386::do_write): Write address of .dynamic
2433         section to first entry in .got.plt section.
2434         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2435         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2436         Initialize layout_.
2437         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2438         section to first entry in .got.plt section.
2439         * layout.h (Layout::dynamic_section): New function.
2440
2441 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2442
2443         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2444         to claim_file call.
2445         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2446         input_section_position_, and input_section_glob_.
2447         (read_layout_from_file): Call function section_ordering_specified.
2448         * layout.h (is_section_ordering_specified): New function.
2449         (section_ordering_specified): New function.
2450         (section_ordering_specified_): New boolean member.
2451         * main.cc(main): Call load_plugins after layout object is defined.
2452         * output.cc (Output_section::add_input_section): Use
2453         function section_ordering_specified to check if section ordering is
2454         needed.
2455         * output.cc (Output_section::add_relaxed_input_section): Use
2456         function section_ordering_specified to check if section ordering is
2457         needed.
2458         (Output_section::update_section_layout): New function.
2459         (Output_section::sort_attached_input_sections): Check if input section
2460         must be reordered.
2461         * output.h (Output_section::update_section_layout): New function.
2462         * plugin.cc (get_section_count): New function.
2463         (get_section_type): New function.
2464         (get_section_name): New function.
2465         (get_section_contents): New function.
2466         (update_section_order): New function.
2467         (allow_section_ordering): New function.
2468         (Plugin::load): Add the new interfaces to the transfer vector.
2469         (Plugin_manager::load_plugins): New parameter.
2470         (Plugin_manager::all_symbols_read): New parameter.
2471         (Plugin_manager::claim_file): New parameter. Save the elf object for
2472         unclaimed objects.
2473         (Plugin_manager::get_elf_object): New function.
2474         (Plugin_manager::get_view): Change to directly use the bool to check
2475         if get_view is called from claim_file_hook.
2476         * plugin.h (input_objects): New function
2477         (Plugin__manager::load_plugins): New parameter.
2478         (Plugin_manager::claim_file): New parameter.
2479         (Plugin_manager::get_elf_object): New function.
2480         (Plugin_manager::in_claim_file_handler): New function.
2481         (Plugin_manager::in_claim_file_handler_): New member.
2482         (layout): New function.
2483         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2484         handler with an extra parameter. Make the elf object before calling
2485         claim_file handler.
2486         * testsuite/plugin_test.c (get_section_count): New function pointer.
2487         (get_section_type): New function pointer.
2488         (get_section_name): New function pointer.
2489         (get_section_contents): New function pointer.
2490         (update_section_order): New function pointer.
2491         (allow_section_ordering): New function pointer.
2492         (onload): Check if the new interfaces exist.
2493
2494 2011-07-13  Ian Lance Taylor  <iant@google.com>
2495
2496         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2497         relro section.
2498         * x86_64.cc (Target_x86_64::got_section): Likewise.
2499         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2500         (relro_now_test_SOURCES): New variable.
2501         (relro_now_test_DEPENDENCIES): New variable.
2502         (relro_now_test_LDFLAGS): New variable.
2503         (relro_now_test_LDADD): New variable.
2504         (relro_now_test.so): New target.
2505         * testsuite/Makefile.in: Rebuild.
2506
2507 2011-07-12  Ian Lance Taylor  <iant@google.com>
2508
2509         PR gold/12980
2510         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2511         GLOB_DAT relocation rather than a RELATIVE relocation for a
2512         protected symbol when creating a shared library.
2513         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2514         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2515         * testsuite/protected_main_1.cc (main): Test that protected
2516         function has same address.
2517
2518 2011-07-11  Ian Lance Taylor  <iant@google.com>
2519
2520         PR gold/12979
2521         * options.h (class General_options): Add -Bgroup.
2522         * options.cc (General_options::finalize): If -Bgroup is set,
2523         default to --unresolved-symbols=report-all.
2524         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2525         * target-reloc.h (issue_undefined_symbol_error): Handle
2526         --unresolved-symbols=report-all.
2527
2528 2011-07-08  Ian Lance Taylor  <iant@google.com>
2529
2530         PR gold/11985
2531         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2532         if linker script discards key sections.
2533         (Layout::create_dynamic_symtab): Likewise.
2534         (Layout::assign_local_dynsym_offsets): Likewise.
2535         (Layout::sized_create_version_sections): Likewise.
2536         (Layout::create_interp): Likewise.
2537         (Layout::finish_dynamic_section): Likewise.
2538         (Layout::set_dynamic_symbol_size): Likewise.
2539
2540 2011-07-08  Ian Lance Taylor  <iant@google.com>
2541
2542         PR gold/12386
2543         * options.h (class General_options): Add --unresolved-symbols.
2544         * target-reloc.h (issue_undefined_symbol_error): Check
2545         --unresolved-symbols.  Add comments.
2546
2547 2011-07-08  Ian Lance Taylor  <iant@google.com>
2548
2549         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2550         expression more complex.
2551
2552 2011-07-08  Ian Lance Taylor  <iant@google.com>
2553
2554         PR gold/11317
2555         * target-reloc.h (issue_undefined_symbol_error): New inline
2556         function, broken out of relocate_section.
2557         (relocate_section): Call issue_undefined_symbol_error.
2558         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2559         there is no TLS segment if we are about to issue an undefined
2560         symbol error.
2561         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2562
2563 2011-07-08  Ian Lance Taylor  <iant@google.com>
2564
2565         PR gold/12279
2566         * resolve.cc (Symbol_table::should_override): Add fromtype
2567         parameter.  Change all callers.  Give error when linking together
2568         TLS and non-TLS symbol.
2569         (Symbol_table::should_override_with_special): Add fromtype
2570         parameter.  Change all callers.
2571         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2572         there is no TLS segment if we have reported some errors.
2573         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2574
2575 2011-07-08  Ian Lance Taylor  <iant@google.com>
2576
2577         PR gold/12372
2578         * target.h (Target::plt_address_for_global): New function.
2579         (Target::plt_address_for_local): New function.
2580         (Target::plt_section_for_global): Remove.
2581         (Target::plt_section_for_local): Remove.
2582         (Target::do_plt_address_for_global): New virtual function.
2583         (Target::do_plt_address_for_local): New virtual function.
2584         (Target::do_plt_section_for_global): Remove.
2585         (Target::do_plt_section_for_local): Remove.
2586         (Target::register_global_plt_entry): Add Symbol_table and Layout
2587         parameters.
2588         * output.cc (Output_data_got::Got_entry::write): Use
2589         plt_address_for_global and plt_address_for_local.
2590         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2591         address of output section.
2592         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2593         got_irelative_, and irelative_count_ fields.  Update
2594         declarations.
2595         (Output_data_plt_i386::has_irelative_section): New function.
2596         (Output_data_plt_i386::entry_count): Add irelative_count_.
2597         (Output_data_plt_i386::set_final_data_size): Likewise.
2598         (class Target_i386): Add got_irelative_ and rel_irelative_
2599         fields.  Update declarations.
2600         (Target_i386::Target_i386): Initialize new fields.
2601         (Target_i386::do_plt_address_for_global): New function replacing
2602         do_plt_section_for_global.
2603         (Target_i386::do_plt_address_for_local): New function replacing
2604         do_plt_section_for_local.
2605         (Target_i386::got_section): Create got_irelative_.
2606         (Target_i386::rel_irelative_section): New function.
2607         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2608         fields.  Don't define __rel_iplt_{start,end}.
2609         (Output_data_plt_i386::add_entry): Add symtab and layout
2610         parameters.  Change all callers.  Use different PLT and GOT for
2611         IFUNC symbols.
2612         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2613         layout parameters.  Change all callers.  Use different PLT and
2614         GOT.
2615         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2616         (Output_data_plt_i386::rel_irelative): New function.
2617         (Output_data_plt_i386::address_for_global): New function.
2618         (Output_data_plt_i386::address_for_local): New function.
2619         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2620         IRELATIVE GOT when changing IFUNC GOT entries.
2621         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2622         reloc.
2623         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2624         if we didn't create an IRELATIVE GOT.
2625         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2626         plt_address_for_local.
2627         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2628         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2629         got_irelative_, and irelative_count_ fields.  Update
2630         declarations.
2631         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2632         Initialize new fields.  Remove symtab parameter.  Change all
2633         callers.
2634         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2635         irelative_count_.
2636         (Output_data_plt_x86_64::has_irelative_section): New function.
2637         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2638         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2639         fields.  Update declarations.
2640         (Target_x86_64::Target_x86_64): Initialize new fields.
2641         (Target_x86_64::do_plt_address_for_global): New function replacing
2642         do_plt_section_for_global.
2643         (Target_x86_64::do_plt_address_for_local): New function replacing
2644         do_plt_section_for_local.
2645         (Target_x86_64::got_section): Create got_irelative_.
2646         (Target_x86_64::rela_irelative_section): New function.
2647         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2648         all callers.  Don't create __rel_iplt_{start,end}.
2649         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2650         parameters.  Change all callers.  Use different PLT and GOT for
2651         IFUNC symbols.
2652         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2653         layout parameters.  Change all callers.  Use different PLT and
2654         GOT.
2655         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2656         parameters.  Change all callers.  Use different PLT and GOT for
2657         IFUNC symbols.
2658         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2659         (Output_data_plt_x86_64::rela_irelative): New function.
2660         (Output_data_plt_x86_64::address_for_global): New function.
2661         (Output_data_plt_x86_64::address_for_local): New function.
2662         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2663         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2664         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2665         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2666         parameters.
2667         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2668         reloc.
2669         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2670         symbols if we didn't create an IRELATIVE GOT.
2671         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2672         plt_address_for_local.
2673         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2674         * testsuite/ifuncvar1.c: New test file.
2675         * testsuite/ifuncvar2.c: New test file.
2676         * testsuite/ifuncvar3.c: New test file.
2677         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2678         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2679         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2680         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2681         * testsuite/Makefile.in: Rebuild.
2682
2683 2011-07-07  Cary Coutant  <ccoutant@google.com>
2684
2685         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2686         (two_file_test_1_ndebug.o): Likewise.
2687         (two_file_test_1b_ndebug.o): Likewise.
2688         (two_file_test_2_ndebug.o): Likewise.
2689         (two_file_test_main_ndebug.o): Likewise.
2690         (incremental_test_2): Link with no-debug versions.
2691
2692 2011-07-06  Cary Coutant  <ccoutant@google.com>
2693
2694         * gold/incremental.cc
2695         (Output_section_incremental_inputs::write_info_blocks): Check for
2696         hidden and internal symbols.
2697
2698 2011-07-06  Cary Coutant  <ccoutant@google.com>
2699
2700         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2701         Check disposition for startup file.
2702         (Incremental_inputs::report_command_line): Ignore
2703         --incremental-startup-unchanged option.
2704         * options.cc (General_options::parse_incremental_startup_unchanged):
2705         New function.
2706         (General_options::General_options): Initialize new data member.
2707         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2708         (General_options): Add --incremental-startup-unchanged option.
2709         (General_options::incremental_startup_disposition): New function.
2710         (General_options::incremental_startup_disposition_): New data member.
2711
2712 2011-07-06  Cary Coutant  <ccoutant@google.com>
2713
2714         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2715         input file index to Script_info ctor.
2716         (Sized_incremental_binary::do_file_has_changed): Find the
2717         command-line argument for files named in scripts.
2718         * incremental.h (Script_info::Script_info): New ctor
2719         with input file index.
2720         (Script_info::input_file_index): New function.
2721         (Script_info::input_file_index_): New data member.
2722         (Incremental_binary::get_library): Add const.
2723         (Incremental_binary::get_script_info): Add const.
2724         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2725         * testsuite/Makefile.am (incremental_test_5): New test case.
2726         (incremental_test_6): New test case.
2727         * testsuite/Makefile.in: Regenerate.
2728
2729 2011-07-06  Cary Coutant  <ccoutant@google.com>
2730
2731         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2732         debug output when command lines differ.
2733
2734 2011-07-06  Cary Coutant  <ccoutant@google.com>
2735
2736         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2737         --incremental-patch option.
2738         * layout.cc (Free_list::allocate): Extend allocation beyond original
2739         end if enabled.
2740         (Layout::make_output_section): Mark sections that should get
2741         patch space.
2742         * options.cc (parse_percent): New function.
2743         * options.h (parse_percent): New function.
2744         (DEFINE_percent): New macro.
2745         (General_options): Add --incremental-patch option.
2746         * output.cc (Output_section::Output_section): Initialize new data
2747         members.
2748         (Output_section::add_input_section): Print section name when out
2749         of patch space.
2750         (Output_section::add_output_section_data): Likewise.
2751         (Output_section::set_final_data_size): Add patch space when
2752         doing --incremental-full.
2753         (Output_section::do_reset_address_and_file_offset): Remove patch
2754         space.
2755         (Output_segment::set_section_list_addresses): Print debug output
2756         only if --incremental-update.
2757         * output.h (Output_section::set_is_patch_space_allowed): New function.
2758         (Output_section::is_patch_space_allowed_): New data member.
2759         (Output_section::patch_space_): New data member.
2760         * parameters.cc (Parameters::incremental_full): New function.
2761         * parameters.h (Parameters::incremental_full): New function
2762         * testsuite/Makefile.am (incremental_test_2): Add test for
2763         --incremental-patch option.
2764         * testsuite/Makefile.in: Regenerate.
2765         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2766         (t18): Remove function body.
2767
2768 2011-07-05  Doug Kwan  <dougkwan@google.com>
2769
2770         PR gold/12771
2771         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2772         Arm_Address type for relocation result.
2773         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2774         overflow check.
2775         (Arm_relocate_functions::abs32): Use unaligned access.
2776         (Arm_relocate_functions::rel32): Ditto.
2777         (Arm_relocate_functions::prel31): Ditto.
2778         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2779         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2780         static data relocations.
2781         * testsuite/Makefile.in: Regnerate.
2782         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2783
2784 2011-07-05  Ian Lance Taylor  <iant@google.com>
2785
2786         PR gold/12392
2787         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2788         symbols if necessary.
2789         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2790
2791 2011-07-05  Ian Lance Taylor  <iant@google.com>
2792
2793         PR gold/12952
2794         * resolve.cc (Symbol::override_base_with_special): Simply override
2795         version with special symbol version, ignoring previous version.
2796
2797 2011-07-05  Ian Lance Taylor  <iant@google.com>
2798
2799         * object.cc (Sized_relobj_file::include_section_group): Add
2800         information to comment about signature location.
2801
2802 2011-07-02  Ian Lance Taylor  <iant@google.com>
2803
2804         PR gold/12957
2805         * options.h (class General_options): Add -f and -F.
2806         * options.cc (General_options::finalize): Fatal error if -f/-F
2807         are used without -shared.
2808         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2809
2810 2011-07-02  Ian Lance Taylor  <iant@google.com>
2811
2812         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2813
2814 2011-07-01  Ian Lance Taylor  <iant@google.com>
2815
2816         PR gold/12525
2817         PR gold/12952
2818         * resolve.cc (Symbol::override_base_with_special): Don't override
2819         the version if the overriding symbol has a different name.
2820         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2821         all callers.  If we give an error about an undefined version,
2822         define the base version if necessary.
2823         * dynobj.h (class Versions): Update declaration.
2824         * testsuite/weak_alias_test_5.cc: New file.
2825         * testsuite/weak_alias_test.script: New file.
2826         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2827         and versioned_alias have the right value, and call t2.
2828         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2829         weak_alias_test_5.so.
2830         (weak_alias_test_LDADD): Likewise.
2831         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2832         * testsuite/Makefile.in: Rebuild.
2833
2834 2011-07-01  Ian Lance Taylor  <iant@google.com>
2835
2836         PR gold/12525
2837         * options.h (class General_options): Support -z notext.
2838         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2839         -Wl,-z,notext.
2840         (two_file_shared_nonpic.so): Likewise.
2841         (two_file_shared_mixed.so): Likewise.
2842         (two_file_shared_mixed_1.so): Likewise.
2843         (weak_undef_lib_nonpic.so): Likewise.
2844         (alt/weak_undef_lib_nonpic.so): Likewise.
2845         (tls_test_shared_nonpic.so): Likewise.
2846         * testsuite/Makefile.in: Rebuild.
2847
2848 2011-07-01  Ian Lance Taylor  <iant@google.com>
2849
2850         PR gold/12525
2851         * configure.ac: Test whether static linking works, setting
2852         the automake conditional HAVE_STATIC.
2853         * testsuite/Makefile.am: Disable tests using -static if
2854         HAVE_STATIC is not true.
2855         * configure, testsuite/Makefile.in: Rebuild.
2856
2857 2011-07-01  Ian Lance Taylor  <iant@google.com>
2858
2859         PR gold/12525
2860         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2861         Assert if we see DW_EH_PE_indirect.
2862         * target.h (Target::ehframe_datarel_base): New function.
2863         (Target::do_ehframe_datarel_base): New target function.
2864         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2865         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2866         function.
2867
2868 2011-07-01  Ian Lance Taylor  <iant@google.com>
2869
2870         PR gold/12571
2871         * options.h (class General_options): Add
2872         --ld-generated-unwind-info.
2873         * ehframe.cc (Fde::write): Add address parameter.  Change all
2874         callers.  If associated with PLT, fill in address and size.
2875         (Cie::set_output_offset): Only add merge mapping if there is an
2876         object.
2877         (Cie::write): Add address parameter.  Change all callers.
2878         (Eh_frame::add_ehframe_for_plt): New function.
2879         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2880         input_offset_ fields into union u_, with new plt field.
2881         (Fde::Fde): Adjust for new union field.
2882         (Fde::Fde) [Output_data version]: New constructor.
2883         (Fde::add_mapping): Only add merge mapping if there is an object.
2884         (class Cie): Update declarations.
2885         (class Eh_frame): Declare add_ehframe_for_plt.
2886         * layout.cc (Layout::layout_eh_frame): Break out code into
2887         make_eh_frame_section, and call it.
2888         (Layout::make_eh_frame_section): New function.
2889         (Layout::add_eh_frame_for_plt): New function.
2890         * layout.h (class Layout): Update declarations.
2891         * merge.cc (Merge_map::add_mapping): Add assertion.
2892         * i386.cc: Include "dwarf.h".
2893         (class Output_data_plt_i386): Make first_plt_entry,
2894         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2895         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2896         and plt_eh_frame_fde.
2897         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2898         boundary.  Call add_eh_frame_for_plt if appropriate.
2899         * x86_64.cc: Include "dwarf.h".
2900         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2901         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2902         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2903         and plt_eh_frame_fde.
2904         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2905         appropriate.
2906
2907 2011-06-29  Ian Lance Taylor  <iant@google.com>
2908
2909         PR gold/12629
2910         * object.cc (Sized_relobj_file::layout_section): Change shdr
2911         parameter to be const.
2912         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2913         out of do_layout.
2914         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2915         appropriate.  Call layout_eh_frame_section.
2916         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2917         sections.
2918         * object.h (class Sized_relobj_file): Update declarations.
2919
2920 2011-06-29  Ian Lance Taylor  <iant@google.com>
2921
2922         PR gold/12652
2923         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2924         modifier.
2925         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2926
2927 2011-06-29  Ian Lance Taylor  <iant@google.com>
2928
2929         PR gold/12675
2930         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2931         SHT_X86_64_UNWIND.
2932         * layout.cc (Layout::layout_eh_frame): Likewise.
2933
2934 2011-06-29  Ian Lance Taylor  <iant@google.com>
2935
2936         PR gold/12695
2937         * layout.cc (Layout::symtab_section_shndx): New function.
2938         * layout.h (class Layout): Declare symtab_section_shndx.
2939         * output.cc (Output_section::write_header): Call it.
2940
2941 2011-06-29  Ian Lance Taylor  <iant@google.com>
2942
2943         PR gold/12818
2944         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2945         symbols which are not used in a relocation.
2946
2947 2011-06-28  Ian Lance Taylor  <iant@google.com>
2948
2949         PR gold/12898
2950         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2951         script create indistinguishable segments.
2952         (Layout::set_segment_offsets): Use stable_sort when sorting
2953         segments.  Pass this to Compare_segments constructor.
2954         * layout.h (class Layout): Make segment_precedes non-static.
2955         (class Compare_segments): Change from struct to class.  Add
2956         layout_ field.  Add constructor.
2957         * script-sections.cc
2958         (Script_sections::attach_sections_using_phdrs_clause): Rename
2959         local orphan to is_orphan.  Don't report failure to put empty
2960         section in segment.  On attachment failure, report name of
2961         section, and attach to first PT_LOAD segment.
2962
2963 2011-06-28  Ian Lance Taylor  <iant@google.com>
2964
2965         PR gold/12934
2966         * target-select.cc (Target_selector::Target_selector): Add
2967         emulation parameter.  Change all callers.
2968         (select_target_by_bfd_name): Rename from select_target_by_name.
2969         Change all callers.
2970         (select_target_by_emulation): New function.
2971         (supported_emulation_names): New function.
2972         * target-select.h (class Target_selector): Add emulation_ field.
2973         Update declarations.
2974         (Target_selector::recognize_by_bfd_name): Rename from
2975         recognize_by_name.  Change all callers.
2976         (Target_selector::supported_bfd_names): Rename from
2977         supported_names.  Change all callers.
2978         (Target_selector::recognize_by_emulation): New function.
2979         (Target_selector::supported_emulations): New function.
2980         (Target_selector::emulation): New function.
2981         (Target_selector::do_recognize_by_bfd_name): Rename from
2982         do_recognize_by_name.  Change all callers.
2983         (Target_selector::do_supported_bfd_names): Rename from
2984         do_supported_names.  Change all callers.
2985         (Target_selector::do_recognize_by_emulation): New function.
2986         (Target_selector::do_supported_emulations): New function.
2987         (select_target_by_bfd_name): Change name in declaration.
2988         (select_target_by_emulation): Declare.
2989         (supported_emulation_names): Declare.
2990         * parameters.cc (parameters_force_valid_target): Try to find
2991         target based on emulation from -m option.
2992         * options.h (class General_options): Change doc string for -m.
2993         * options.cc (help): Print emulations.
2994         (General_options::parse_V): Likewise.
2995         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2996         Add emulation parameter.  Change all callers.
2997
2998 2011-06-28  Ian Lance Taylor  <iant@google.com>
2999
3000         * target.h (class Target): Add osabi_ field.
3001         (Target::osabi): New function.
3002         (Target::set_osabi): New function.
3003         (Target::Target): Initialize osabi_.
3004         (Target::do_adjust_elf_header): Make pure virtual.
3005         (Sized_target::do_adjust_elf_header): Declare.
3006         * target.cc (Sized_target::do_adjust_elf_header): New function.
3007         (class Sized_target): Instantiate all versions.
3008         * freebsd.h (class Target_freebsd): Remove.
3009         (Target_selector_freebsd::do_recognize): Call set_osabi on
3010         Target.
3011         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3012         (Target_selector_freebsd::set_osabi): Remove.
3013         * i386.cc (class Target_i386): Inherit from Sized_target rather
3014         than Target_freebsd.
3015         * x86_64.cc (class Target_x86_64): Likewise.
3016
3017 2011-06-28  Ian Lance Taylor  <iant@google.com>
3018
3019         * target.h (Target::can_check_for_function_pointers): Rewrite.
3020         Make non-virtual.
3021         (Target::can_icf_inline_merge_sections): Likewise.
3022         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3023         (Target::Target_info): Add can_icf_inline_merge_sections field.
3024         (Target::do_can_check_for_function_pointers): New virtual
3025         function.
3026         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3027         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3028         from can_check_for_function_pointers, move in file.
3029         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3030         section_may_have_icf_unsafe_poineters, move in file.
3031         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3032         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3033         Rename from can_check_for_function_pointers, move in file.
3034         (Target_i386::can_icf_inline_merge_sections): Remove.
3035         (Target_i386::i386_info): Initialize
3036         can_icf_inline_merge_sections.
3037         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3038         Initialize can_icf_inline_merge_sections.
3039         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3040         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3041         Rename from can_check_for_function_pointers, move in file.
3042         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3043         (Target_x86_64::x86_64_info): Initialize
3044         can_icf_inline_merge_sections.
3045         * testsuite/testfile.cc (Target_test::test_target_info):
3046         Likewise.
3047         * icf.cc (get_section_contents): Correct formatting.
3048
3049 2011-06-27  Ian Lance Taylor  <iant@google.com>
3050
3051         * symtab.cc (Symbol::versioned_name): New function.
3052         (Symbol_table::add_to_final_symtab): Use versioned_name when
3053         appropriate.
3054         (Symbol_table::sized_write_symbol): Likewise.
3055         * symtab.h (class Symbol): Declare versioned_name.
3056         * stringpool.h (class Stringpool_template): Add variant of add
3057         which takes a std::basic_string.
3058         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3059         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3060         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3061         (ver_test_12.o): New target.
3062         * testsuite/Makefile.in: Rebuild.
3063
3064 2011-06-27  Doug Kwan  <dougkwan@google.com>
3065
3066         * arm.cc (Arm_relocate_functions::thm_jump8,
3067         Arm_relocate_functions::thm_jump11): Use a wider signed
3068         type to compute offset.
3069         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3070         arm_thm_jump8.
3071         * testsuite/Makefile.in: Regenerate.
3072         * testsuite/arm_branch_in_range.sh: Check test results of
3073         arm_thm_jump11 and arm_thm_jump8.
3074         * testsuite/arm_thm_jump11.s: New test source file.
3075         * testsuite/arm_thm_jump11.t: New linker script.
3076         * testsuite/arm_thm_jump8.s: New test source file.
3077         * testsuite/arm_thm_jump8.t: New linker script.
3078
3079 2011-06-24  Ian Lance Taylor  <iant@google.com>
3080
3081         * layout.cc: Include "object.h".
3082         (ctors_sections_in_init_array): New static variable.
3083         (Layout::is_ctors_in_init_array): New function.
3084         (Layout::layout): Add entry to ctors_sections_in_init_array if
3085         appropriate.
3086         * layout.h (class Layout): Declare is_ctors_in_init_array.
3087         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3088         is_ctors_reverse_view is set.
3089         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3090         all callers.  Set is_ctors_reverse_view field of View_size.
3091         (Sized_relobj_file::reverse_words): New function.
3092         * object.h (Sized_relobj_file::View_size): Add
3093         is_ctors_reverse_view field.
3094         (class Sized_relobj_file): Update declarations.
3095         * testsuite/initpri3.c: New test.
3096         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3097         initpri3b.
3098         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3099         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3100         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3101         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3102         * testsuite/Makefile.in: Rebuild.
3103
3104 2011-06-24  Cary Coutant  <ccoutant@google.com>
3105
3106         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3107         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3108         (debug_msg_cdebug.err): New targets.
3109         * testsuite/Makefile.in: Regenerate.
3110         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3111         Fix checks for link with shared library.
3112
3113 2011-06-24  Doug Kwan  <dougkwan@google.com>
3114
3115         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3116         skip empty text sections.
3117         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3118
3119 2011-06-22  Ian Lance Taylor  <iant@google.com>
3120
3121         PR gold/12910
3122         * options.h (class General_options): Add --ctors-in-init-array.
3123         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3124         friends as SHT_PROGBITS for merging sections.
3125         (Layout::layout): Remove special handling of .init_array and
3126         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3127         and .dtors if ctors_in_init_array.
3128         (Layout::make_output_section): Force correct section types for
3129         .init_array and friends.  Don't sort if doing relocatable link,
3130         Don't sort .ctors and .dtors if ctors_in_init_array.
3131         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3132         (Layout::output_section_name): Add relobj parameter.  Change all
3133         callers.  Handle .ctors. and .dtors. in code rather than table.
3134         Handle .ctors and .dtors if ctors_in_init_array.
3135         (Layout::match_file_name): New function, moved from output.cc.
3136         * layout.h (class Layout): Update declarations.
3137         * output.cc: Include "layout.h".
3138         (Input_section_sort_entry::get_priority): New function.
3139         (Input_section_sort_entry::match_file_name): Just call
3140         Layout::match_file_name.
3141         (Output_section::Input_section_sort_init_fini_compare::operator()):
3142         Handle .ctors and .dtors.  Sort by explicit priority rather than
3143         by name.
3144         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3145         * testsuite/initpri2.c: New test.
3146         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3147         (check_PROGRAMS): Add initpri2.
3148         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3149         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3150         * configure, testsuite/Makefile.in: Rebuild.
3151
3152 2011-06-19  Ian Lance Taylor  <iant@google.com>
3153
3154         PR gold/12880
3155         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3156         .interp section to a PT_INTERP segment even if we have seen a
3157         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3158         clause in a linker script.
3159         (Layout::finalize): Don't create a .interp section if we've
3160         already create a PT_INTERP segment.
3161         (Layout::create_interp): Always call choose_output_section (revert
3162         patch of 2011-06-17).  Don't create PT_INTERP segment.
3163         * script-sections.cc
3164         (Script_sections::create_note_and_tls_segments): Add a .interp
3165         section to a PT_INTERP segment even if we have seen a
3166         --dynamic-linker option.
3167
3168 2011-06-18  Ian Lance Taylor  <iant@google.com>
3169
3170         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3171         merely because a non-PT_LOAD segment has a dynamic reloc.
3172
3173 2011-06-18  Ian Lance Taylor  <iant@google.com>
3174
3175         * layout.cc (Layout::finish_dynamic_section): Don't create
3176         DT_FLAGS entry if not needed.
3177
3178 2011-06-18  Ian Lance Taylor  <iant@google.com>
3179
3180         PR gold/12745
3181         * layout.cc (Layout::layout_eh_frame): Correct handling of
3182         writable .eh_frame section.
3183
3184 2011-06-17  Ian Lance Taylor  <iant@google.com>
3185
3186         PR gold/12893
3187         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3188         symbol is redefined with the exact same object and value.
3189
3190 2011-06-17  Ian Lance Taylor  <iant@google.com>
3191
3192         PR gold/12880
3193         * layout.h (class Layout): Add interp_segment_ field.
3194         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3195         (Layout::attach_allocated_section_to_segment): If making shared
3196         library, put .interp section in PT_INTERP segment.
3197         (Layout::finalize): Also call create_interp if -dynamic-linker
3198         option was used.
3199         (Layout::create_interp): Assert that there is no PT_INTERP
3200         segment.  If not using a SECTIONS clause, use make_output_section.
3201         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3202         * script-sections.cc
3203         (Script_sections::create_note_and_tls_segments): If making shared
3204         library, put .interp section in PT_INTERP segment.
3205
3206 2011-06-17  Ian Lance Taylor  <iant@google.com>
3207
3208         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3209         when making a shared library.
3210
3211 2011-06-17  Ian Lance Taylor  <iant@google.com>
3212
3213         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3214         parameter.  Change all callers.  Don't issue warning about PC32
3215         against locally defined symbol.
3216
3217 2011-06-16  Ian Lance Taylor  <iant@google.com>
3218
3219         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3220         occurs in same object.
3221
3222 2011-06-14  Alan Modra  <amodra@gmail.com>
3223
3224         * po/POTFILES.in: Regenerate.
3225
3226 2011-06-09  Ian Lance Taylor  <iant@google.com>
3227
3228         * script-sections.cc
3229         (Orphan_output_section::set_section_addresses): For a relocatable
3230         link set address to 0.
3231
3232 2011-06-09  Cary Coutant  <ccoutant@google.com>
3233
3234         PR gold/12804
3235         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3236         used with --compress-debug-sections.
3237         * gold/object.cc (Sized_relobj_file::do_layout): Report
3238         uncompressed size of compressed input sections.
3239
3240 2011-06-08  Cary Coutant  <ccoutant@google.com>
3241
3242         PR gold/12804
3243         * testsuite/two_file_test_2_v1.cc: Change initialization of
3244         v2 to keep it in .data.
3245
3246 2011-06-07  Cary Coutant  <ccoutant@google.com>
3247
3248         * common.cc (Symbol_table::do_allocate_commons_list): Call
3249         gold_fallback.
3250         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3251         (Errors::fallback): New function.
3252         (gold_fallback): New function.
3253         * errors.h (Errors::fallback): New function.
3254         * gold.cc (gold_exit): Change status parameter to enum; adjust
3255         all callers.
3256         (queue_initial_tasks): Call gold_fallback.
3257         * gold.h: Include cstdlib.
3258         (Exit_status): New enum type.
3259         (gold_exit): Change status parameter to enum.
3260         (gold_fallback): New function.
3261         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3262         (Layout::create_symtab_sections): Likewise.
3263         (Layout::create_shdrs): Likewise.
3264         * main.cc (main): Adjust call to gold_exit.
3265         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3266         (Output_data_got::add_got_entry_pair): Likewise.
3267         (Output_section::add_input_section): Likewise.
3268         (Output_section::add_output_section_data): Likewise.
3269         (Output_segment::set_section_list_addresses): Likewise.
3270         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3271
3272 2011-06-07  Cary Coutant  <ccoutant@google.com>
3273
3274         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3275         for incremental links.
3276         * output.cc (Output_segment::set_section_list_addresses): Remove
3277         FIXME and test for TLS or BSS.
3278
3279 2011-06-07  Cary Coutant  <ccoutant@google.com>
3280
3281         * testsuite/Makefile.am: Add incremental_copy_test,
3282         incremental_common_test_1.
3283         * testsuite/Makefile.in: Regenerate.
3284         * testsuite/common_test_1_v1.c: New source file.
3285         * testsuite/common_test_1_v2.c: New source file.
3286         * testsuite/copy_test_v1.cc: New source file.
3287
3288 2011-06-07  Cary Coutant  <ccoutant@google.com>
3289
3290         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3291         update, allocate common from bss section's free list.
3292         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3293         linker-defined symbols.
3294         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3295         Skip GOT and PLT entries that are no longer referenced.
3296         (Output_section_incremental_inputs::write_info_blocks): Mark
3297         linker-defined symbols.
3298         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3299         * output.cc (Output_section::allocate): New function.
3300         * output.h (Output_section::allocate): New function.
3301         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3302         linker-defined symbols.
3303         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3304         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3305         (Symbol::init_base_output_data): Likewise.
3306         (Symbol::init_base_output_segment): Likewise.
3307         (Symbol::init_base_constant): Likewise.
3308         (Sized_symbol::init_output_data): Likewise.
3309         (Sized_symbol::init_output_segment): Likewise.
3310         (Sized_symbol::init_constant): Likewise.
3311         (Symbol_table::do_define_in_output_data): Likewise.
3312         (Symbol_table::do_define_in_output_segment): Likewise.
3313         (Symbol_table::do_define_as_constant): Likewise.
3314         * symtab.h (Symbol::is_predefined): New function.
3315         (Symbol::init_base_output_data): Add is_predefined parameter.
3316         (Symbol::init_base_output_segment): Likewise.
3317         (Symbol::init_base_constant): Likewise.
3318         (Symbol::is_predefined_): New data member.
3319         (Sized_symbol::init_output_data): Add is_predefined parameter.
3320         (Sized_symbol::init_output_segment): Likewise.
3321         (Sized_symbol::init_constant): Likewise.
3322         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3323
3324 2011-06-07  Cary Coutant  <ccoutant@google.com>
3325
3326         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3327         instead of emit_copy_reloc.
3328         (Copy_relocs::emit_copy_reloc): Refactor.
3329         (Copy_relocs::make_copy_reloc): New function.
3330         (Copy_relocs::add_copy_reloc): Remove.
3331         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3332         section.
3333         (Copy_relocs::make_copy_reloc): New function.
3334         (Copy_relocs::add_copy_reloc): Remove.
3335         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3336         unchanged input files.
3337         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3338         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3339         Reserve BSS space for COPY relocations.
3340         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3341         (Output_section_incremental_inputs::write_info_blocks): Record
3342         whether a symbol is copied from a shared object.
3343         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3344         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3345         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3346         (Incremental_input_entry_reader::get_output_symbol_index): Add
3347         is_copy parameter.
3348         (Incremental_binary::emit_copy_relocs): New function.
3349         (Incremental_binary::do_emit_copy_relocs): New function.
3350         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3351         new data member.
3352         (Sized_incremental_binary::add_copy_reloc): New function.
3353         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3354         (Sized_incremental_binary::Copy_reloc): New struct.
3355         (Sized_incremental_binary::Copy_relocs): New typedef.
3356         (Sized_incremental_binary::copy_relocs_): New data member.
3357         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3358         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3359         * target.h (Sized_target::emit_copy_reloc): New function.
3360         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3361
3362 2011-06-02  Cary Coutant  <ccoutant@google.com>
3363
3364         PR gold/12163
3365         * gold/archive.cc (Archive::Archive): Initialize new data member.
3366         (Archive::include_all_members): Return if archive has already been
3367         included.
3368         * gold/archive.h (Archive::include_all_members_): New data member.
3369
3370 2011-06-02  Nick Clifton  <nickc@redhat.com>
3371
3372         * dynobj.h: Fix spelling mistake in comment.
3373         * output.cc: Likewise.
3374
3375 2011-05-31  Doug Kwan  <dougkwan@google.com>
3376             Asier Llano
3377
3378         PR gold/12826
3379         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3380         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3381         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3382         redundant arm_exidx_test.so.
3383         * testsuite/Makefile.in: Regenerate.
3384         (check_SCRIPTS): Add pr12826.sh
3385         (check_DATA): Add pr12826.stdout
3386         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3387         * testsuite/pr12826.sh: New file.
3388         * testsuite/pr12826_1.s: Ditto.
3389         * testsuite/pr12826_1.s: Ditto.
3390
3391 2011-05-30  Ian Lance Taylor  <iant@google.com>
3392
3393         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3394         sections.
3395
3396 2011-05-29  Ian Lance Taylor  <iant@google.com>
3397
3398         PR gold/12804
3399         * testsuite/Makefile.am: Use different file name for two_file_test
3400         temporary file for each incremental test.
3401         * testsuite/Makefile.in: Rebuild.
3402
3403 2011-05-29  Ian Lance Taylor  <iant@google.com>
3404
3405         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3406         binary input file is empty.
3407
3408 2011-05-27  Ian Lance Taylor  <iant@google.com>
3409
3410         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3411         (ver_test_9.so): Likewise.
3412         * testsuite/Makefile.in: Rebuild.
3413
3414 2011-05-26 Cary Coutant  <ccoutant@google.com>
3415
3416         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3417         * incremental.cc (Incremental_inputs::report_input_section): Fix
3418         comment, indentation.
3419         (Incremental_inputs::report_comdat_group): New function.
3420         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3421         of data for incremental input file entry.
3422         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3423         group count, COMDAT group signatures.
3424         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3425         an unchanged input file.
3426         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3427         Initialize new data member.
3428         (Incremental_object_entry::add_comdat_group): New function.
3429         (Incremental_object_entry::get_comdat_group_count): New function.
3430         (Incremental_object_entry::get_comdat_signature_key): New function.
3431         (Incremental_object_entry::groups_): New data member.
3432         (Incremental_inputs::report_comdat_group): New function.
3433         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3434         data for incremental input file entry.
3435         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3436         (Incremental_input_entry_reader::get_input_section): Adjust size of
3437         data for incremental input file entry.
3438         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3439         (Incremental_input_entry_reader::get_comdat_group_signature): New
3440         function.
3441         * object.cc (Sized_relobj::include_section_group): Report kept
3442         COMDAT groups for incremental links.
3443
3444 2011-05-24  David Meyer  <pdox@google.com>
3445
3446         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3447         with name parameter.  Add found_name parameter.
3448         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3449         * dirsearch.h (class Dirsearch): Update declaration.
3450
3451 2011-05-24  Ian Lance Taylor  <iant@google.com>
3452
3453         * archive.cc (Library_base::should_include_member): Pull in object
3454         from archive if it defines the entry symbol.
3455         * parameters.cc (Parameters::entry): New function.
3456         * parameters.h (class Parameters): Declare entry.
3457         * output.h (class Output_file_header): Remove entry_ field.
3458         * output.cc (Output_file_header::Output_file_header): Remove entry
3459         parameter.  Change all callers.
3460         (Output_file_header::entry): Use parameters->entry.
3461         * gold.cc (queue_middle_tasks): Likewise.
3462         * plugin.cc (Plugin_hook::run): Likewise.
3463
3464 2011-05-24 Cary Coutant  <ccoutant@google.com>
3465
3466         * gold.cc (queue_initial_tasks): Pass incremental base filename
3467         to Output_file::open_base_file; don't print error message.
3468         * incremental-dump.cc (main): Adjust call to
3469         Output_file::open_for_modification.
3470         * incremental-dump.cc (main): Likewise.
3471         * incremental.cc (Incremental_inputs::report_command_line):
3472         Ignore --incremental-base option when comparing command lines.
3473         Ignore parameter when given as separate argument.
3474         * options.h (class General_options): Add --incremental-base.
3475         * output.cc (Output_file::Output_file):
3476         (Output_file::open_base_file): Add base_name and writable parameters;
3477         read base file into new file; print error message here.
3478         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3479         callers.
3480         * output.h (Output_file::open_for_modification): Rename to...
3481         (Output_file::open_base_file): ...this; add base_name and
3482         writable parameters; adjust all callers.
3483         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3484         callers.
3485         * testsuite/Makefile.am (incremental_test_4): Test
3486         --incremental-base.
3487         * testsuite/Makefile.in: Regenerate.
3488
3489 2011-05-24 Cary Coutant  <ccoutant@google.com>
3490
3491         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3492         incremental_test_4.
3493         * testsuite/Makefile.in: Regenerate.
3494         * testsuite/two_file_test_1_v1.cc: New test source file.
3495         * testsuite/two_file_test_1b_v1.cc: New test source file.
3496         * testsuite/two_file_test_2_v1.cc: New test source file.
3497
3498 2011-05-24 Cary Coutant  <ccoutant@google.com>
3499
3500         * dynobj.h (Dynobj::do_dynobj): New function.
3501         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3502         flag and soname for shared objects.
3503         * incremental.cc (Incremental_inputs::report_object): Make
3504         either Incremental_object_entry or Incremental_dynobj_entry; add
3505         soname to string table.
3506         (Incremental_inputs::report_input_section): Add assertion.
3507         (Output_section_incremental_inputs::set_final_data_size): Adjust
3508         type of input file entry for shared libraries; adjust size of
3509         shared library info entry.
3510         (Output_section_incremental_inputs::write_input_files): Write
3511         as_needed flag for shared libraries.
3512         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3513         of input file entry for shared libraries; write soname.
3514         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3515         soname from incremental info.
3516         * incremental.h (enum Incremental_input_flags): Add
3517         INCREMENTAL_INPUT_AS_NEEDED.
3518         (Incremental_input_entry::Incremental_input_entry): Initialize new
3519         data member.
3520         (Incremental_input_entry::set_as_needed): New function.
3521         (Incremental_input_entry::as_needed): New function.
3522         (Incremental_input_entry::do_dynobj_entry): New function.
3523         (Incremental_input_entry::as_needed_): New data member.
3524         (Incremental_object_entry::Incremental_object_entry): Don't check
3525         for shared library.
3526         (Incremental_object_entry::do_type): Likewise.
3527         (class Incremental_dynobj_entry): New class.
3528         (Incremental_input_entry_reader::as_needed): New function.
3529         (Incremental_input_entry_reader::get_soname): New function.
3530         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3531         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3532         size of shared library info entry.
3533         * layout.cc (Layout::finish_dynamic_section): Don't test for
3534         incremental link when adding DT_NEEDED entries.
3535         * object.h (Object::Object): Initialize new data member.
3536         (Object::dynobj): New function.
3537         (Object::set_as_needed): New function.
3538         (Object::as_needed): New function.
3539         (Object::do_dynobj): New function.
3540         (Object::as_needed_): New data member.
3541
3542 2011-05-24 Cary Coutant  <ccoutant@google.com>
3543
3544         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3545         info; adjust display of GOT entries.
3546         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3547         vector of input objects; remove file_status_.
3548         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3549         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3550         got_plt reader; call target hooks to reserve GOT entries.
3551         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3552         of input file info header and GOT info entry.
3553         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3554         relocation info.
3555         (Got_plt_view_info::got_descriptor): Remove.
3556         (Got_plt_view_info::sym_index): New data member.
3557         (Got_plt_view_info::input_index): New data member.
3558         (Local_got_offset_visitor::visit): Write input file index.
3559         (Global_got_offset_visitor::visit): Write 0 for input file index.
3560         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3561         with sym_index and input_index.
3562         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3563         incremental info GOT entry; replace got_descriptor with input_index.
3564         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3565         map from input file index to object.
3566         (Sized_relobj_incr::do_layout): Replace direct data member reference
3567         with accessor function.
3568         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3569         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3570         Adjust size of input file info header.
3571         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3572         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3573         (Incremental_input_entry_reader::get_input_section): Adjust size of
3574         input file info header.
3575         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3576         of incremental info GOT entry.
3577         (Incremental_got_plt_reader::get_got_desc): Remove.
3578         (Incremental_got_plt_reader::get_got_symndx): New function.
3579         (Incremental_got_plt_reader::get_got_input_index): New function.
3580         (Sized_incremental_binary::Sized_incremental_binary): Remove
3581         file_status_; add input_objects_.
3582         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3583         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3584         (Sized_incremental_binary::file_is_unchanged): Remove.
3585         (Sized_incremental_binary::set_input_object): New function.
3586         (Sized_incremental_binary::input_object): New function.
3587         (Sized_incremental_binary::file_status_): Remove.
3588         (Sized_incremental_binary::input_objects_): New data member.
3589         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3590         references.
3591         (Sized_relobj_incr::invalid_address): Move to base class.
3592         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3593         class.
3594         (Sized_relobj_incr::do_output_section_offset): Likewise.
3595         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3596         (Sized_relobj_incr::section_offsets_): Likewise.
3597         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3598         function.
3599         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3600         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3601         with accessor function.
3602         (Sized_relobj_file::do_layout): Likewise.
3603         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3604         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3605         (Sized_relobj_file::compute_final_local_value): Replace refs to
3606         section_offsets_ with accessor function.
3607         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3608         * object.h (Relobj::Relobj): Initialize new data members.
3609         (Relobj::add_dyn_reloc): New function.
3610         (Relobj::first_dyn_reloc): New function.
3611         (Relobj::dyn_reloc_count): New function.
3612         (Relobj::first_dyn_reloc_): New data member.
3613         (Relobj::dyn_reloc_count_): New data member.
3614         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3615         references.
3616         (Sized_relobj::Address): New typedef.
3617         (Sized_relobj::invalid_address): Move here from child class.
3618         (Sized_relobj::Sized_relobj): Initialize new data members.
3619         (Sized_relobj::sized_relobj): New function.
3620         (Sized_relobj::is_output_section_offset_invalid): Move here from
3621         child class.
3622         (Sized_relobj::get_output_section_offset): Likewise.
3623         (Sized_relobj::local_has_got_offset): Likewise.
3624         (Sized_relobj::local_got_offset): Likewise.
3625         (Sized_relobj::set_local_got_offset): Likewise.
3626         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3627         (Sized_relobj::clear_got_offsets): New function.
3628         (Sized_relobj::section_offsets): Move here from child class.
3629         (Sized_relobj::do_output_section_offset): Likewise.
3630         (Sized_relobj::do_set_section_offset): Likewise.
3631         (Sized_relobj::Local_got_offsets): Likewise.
3632         (Sized_relobj::local_got_offsets_): Likewise.
3633         (Sized_relobj::section_offsets_): Likewise.
3634         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3635         references.
3636         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3637         class.
3638         (Sized_relobj_file::sized_relobj): New function
3639         (Sized_relobj_file::local_has_got_offset): Move to base class.
3640         (Sized_relobj_file::local_got_offset): Likewise.
3641         (Sized_relobj_file::set_local_got_offset): Likewise.
3642         (Sized_relobj_file::get_output_section_offset): Likewise.
3643         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3644         (Sized_relobj_file::do_output_section_offset): Likewise.
3645         (Sized_relobj_file::do_set_section_offset): Likewise.
3646         (Sized_relobj_file::Local_got_offsets): Likewise.
3647         (Sized_relobj_file::local_got_offsets_): Likewise.
3648         (Sized_relobj_file::section_offsets_): Likewise.
3649         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3650         (all constructors).
3651         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3652         (Output_reloc::get_symbol_index): Likewise.
3653         (Output_reloc::local_section_offset): Likewise.
3654         (Output_reloc::get_address): Likewise.
3655         (Output_reloc::symbol_value): Likewise.
3656         (Output_data_got::reserve_slot): Move to class definition.
3657         (Output_data_got::reserve_local): New function.
3658         (Output_data_got::reserve_slot_for_global): Remove.
3659         (Output_data_got::reserve_global): New function.
3660         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3661         (all constructors, two instantiations).
3662         (Output_reloc::get_relobj): New function (two instantiations).
3663         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3664         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3665         (Output_data_reloc::add_global): Adjust type of relobj.
3666         (Output_data_reloc::add_global_relative): Likewise.
3667         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3668         (Output_data_reloc::add_local): Likewise.
3669         (Output_data_reloc::add_local_relative): Likewise.
3670         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3671         (Output_data_reloc::add_local_section): Likewise.
3672         (Output_data_reloc::add_output_section): Likewise.
3673         (Output_data_reloc::add_absolute): Likewise.
3674         (Output_data_reloc::add_target_specific): Likewise.
3675         (Output_data_got::reserve_slot): Move definition here.
3676         (Output_data_got::reserve_local): New function.
3677         (Output_data_got::reserve_global): New function.
3678         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3679         section_offsets_ with accessor function.
3680         (Sized_relobj_file::write_sections): Likewise.
3681         (Sized_relobj_file::do_relocate_sections): Likewise.
3682         * target.h (Sized_target::reserve_local_got_entry): New function.
3683         (Sized_target::reserve_global_got_entry): New function.
3684         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3685         (Target_x86_64::reserve_global_got_entry): New function.
3686         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3687
3688 2011-05-23 Cary Coutant  <ccoutant@google.com>
3689
3690         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3691         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3692         bit when checking got_type.
3693         * incremental.cc (Sized_incremental_binary::setup_readers):
3694         Store symbol table and string table locations; initialize bit vector
3695         of file status flags.
3696         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3697         unchanged files.
3698         (Sized_incremental_binary::do_process_got_plt): New function.
3699         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3700         (Output_section_incremental_inputs::set_final_data_size): Record
3701         file index for each input file.
3702         (Output_section_incremental_inputs::write_got_plt): Store file index
3703         instead of input entry offset for each GOT entry.
3704         * incremental.h
3705         (Incremental_input_entry::Incremental_input_entry): Initialize new
3706         data member.
3707         (Incremental_input_entry::set_offset): Store file index.
3708         (Incremental_input_entry::get_file_index): New function.
3709         (Incremental_input_entry::file_index_): New data member.
3710         (Incremental_binary::process_got_plt): New function.
3711         (Incremental_binary::do_process_got_plt): New function.
3712         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3713         data members.
3714         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3715         (Sized_incremental_binary::set_file_is_unchanged): New function.
3716         (Sized_incremental_binary::file_is_unchanged): New function.
3717         (Sized_incremental_binary::do_process_got_plt): New function.
3718         (Sized_incremental_binary::file_status_): New data member.
3719         (Sized_incremental_binary::main_symtab_loc_): New data member.
3720         (Sized_incremental_binary::main_strtab_loc_): New data member.
3721         * output.cc (Output_data_got::Got_entry::write): Add case
3722         RESERVED_CODE.
3723         (Output_data_got::add_global): Call add_got_entry.
3724         (Output_data_got::add_global_plt): Likewise.
3725         (Output_data_got::add_global_with_rel): Likewise.
3726         (Output_data_got::add_global_with_rela): Likewise.
3727         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3728         (Output_data_got::add_global_pair_with_rela): Likewise.
3729         (Output_data_got::add_local): Call add_got_entry.
3730         (Output_data_got::add_local_plt): Likewise.
3731         (Output_data_got::add_local_with_rel): Likewise.
3732         (Output_data_got::add_local_with_rela): Likewise.
3733         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3734         (Output_data_got::add_local_pair_with_rela): Likewise.
3735         (Output_data_got::reserve_slot): New function.
3736         (Output_data_got::reserve_slot_for_global): New function.
3737         (Output_data_got::add_got_entry): New function.
3738         (Output_data_got::add_got_entry_pair): New function.
3739         (Output_section::add_output_section_data): Edit FIXME.
3740         * output.h
3741         (Output_section_data_build::Output_section_data_build): New
3742         constructor with size parameter.
3743         (Output_data_space::Output_data_space): Likewise.
3744         (Output_data_got::Output_data_got): Initialize new data member; new
3745         constructor with size parameter.
3746         (Output_data_got::add_constant): Call add_got_entry.
3747         (Output_data_got::reserve_slot): New function.
3748         (Output_data_got::reserve_slot_for_global): New function.
3749         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3750         (Output_data_got::add_got_entry): New function.
3751         (Output_data_got::add_got_entry_pair): New function.
3752         (Output_data_got::free_list_): New data member.
3753         * target.h (Sized_target::init_got_plt_for_update): New function.
3754         (Sized_target::register_global_plt_entry): New function.
3755         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3756         Initialize new data member; call init; add constructor with PLT count.
3757         (Output_data_plt_x86_64::init): New function.
3758         (Output_data_plt_x86_64::add_relocation): New function.
3759         (Output_data_plt_x86_64::reserve_slot): New function.
3760         (Output_data_plt_x86_64::free_list_): New data member.
3761         (Target_x86_64::init_got_plt_for_update): New function.
3762         (Target_x86_64::register_global_plt_entry): New function.
3763         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3764         incremental updates.
3765         (Output_data_plt_x86_64::add_relocation): New function.
3766         * testsuite/object_unittest.cc (Object_test): Set default options.
3767
3768 2011-05-16  Ian Lance Taylor  <iant@google.com>
3769
3770         * options.h (class General_options): Make -i a synonym for -r.
3771
3772 2011-05-16  Ian Lance Taylor  <iant@google.com>
3773
3774         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3775
3776 2011-05-10 Cary Coutant  <ccoutant@google.com>
3777
3778         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3779         strip_all (-s).
3780
3781 2011-05-06  Ian Lance Taylor  <iant@google.com>
3782
3783         * layout.cc (Layout::layout): If the output section flags change,
3784         update the ordering.
3785
3786 2011-04-25 Cary Coutant  <ccoutant@google.com>
3787
3788         * incremental-dump.cc (dump_incremental_inputs): Print local
3789         symbol info for each input file.
3790         * incremental.cc
3791         (Output_section_incremental_inputs::set_final_data_size): Add local
3792         symbol info to input file entries in incremental info.
3793         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3794         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3795         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3796         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3797         implementation.
3798         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3799         (Sized_incr_relobj::do_relocate): Write the local symbols.
3800         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3801         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3802         Adjust size of input file header.
3803         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3804         (Incremental_inputs_reader::get_local_symbol_count): New function.
3805         (Incremental_inputs_reader::get_input_section): Adjust size of input
3806         file header.
3807         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3808         (Sized_incr_relobj::This): New typedef.
3809         (Sized_incr_relobj::sym_size): New const data member.
3810         (Sized_incr_relobj::Local_symbol): New struct.
3811         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3812         (Sized_incr_relobj::do_local_symbol_offset): New function.
3813         (Sized_incr_relobj::local_symbol_count_): New data member.
3814         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3815         (Sized_incr_relobj::local_symbol_index_): New data member.
3816         (Sized_incr_relobj::local_symbol_offset_): New data member.
3817         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3818         (Sized_incr_relobj::local_symbols_): New data member.
3819         * object.h (Relobj::output_local_symbol_count): New function.
3820         (Relobj::local_symbol_offset): New function.
3821         (Relobj::do_output_local_symbol_count): New function.
3822         (Relobj::do_local_symbol_offset): New function.
3823         (Sized_relobj::do_output_local_symbol_count): New function.
3824         (Sized_relobj::do_local_symbol_offset): New function.
3825
3826 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3827
3828         * descriptors.cc (set_close_on_exec): New function.
3829         (Descriptors::open): Use set_close_on_exec.
3830         * output.cc (S_ISLNK): Define if not defined.
3831
3832 2011-04-22 Cary Coutant  <ccoutant@google.com>
3833
3834         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3835         global symbol map.
3836         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3837         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3838         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3839         relocations.
3840         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3841         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3842         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3843         * incremental.h
3844         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3845         function.
3846         (Incremental_binary::apply_incremental_relocs): New function.
3847         (Incremental_binary::do_apply_incremental_relocs): New function.
3848         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3849         data member.
3850         (Sized_incremental_binary::add_global_symbol): New function.
3851         (Sized_incremental_binary::global_symbol): New function.
3852         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3853         (Sized_incremental_binary::symbol_map_): New data member.
3854         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3855         * target.h (Sized_target::apply_relocation): New function.
3856         * target-reloc.h (apply_relocation): New function.
3857         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3858
3859 2011-04-22  Doug Kwan  <dougkwan@google.com>
3860
3861         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3862         flag of a SHT_ARM_EXIDX section.
3863         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3864         * testsuite/Makefile.in: Regenerate.
3865         * testsuite/arm_exidx_test.s: New file.
3866         * testsuite/arm_exidx_test.sh: Same.
3867
3868 2011-04-20 Cary Coutant  <ccoutant@google.com>
3869
3870         PR gold/12689
3871         * archive.h (Incremental_archive_entry::Archive_member):
3872         Initialize arg_serial_ (second constructor).
3873
3874 2011-04-17  Ian Lance Taylor  <iant@google.com>
3875
3876         * object.cc (Relocate_info::location): Simplify location string.
3877         * errors.cc (Errors::error_at_location): Don't print program
3878         name.
3879         (Errors::warning_at_location): Likewise.
3880         (Errors::undefined_symbol): Likewise.
3881         * testsuite/debug_msg.sh: Update accordingly.
3882
3883 2011-04-14 Cary Coutant  <ccoutant@google.com>
3884
3885         * gold/layout.cc (Layout::symtab_section_offset): New function.
3886         * gold/layout.h (Layout::symtab_section_offset): New function.
3887         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3888
3889 2011-04-12  Ian Lance Taylor  <iant@google.com>
3890
3891         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3892         with MREMAP_MAYMOVE.
3893         * output.h (class Output_file): Add map_is_allocated_ field.
3894         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3895         not available, provide stubs.  If mremap is not available, #define
3896         it to gold_mremap.
3897         (MREMAP_MAYMOVE): Define if not defined.
3898         (Output_file::Output_file): Initialize map_is_allocated_.
3899         (Output_file::resize): Check map_is_allocated_.
3900         (Output_file::map_anonymous): If mmap fails, use malloc.
3901         (Output_file::unmap): Don't do anything for an anonymous map.
3902         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3903         is not available, provide stubs.
3904         (File_read::View::~View): Use free rather than delete[].
3905         (File_read::make_view): Use malloc rather than new[].  If mmap
3906         fails, use malloc.
3907         (File_read::find_or_make_view): Use malloc rather than new[].
3908         * gold.h: Remove HAVE_REMAP code.
3909         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3910         exists.  Rename mremap to gold_mremap.  If mmap is not available
3911         don't do anything.
3912         * configure, config.in: Rebuild.
3913
3914 2011-04-11  Ian Lance Taylor  <iant@google.com>
3915
3916         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3917         initialize local variable v.
3918
3919 2011-04-11  Cary Coutant  <ccoutant@google.com>
3920
3921         * archive.cc (Archive::include_member): Adjust call to
3922         report_object.
3923         (Add_archive_symbols::run): Track argument serial numbers.
3924         (Lib_group::include_member): Likewise.
3925         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3926         * archive.h (Incremental_archive_entry::Archive_member):
3927         Initialize arg_serial_.
3928         (Archive_member::arg_serial_): New data member.
3929         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3930         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3931         incremental link.
3932         (Sized_dynobj::do_for_all_local_got_entries): New function.
3933         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3934         function.
3935         * fileread.cc (get_mtime): New function.
3936         * fileread.h (get_mtime): New function.
3937         * gold.cc (queue_initial_tasks): Check for incremental update.
3938         (process_incremental_input): New function.
3939         (queue_middle_tasks): Don't force valid target for incremental
3940         update.
3941         * incremental-dump.cc (find_input_containing_global): Adjust
3942         size of symbol info entry.
3943         (dump_incremental_inputs): Dump argument serial number and
3944         in_system_directory flag; bias shndx by 1; print symbol names
3945         when dumping per-file symbol lists; use new symbol info readers.
3946         * incremental.cc
3947         (Output_section_incremental_inputs:update_data_size): New function.
3948         (Sized_incremental_binary::setup_readers): Setup input readers
3949         for each input file; build maps for files added from libraries
3950         and scripts.
3951         (Sized_incremental_binary::check_input_args): New function.
3952         (Sized_incremental_binary::do_check_inputs): Build map of argument
3953         serial numbers to input arguments.
3954         (Sized_incremental_binary::do_file_has_changed): Rename
3955         do_file_is_unchanged to this; compare file modification times.
3956         (Sized_incremental_binary::do_init_layout): New function.
3957         (Sized_incremental_binary::do_reserve_layout): New function.
3958         (Sized_incremental_binary::do_get_input_reader): Remove.
3959         (Sized_incremental_binary::get_symtab_view): New function.
3960         (Incremental_checker::can_incrementally_link_output_file): Remove.
3961         (Incremental_inputs::report_command_line): Exclude --debug options.
3962         (Incremental_inputs::report_archive_begin): Add parameter; track
3963         argument serial numbers; don't put input file entry for archive
3964         before archive members.
3965         (Incremental_inputs::report_archive_end): Put input file entry
3966         for archive after archive members.
3967         (Incremental_inputs::report_object): Add parameter; track argument
3968         serial numbers and in_system_directory flag.
3969         (Incremental_inputs::report_script): Add parameter; track argument
3970         serial numbers.
3971         (Output_section_incremental_inputs::set_final_data_size): Adjust
3972         size of symbol info entry; check for forwarding symbols.
3973         (Output_section_incremental_inputs::write_input_files): Write
3974         in_system_directory flag and argument serial number.
3975         (Output_section_incremental_inputs::write_info_blocks): Map section
3976         indices between incremental info and original input file; store
3977         input section index for each symbol.
3978         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3979         change operator() to visit().
3980         (class Global_got_offset_visitor): Likewise.
3981         (class Global_symbol_visitor_got_plt):
3982         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3983         classes.
3984         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3985         (Sized_incr_relobj::do_read_symbols): New function.
3986         (Sized_incr_relobj::do_layout): New function.
3987         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3988         (Sized_incr_relobj::do_add_symbols): New function.
3989         (Sized_incr_relobj::do_should_include_member): New function.
3990         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3991         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3992         (Sized_incr_relobj::do_section_size): New function.
3993         (Sized_incr_relobj::do_section_name): New function.
3994         (Sized_incr_relobj::do_section_contents): New function.
3995         (Sized_incr_relobj::do_section_flags): New function.
3996         (Sized_incr_relobj::do_section_entsize): New function.
3997         (Sized_incr_relobj::do_section_address): New function.
3998         (Sized_incr_relobj::do_section_type): New function.
3999         (Sized_incr_relobj::do_section_link): New function.
4000         (Sized_incr_relobj::do_section_info): New function.
4001         (Sized_incr_relobj::do_section_addralign): New function.
4002         (Sized_incr_relobj::do_initialize_xindex): New function.
4003         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4004         (Sized_incr_relobj::do_read_relocs): New function.
4005         (Sized_incr_relobj::do_gc_process_relocs): New function.
4006         (Sized_incr_relobj::do_scan_relocs): New function.
4007         (Sized_incr_relobj::do_count_local_symbols): New function.
4008         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4009         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4010         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4011         (Sized_incr_relobj::do_relocate): New function.
4012         (Sized_incr_relobj::do_set_section_offset): New function.
4013         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4014         (Sized_incr_dynobj::do_read_symbols): New function.
4015         (Sized_incr_dynobj::do_layout): New function.
4016         (Sized_incr_dynobj::do_add_symbols): New function.
4017         (Sized_incr_dynobj::do_should_include_member): New function.
4018         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4019         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4020         (Sized_incr_dynobj::do_section_size): New function.
4021         (Sized_incr_dynobj::do_section_name): New function.
4022         (Sized_incr_dynobj::do_section_contents): New function.
4023         (Sized_incr_dynobj::do_section_flags): New function.
4024         (Sized_incr_dynobj::do_section_entsize): New function.
4025         (Sized_incr_dynobj::do_section_address): New function.
4026         (Sized_incr_dynobj::do_section_type): New function.
4027         (Sized_incr_dynobj::do_section_link): New function.
4028         (Sized_incr_dynobj::do_section_info): New function.
4029         (Sized_incr_dynobj::do_section_addralign): New function.
4030         (Sized_incr_dynobj::do_initialize_xindex): New function.
4031         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4032         (make_sized_incremental_object): New function.
4033         (Incremental_library::copy_unused_symbols): New function.
4034         (Incremental_library::do_for_all_unused_symbols): New function.
4035         * incremental.h (enum Incremental_input_flags): New type.
4036         (class Incremental_checker): Remove.
4037         (Incremental_input_entry::Incremental_input_entry): Add argument
4038         serial number.
4039         (Incremental_input_entry::arg_serial): New function.
4040         (Incremental_input_entry::set_is_in_system_directory): New function.
4041         (Incremental_input_entry::is_in_system_directory): New function.
4042         (Incremental_input_entry::arg_serial_): New data member.
4043         (Incremental_input_entry::is_in_system_directory_): New data member.
4044         (class Script_info): Move here from script.h.
4045         (Script_info::Script_info): Add filename parameter.
4046         (Script_info::filename): New function.
4047         (Script_info::filename_): New data member.
4048         (Incremental_script_entry::Incremental_script_entry): Add argument
4049         serial number.
4050         (Incremental_object_entry::Incremental_object_entry): Likewise.
4051         (Incremental_object_entry::add_input_section): Build list of input
4052         sections with map to original shndx.
4053         (Incremental_object_entry::get_input_section_index): New function.
4054         (Incremental_object_entry::shndx_): New data member.
4055         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4056         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4057         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4058         serial number.
4059         (Incremental_inputs::report_archive_begin): Likewise.
4060         (Incremental_inputs::report_object): Likewise.
4061         (Incremental_inputs::report_script): Likewise.
4062         (class Incremental_global_symbol_reader): New class.
4063         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4064         and store flags and input file type.
4065         (Incremental_input_entry_reader::arg_serial): New function.
4066         (Incremental_input_entry_reader::type): Extract type from flags.
4067         (Incremental_input_entry_reader::is_in_system_directory): New function.
4068         (Incremental_input_entry_reader::get_input_section_count): Call
4069         accessor function for type.
4070         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4071         function for type; adjust size of global symbol entry.
4072         (Incremental_input_entry_reader::get_global_symbol_count): Call
4073         accessor function for type.
4074         (Incremental_input_entry_reader::get_object_count): Likewise.
4075         (Incremental_input_entry_reader::get_object_offset): Likewise.
4076         (Incremental_input_entry_reader::get_member_count): Likewise.
4077         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4078         (Incremental_input_entry_reader::get_member_offset): Likewise.
4079         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4080         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4081         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4082         (Incremental_input_entry_reader::get_global_symbol_reader): New
4083         function.
4084         (Incremental_input_entry_reader::get_output_symbol_index): New
4085         function.
4086         (Incremental_input_entry_reader::type_): Remove.
4087         (Incremental_input_entry_reader::flags_): New data member.
4088         (Incremental_inputs_reader::input_file_offset): New function.
4089         (Incremental_inputs_reader::input_file_index): New function.
4090         (Incremental_inputs_reader::input_file): Call input_file_offset.
4091         (Incremental_inputs_reader::input_file_at_offset): New function.
4092         (Incremental_relocs_reader::get_r_type): Reformat.
4093         (Incremental_relocs_reader::get_r_shndx): Reformat.
4094         (Incremental_relocs_reader::get_r_offset): Reformat.
4095         (Incremental_relocs_reader::data): New function.
4096         (Incremental_binary::Incremental_binary): Initialize new data members.
4097         (Incremental_binary::check_inputs): Add cmdline parameter.
4098         (Incremental_binary::file_is_unchanged): Remove.
4099         (Input_reader::arg_serial): New function.
4100         (Input_reader::get_unused_symbol_count): New function.
4101         (Input_reader::get_unused_symbol): New function.
4102         (Input_reader::do_arg_serial): New function.
4103         (Input_reader::do_get_unused_symbol_count): New function.
4104         (Input_reader::do_get_unused_symbol): New function.
4105         (Incremental_binary::input_file_count): New function.
4106         (Incremental_binary::get_input_reader): Change signature to use
4107         index instead of filename.
4108         (Incremental_binary::file_has_changed): New function.
4109         (Incremental_binary::get_input_argument): New function.
4110         (Incremental_binary::get_library): New function.
4111         (Incremental_binary::get_script_info): New function.
4112         (Incremental_binary::init_layout): New function.
4113         (Incremental_binary::reserve_layout): New function.
4114         (Incremental_binary::output_file): New function.
4115         (Incremental_binary::do_check_inputs): New function.
4116         (Incremental_binary::do_file_is_unchanged): Remove.
4117         (Incremental_binary::do_file_has_changed): New function.
4118         (Incremental_binary::do_init_layout): New function.
4119         (Incremental_binary::do_reserve_layout): New function.
4120         (Incremental_binary::do_input_file_count): New function.
4121         (Incremental_binary::do_get_input_reader): Change signature.
4122         (Incremental_binary::input_args_map_): New data member.
4123         (Incremental_binary::library_map_): New data member.
4124         (Incremental_binary::script_map_): New data member.
4125         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4126         new data members.
4127         (Sized_incremental_binary::output_section): New function.
4128         (Sized_incremental_binary::inputs_reader): Add const.
4129         (Sized_incremental_binary::symtab_reader): Add const.
4130         (Sized_incremental_binary::relocs_reader): Add const.
4131         (Sized_incremental_binary::got_plt_reader): Add const.
4132         (Sized_incremental_binary::get_symtab_view): New function.
4133         (Sized_incremental_binary::Inputs_reader): New typedef.
4134         (Sized_incremental_binary::Input_entry_reader): New typedef.
4135         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4136         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4137         (Sized_incremental_binary::do_file_has_changed): New function.
4138         (Sized_incremental_binary::do_init_layout): New function.
4139         (Sized_incremental_binary::do_reserve_layout): New function.
4140         (Sized_input_reader::Inputs_reader): Remove.
4141         (Sized_input_reader::Input_entry_reader): Remove.
4142         (Sized_input_reader::do_arg_serial): New function.
4143         (Sized_input_reader::do_get_unused_symbol_count): New function.
4144         (Sized_input_reader::do_get_unused_symbol): New function.
4145         (Sized_incremental_binary::do_input_file_count): New function.
4146         (Sized_incremental_binary::do_get_input_reader): Change signature;
4147         use index instead of filename.
4148         (Sized_incremental_binary::section_map_): New data member.
4149         (Sized_incremental_binary::input_entry_readers_): New data member.
4150         (class Sized_incr_relobj): New class.
4151         (class Sized_incr_dynobj): New class.
4152         (make_sized_incremental_object): New function.
4153         (class Incremental_library): New class.
4154         * layout.cc (Free_list::num_lists): New static data member.
4155         (Free_list::num_nodes): New static data member.
4156         (Free_list::num_removes): New static data member.
4157         (Free_list::num_remove_visits): New static data member.
4158         (Free_list::num_allocates): New static data member.
4159         (Free_list::num_allocate_visits): New static data member.
4160         (Free_list::init): New function.
4161         (Free_list::remove): New function.
4162         (Free_list::allocate): New function.
4163         (Free_list::dump): New function.
4164         (Free_list::print_stats): New function.
4165         (Layout_task_runner::run): Resize output file for incremental updates.
4166         (Layout::Layout): Initialize new data members.
4167         (Layout::set_incremental_base): New function.
4168         (Layout::init_fixed_output_section): New function.
4169         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4170         incremental updates.
4171         (Layout::create_gold_note): Do not create gold note section for
4172         incremental updates.
4173         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4174         for incremental updates.
4175         (Layout::set_section_offsets): For incremental updates, allocate space
4176         from free list.
4177         (Layout::create_symtab_sections): Layout with offsets relative to
4178         start of section; for incremental updates, allocate space from free
4179         list.
4180         (Layout::create_shdrs): For incremental updates, allocate space from
4181         free list.
4182         (Layout::finish_dynamic_section): For incremental updates, do not
4183         check --as-needed (fixed in subsequent patch).
4184         * layout.h (class Free_list): New class.
4185         (Layout::set_incremental_base): New function.
4186         (Layout::incremental_base): New function.
4187         (Layout::init_fixed_output_section): New function.
4188         (Layout::allocate): New function.
4189         (Layout::incremental_base_): New data member.
4190         (Layout::free_list_): New data member.
4191         * main.cc (main): Print Free_list statistics.
4192         * object.cc (Relobj::finalize_incremental_relocs): Add
4193         clear_counts parameter; clear counts only when clear_counts is set.
4194         (Sized_relobj::Sized_relobj): Initialize new base class.
4195         (Sized_relobj::do_layout): Don't report special sections.
4196         (Sized_relobj::do_for_all_local_got_entries): New function.
4197         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4198         symtab_off to all symbol table offsets.
4199         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4200         * object.h (class Got_offset_list): Move to top of file.
4201         (Object::Object): Allow case where input_file == NULL.
4202         (Object::~Object): Likewise.
4203         (Object::input_file): Assert that input_file != NULL.
4204         (Object::lock): Allow case where input_file == NULL.
4205         (Object::unlock): Likewise.
4206         (Object::is_locked): Likewise.
4207         (Object::token): Likewise.
4208         (Object::release): Likewise.
4209         (Object::is_incremental): New function.
4210         (Object::get_mtime): New function.
4211         (Object::for_all_local_got_entries): New function.
4212         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4213         (Object::set_is_in_system_directory): New function.
4214         (Object::is_in_system_directory): New function.
4215         (Object::do_is_incremental): New function.
4216         (Object::do_get_mtime): New function.
4217         (Object::do_for_all_local_got_entries): New function.
4218         (Object::is_in_system_directory_): New data member.
4219         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4220         (class Sized_relobj_base): New class.
4221         (class Sized_relobj): Derive from Sized_relobj_base.
4222         (class Sized_relobj::Symbols): Redeclare from base class.
4223         (class Sized_relobj::local_got_offset_list): Remove.
4224         (class Sized_relobj::Output_sections): Redeclare from base class.
4225         (class Sized_relobj::do_for_all_local_got_entries): New function.
4226         (class Sized_relobj::write_local_symbols): Add offset parameter.
4227         (class Sized_relobj::local_symbol_offset_): Update comment.
4228         (class Sized_relobj::local_dynsym_offset_): Update comment.
4229         * options.cc (Input_arguments::add_file): Remove const.
4230         * options.h (Input_file_argument::Input_file_argument):
4231         Initialize arg_serial_ (all constructors).
4232         (Input_file_argument::set_arg_serial): New function.
4233         (Input_file_argument::arg_serial): New function.
4234         (Input_file_argument::arg_serial_): New data member.
4235         (Input_arguments::Input_arguments): Initialize file_count_.
4236         (Input_arguments::add_file): Remove const.
4237         (Input_arguments::number_of_input_files): New function.
4238         (Input_arguments::file_count_): New data member.
4239         (Command_line::number_of_input_files): Call
4240         Input_arguments::number_of_input_files.
4241         * output.cc (Output_segment_headers::Output_segment_headers):
4242         Set current size.
4243         (Output_section::Input_section::current_data_size): New function.
4244         (Output_section::Output_section): Initialize new data members.
4245         (Output_section::add_input_section): Don't do merge sections for
4246         an incremental link; allocate space from free list for an
4247         incremental update.
4248         (Output_section::add_output_section_data): Allocate space from
4249         free list for an incremental update.
4250         (Output_section::update_data_size): New function.
4251         (Output_section::set_fixed_layout): New function.
4252         (Output_section::reserve): New function.
4253         (Output_segment::set_section_addresses): Remove const.
4254         (Output_segment::set_section_list_addresses): Remove const; allocate
4255         space from free list for an incremental update.
4256         (Output_segment::set_offset): Adjust size of RELRO segment for an
4257         incremental update.
4258         * output.h (Output_data::current_data_size): Move here from
4259         child classes.
4260         (Output_data::pre_finalize_data_size): New function.
4261         (Output_data::update_data_size): New function.
4262         (Output_section_headers::update_data_size): new function.
4263         (Output_section_data_build::current_data_size): Move to Output_data.
4264         (Output_data_strtab::update_data_size): New function.
4265         (Output_section::current_data_size): Move to Output_data.
4266         (Output_section::set_fixed_layout): New function.
4267         (Output_section::has_fixed_layout): New function.
4268         (Output_section::reserve): New function.
4269         (Output_section::update_data_size): New function.
4270         (Output_section::has_fixed_layout_): New data member.
4271         (Output_section::free_list_): New data member.
4272         (Output_segment::set_section_addresses): Remove const.
4273         (Output_segment::set_section_list_addresses): Remove const.
4274         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4275         New function.
4276         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4277         New function.
4278         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4279         parameter when calling Add_symbols constructor; store argument
4280         serial number for members of a lib group.
4281         (Add_symbols::locks): Allow case where token == NULL.
4282         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4283         (Read_member::~Read_member): New function.
4284         (Read_member::is_runnable): New function.
4285         (Read_member::locks): New function.
4286         (Read_member::run): New function.
4287         (Check_script::~Check_script): New function.
4288         (Check_script::is_runnable): New function.
4289         (Check_script::locks): New function.
4290         (Check_script::run): New function.
4291         (Check_library::~Check_library): New function.
4292         (Check_library::is_runnable): New function.
4293         (Check_library::locks): New function.
4294         (Check_library::run): New function.
4295         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4296         (Add_symbols::library_): New data member.
4297         (class Read_member): New class.
4298         (class Check_script): New class.
4299         (class Check_library): New class.
4300         * reloc.cc (Read_relocs::is_runnable): Allow case where
4301         token == NULL.
4302         (Read_relocs::locks): Likewise.
4303         (Scan_relocs::locks): Likewise.
4304         (Relocate_task::locks): Likewise.
4305         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4306         to clear counters.
4307         (Sized_relobj::incremental_relocs_scan): Fix comment.
4308         (Sized_relobj::do_relocate): Pass output file offset to
4309         write_local_symbols.
4310         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4311         from class declaration.
4312         * script.cc (read_input_script): Allocate Script_info; pass
4313         argument serial number to report_script.
4314         * script.h (class Script_info): Move to incremental.h.
4315         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4316         * symtab.h (Symbol_table::add_from_incrobj): New function.
4317         (Symbol_table::set_file_offset): New function.
4318
4319 2011-04-05  Cary Coutant  <ccoutant@google.com>
4320
4321         * incremental-dump.cc (dump_incremental_inputs): Change signature
4322         to take a Sized_incremental_binary; change caller.  Use readers
4323         in Sized_incremental_binary.
4324         * incremental.cc
4325         (Sized_incremental_binary::find_incremental_inputs_sections):
4326         Rename do_find_incremental_inputs_sections to this.
4327         (Sized_incremental_binary::setup_readers): New function.
4328         (Sized_incremental_binary::do_check_inputs): Check
4329         has_incremental_info_ flag; move setup code to setup_readers;
4330         use input readers.
4331         (Sized_incremental_binary::do_file_is_unchanged): New function.
4332         (Sized_incremental_binary::do_get_input_reader): New function.
4333         * incremental.h (class Incremental_binary): Move to end of file.
4334         (Incremental_binary::file_is_unchanged): New function.
4335         (Incremental_binary::do_file_is_unchanged): New function.
4336         (Incremental_binary::Input_reader): New class.
4337         (Incremental_binary::get_input_reader): New function.
4338         (class Sized_incremental_binary): Move to end of file.
4339         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4340         input section reader classes.
4341         (Sized_incremental_binary::has_incremental_info): New function.
4342         (Sized_incremental_binary::inputs_reader): New function.
4343         (Sized_incremental_binary::symtab_reader): New function.
4344         (Sized_incremental_binary::relocs_reader): New function.
4345         (Sized_incremental_binary::got_plt_reader): New function.
4346         (Sized_incremental_binary::do_file_is_unchanged): New function.
4347         (Sized_incremental_binary::Sized_input_reader): New class.
4348         (Sized_incremental_binary::get_input_reader): New function.
4349         (Sized_incremental_binary::find_incremental_inputs_sections):
4350         Rename do_find_incremental_inputs_sections to this.
4351         (Sized_incremental_binary::setup_readers): New function.
4352         (Sized_incremental_binary::has_incremental_info_): New data member.
4353         (Sized_incremental_binary::inputs_reader_): New data member.
4354         (Sized_incremental_binary::symtab_reader_): New data member.
4355         (Sized_incremental_binary::relocs_reader_): New data member.
4356         (Sized_incremental_binary::got_plt_reader_): New data member.
4357         (Sized_incremental_binary::current_input_file_): New data member.
4358
4359 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4360
4361         PR gold/12640
4362         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4363         violation.
4364
4365 2011-03-30  Cary Coutant  <ccoutant@google.com>
4366
4367         * archive.cc (Archive::include_member): Adjust call to report_object.
4368         (Add_archive_symbols::run): Add script_info to call to
4369         report_archive_begin.
4370         (Lib_group::include_member): Adjust call to report_object.
4371         (Add_lib_group_symbols::run): Adjust call to report_object.
4372         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4373         blocks.  Add object count for script input files.
4374         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4375         script_info parameter; change all callers.
4376         (Incremental_inputs::report_object): Add script_info parameter;
4377         change all callers.
4378         (Incremental_inputs::report_script): Store backpointer to
4379         incremental info entry.
4380         (Output_section_incremental_inputs::set_final_data_size): Record
4381         additional information for scripts.
4382         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4383         * incremental.h (Incremental_script_entry::add_object): New function.
4384         (Incremental_script_entry::get_object_count): New function.
4385         (Incremental_script_entry::get_object): New function.
4386         (Incremental_script_entry::objects_): New data member; adjust
4387         constructor.
4388         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4389         (Incremental_inputs::report_object): Add script_info parameter.
4390         (Incremental_inputs_reader::get_object_count): New function.
4391         (Incremental_inputs_reader::get_object_offset): New function.
4392         * options.cc (Input_arguments::add_file): Return reference to
4393         new input argument.
4394         * options.h (Input_argument::set_script_info): New function.
4395         (Input_argument::script_info): New function.
4396         (Input_argument::script_info_): New data member; adjust all
4397         constructors.
4398         (Input_file_group::add_file): Return reference to new input argument.
4399         (Input_file_lib::add_file): Likewise.
4400         (Input_arguments::add_file): Likewise.
4401         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4402         * script.cc (Parser_closure::Parser_closure): Add script_info
4403         parameter; adjust all callers.
4404         (Parser_closure::script_info): New function.
4405         (Parser_closure::script_info_): New data member.
4406         (read_input_script): Report scripts earlier to incremental info.
4407         (script_add_file): Set script_info in Input_argument.
4408         (script_add_library): Likewise.
4409         * script.h (Script_options::Script_info): Rewrite class.
4410
4411 2011-03-29  Cary Coutant  <ccoutant@google.com>
4412
4413         * archive.cc (Library_base::should_include_member): Move
4414         method here from class Archive.
4415         (Archive::Archive): Initialize base class.
4416         (Archive::should_include_member): Move to base class.
4417         (Archive::do_for_all_unused_symbols): New function.
4418         (Add_archive_symbols::run): Remove redundant access to
4419         incremental_inputs.
4420         (Lib_group::Lib_group): Initialize base class.
4421         (Lib_group::do_filename): New function.
4422         (Lib_group::include_member): Pass pointer to Lib_group to
4423         report_object.
4424         (Lib_group::do_for_all_unused_symbols): New function.
4425         (Add_lib_group_symbols::run): Report archive information for
4426         incremental links.
4427         * archive.h (class Library_base): New base class.
4428         (class Archive): Derive from Library_base.
4429         (Archive::filename): Move to base class.
4430         (Archive::set_incremental_info): Likewise.
4431         (Archive::incremental_info): Likewise.
4432         (Archive::Should_include): Likewise.
4433         (Archive::should_include_member): Likewise.
4434         (Archive::Armap_entry): Remove.
4435         (Archive::Unused_symbol_iterator): Remove.
4436         (Archive::unused_symbols_begin): Remove.
4437         (Archive::unused_symbols_end): Remove.
4438         (Archive::do_filename): New function.
4439         (Archive::do_get_mtime): New function.
4440         (Archive::do_for_all_unused_symbols): New function.
4441         (Archive::task_): Move to base class.
4442         (Archive::incremental_info_): Likewise.
4443         (class Lib_group): Derive from Library_base.
4444         (Lib_group::do_filename): New function.
4445         (Lib_group::do_get_mtime): New function.
4446         (Lib_group::do_for_all_unused_symbols): New function.
4447         (Lib_group::task_): Move to base class.
4448         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4449         function.
4450         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4451         function.
4452         * incremental.cc (Incremental_inputs::report_archive_begin):
4453         Use Library_base; call library's get_mtime; add incremental inputs
4454         entry before members.
4455         (class Unused_symbol_visitor): New class.
4456         (Incremental_inputs::report_archive_end): Use Library_base; use
4457         visitor class to record unused symbols; don't add incremental inputs
4458         entry after members.
4459         (Incremental_inputs::report_object): Use Library_base.
4460         * incremental.h
4461         (Incremental_archive_entry::Incremental_archive_entry): Remove
4462         unused Archive parameter.
4463         (Incremental_inputs::report_archive_begin): Use Library_base.
4464         (Incremental_inputs::report_archive_end): Likewise.
4465         (Incremental_inputs::report_object): Likewise.
4466         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4467         function.
4468         * object.h (Object::for_all_global_symbols): New function.
4469         (Object::do_for_all_global_symbols): New function.
4470         (Sized_relobj::do_for_all_global_symbols): New function.
4471         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4472         function.
4473         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4474         function.
4475
4476 2011-03-27  Ian Lance Taylor  <iant@google.com>
4477
4478         * archive.cc (Archive::interpret_header): Return -1 if something
4479         goes wrong.  Change callers accordingly.
4480
4481 2011-03-25  Cary Coutant  <ccoutant@google.com>
4482
4483         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4484         * testsuite/Makefile.in: Regenerate.
4485
4486 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4487
4488         * plugin.cc (get_view): New.
4489         (Plugin::load): Pass get_view to the plugin.
4490         (Plugin_manager::get_view): New.
4491
4492 2011-03-21  Ian Lance Taylor  <iant@google.com>
4493
4494         * testsuite/final_layout.sh: Rewrite to not use dc.
4495         * testsuite/relro_test.sh: Fail if dc is not present.
4496
4497 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4498
4499         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4500         Change == to -eq.
4501         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4502         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4503         Change == to -eq.
4504         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4505         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4506
4507 2011-03-14  Ian Lance Taylor  <iant@google.com>
4508
4509         * script-sections.cc (Sort_output_sections::script_compare):
4510         Rename from is_before, change return type.
4511         (Sort_output_sections::operator()): Adjust accordingly.
4512
4513 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4514
4515         PR gold/12572
4516         * testsuite/odr_violation2.cc: Add comment to make all error line
4517         numbers double digits.
4518         * testsuite/debug_msg.sh: Adjust expected errors.
4519
4520 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4521
4522         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4523         but mark earlier ones as non-canonical
4524         (offset_to_iterator): Update search target and example
4525         (do_addr2line): Return extra lines in a vector*
4526         (format_file_lineno): Extract from do_addr2line
4527         (one_addr2line): Add vector* out-param
4528         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4529         when a lineno entry appeared last for its instruction
4530         (Dwarf_line_info): Add vector* out-param
4531         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4532         * symtab.cc (Odr_violation_compare): Include the lineno in the
4533         comparison again.
4534         (linenos_from_loc): New. Combine the canonical line for an
4535         address with its other lines.
4536         (True_if_intersect): New. Helper functor to make
4537         std::set_intersection a query.
4538         (detect_odr_violations): Compare sets of lines instead of just
4539         one line for each function. This became less deterministic, but
4540         has fewer false positives.
4541         * symtab.h: Declarations.
4542         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4543         mix an optimized and non-optimized object in the same binary
4544         (odr_violation2.so): Same.
4545         * testsuite/Makefile.in: Regenerate from Makefile.am.
4546         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4547         * testsuite/debug_msg.sh: Update line numbers and add
4548         assertions.
4549         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4550         non-optimized context.
4551         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4552         isn't inlined, and use OdrDerived in an optimized context.
4553         * testsuite/odr_header1.h: Defines OdrDerived, where
4554         optimization will change the
4555         first-instruction-in-the-destructor's file and line number.
4556         * testsuite/odr_header2.h: Defines OdrBase.
4557
4558 2011-03-09  Ian Lance Taylor  <iant@google.com>
4559
4560         * fileread.cc (File_read::clear_views): Don't delete the whole
4561         file view.
4562
4563 2011-03-08  Ian Lance Taylor  <iant@google.com>
4564
4565         PR gold/12525
4566         * fileread.cc: #include <climits>.
4567         (GOLD_IOV_MAX): Define.
4568         (File_read::read_multiple): Limit number of entries by iov_max.
4569         * fileread.h (class File_read): Always set max_readv_entries to
4570         128.
4571
4572 2011-03-07  Ian Lance Taylor  <iant@google.com>
4573
4574         PR gold/12525
4575         * options.h (class General_options): Add -dy and -dn.
4576
4577 2011-03-02  Cary Coutant  <ccoutant@google.com>
4578
4579         * testsuite/script_test_9.t: Add TLS segment.
4580
4581 2011-03-02  Simon Baldwin  <simonb@google.com>
4582
4583         * configure.ac: Add check for gnu_indirect_function support in
4584         the toolchain building binutils.
4585         * configure: Rebuild.
4586
4587 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4588
4589         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4590         plugin only symbols.
4591         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4592         in plugin files as not needed in the symbol table.
4593
4594 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4595
4596         * output.cc (Output_section::add_input_section): Delay fill
4597         generation for section ordering.
4598
4599 2011-02-09  Ian Lance Taylor  <iant@google.com>
4600
4601         PR gold/12316
4602         * object.h (class Sized_relobj): Remove clear_local_symbols.
4603         * reloc.cc (Sized_relobj::do_relocate): Don't call
4604         clear_local_symbols.
4605
4606 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4607
4608         * plugin.cc (is_visible_from_outside): Return true for symbols
4609         in the -u option.
4610
4611 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4612
4613         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4614         filename.
4615
4616 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4617
4618         * icf.h (is_section_foldable_candidate): Change type of parameter
4619         to std::string.
4620         * icf.cc (Icf::find_identical_sections): Change type of local variable
4621         section_name to be std::string.
4622         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4623
4624 2011-01-25  Ian Lance Taylor  <iant@google.com>
4625
4626         * script.cc (script_add_extern): Rewrite to use
4627         add_symbol_reference.
4628
4629 2011-01-25  Doug Kwan  <dougkwan@google.com>
4630
4631         * icf.cc (get_section_contents): Always lock section's object.
4632
4633 2011-01-24  Ian Lance Taylor  <iant@google.com>
4634
4635         * options.h (class General_options): Accept
4636         --no-detect-odr-violations.
4637
4638 2011-01-24  Ian Lance Taylor  <iant@google.com>
4639
4640         * version.cc (version_string): Bump to 1.11.
4641
4642 2011-01-24  Ian Lance Taylor  <iant@google.com>
4643
4644         * plugin.cc (class Plugin_rescan): Define new class.
4645         (Plugin_manager::claim_file): Set any_claimed_.
4646         (Plugin_manager::save_archive): New function.
4647         (Plugin_manager::save_input_group): New function.
4648         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4649         necessary.
4650         (Plugin_manager::new_undefined_symbol): New function.
4651         (Plugin_manager::rescan): New function.
4652         (Plugin_manager::rescannable_defines): New function.
4653         (Plugin_manager::add_input_file): Set any_added_.
4654         * plugin.h (class Plugin_manager): define new fields rescannable_,
4655         undefined_symbols_, any_claimed_, and any_added_.  Declare
4656         Plugin_rescan as friend.  Declare new functions.
4657         (Plugin_manager::Rescannable): Define type.
4658         (Plugin_manager::Rescannable_list): Define type.
4659         (Plugin_manager::Undefined_symbol_list): Define type.
4660         (Plugin_manager::Plugin_manager): Initialize new fields.
4661         * archive.cc (Archive::defines_symbol): New function.
4662         (Add_archive_symbols::run): Pass archive to plugins if any.
4663         * archive.h (class Archive): Declare defines_symbol.
4664         * readsyms.cc (Input_group::~Input_group): New function.
4665         (Finish_group::run): Pass input_group to plugins if any.
4666         * readsyms.h (class Input_group): Declare destructor.
4667         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4668         any.
4669
4670 2011-01-10  Ian Lance Taylor  <iant@google.com>
4671
4672         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4673         section as relro.
4674         (Layout::set_segment_offsets): Reset increase_relro before calling
4675         set_section_addresses a second time.
4676
4677 2011-01-04  Cary Coutant  <ccoutant@google.com>
4678
4679         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4680         sections before NOBITS sections.
4681
4682 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4683
4684         * version.cc (print_version): Update copyright to 2011.
4685
4686 2010-12-23  Cary Coutant  <ccoutant@google.com>
4687
4688         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4689         of OS to this->add.  Add OD parameter to second form of the function.
4690
4691 2010-12-20  Ian Lance Taylor  <iant@google.com>
4692
4693         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4694         second of two consecutive entries with same offset.
4695
4696 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4697
4698         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4699         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4700         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4701         to avoid unneeded links against $(LDADD).
4702         * testsuite/Makefile.in: Regenerate.
4703
4704 2010-12-15  Ian Lance Taylor  <iant@google.com>
4705
4706         PR gold/12324
4707         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4708         for R_X86_64_32 and R_X86_64_PC32.
4709         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4710         ver_matching_def_pic.o.
4711         (ver_matching_def_pic.o): New target.
4712
4713 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4714
4715         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4716         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4717         Move definition before File_read::View member definitions.
4718         (File_read::View::~View): Initialize and hold lock before
4719         updating current_mapped_bytes.
4720
4721 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4722
4723         * dwarf_reader.cc: Remove outdated comment.
4724         * gold-threads.cc: Fix typo in error message.
4725         * archive.cc: Fix typos in comments.
4726         * archive.h: Likewise.
4727         * arm-reloc-property.cc: Likewise.
4728         * arm-reloc-property.h: Likewise.
4729         * arm-reloc.def: Likewise.
4730         * arm.cc: Likewise.
4731         * attributes.h: Likewise.
4732         * cref.cc: Likewise.
4733         * ehframe.cc: Likewise.
4734         * fileread.h: Likewise.
4735         * gold.h: Likewise.
4736         * i386.cc: Likewise.
4737         * icf.cc: Likewise.
4738         * incremental.h: Likewise.
4739         * int_encoding.cc: Likewise.
4740         * layout.h: Likewise.
4741         * main.cc: Likewise.
4742         * merge.h: Likewise.
4743         * object.cc: Likewise.
4744         * object.h: Likewise.
4745         * options.cc: Likewise.
4746         * readsyms.cc: Likewise.
4747         * reduced_debug_output.cc: Likewise.
4748         * reloc.cc: Likewise.
4749         * script-sections.cc: Likewise.
4750         * sparc.cc: Likewise.
4751         * symtab.h: Likewise.
4752         * target-reloc.h: Likewise.
4753         * target.cc: Likewise.
4754         * target.h: Likewise.
4755         * timer.cc: Likewise.
4756         * timer.h: Likewise.
4757         * x86_64.cc: Likewise.
4758
4759 2010-12-09  Cary Coutant  <ccoutant@google.com>
4760
4761         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4762         stack.
4763         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4764         parameter; change all callers.
4765         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4766         * options.h (warn_execstack): New option.
4767
4768 2010-12-07  Doug Kwan  <dougkwan@google.com>
4769
4770         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4771         like function call relocations.
4772
4773 2010-12-07  Ian Lance Taylor  <iant@google.com>
4774
4775         * archive.cc (Archive::get_elf_object_for_member): Permit
4776         punconfigured to be NULL.
4777         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4778         (Archive::include_member): Pass NULL to get_elf_object_for_member
4779         if we searched for the archive and this is the first included
4780         object.
4781
4782 2010-12-01  Ian Lance Taylor  <iant@google.com>
4783
4784         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4785         track_relocs_type_ field.
4786         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4787         Set track_relocs_type_.
4788         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4789         contents when using RELA relocs.
4790         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4791         reloc_map_.
4792         * reloc.cc (Track_relocs::next_addend): New function.
4793         * reloc.h (class Track_relocs): Declare next_addend.
4794
4795 2010-12-01  Ian Lance Taylor  <iant@google.com>
4796
4797         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4798         virtual destructor.
4799
4800 2010-12-01  Ian Lance Taylor  <iant@google.com>
4801
4802         * README: Update compilers known to work and fail.
4803
4804 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4805
4806         * configure.in: For --enable-gold, handle value `default' instead of
4807         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4808         not the default.
4809         * configure: Regenerate.
4810
4811 2010-11-18  Doug Kwan  <dougkwan@google.com>
4812
4813         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4814         and right_alignment to be zero.  Store result alignment only if it is
4815         greater than existing alignment.
4816
4817 2010-11-16  Cary Coutant  <ccoutant@google.com>
4818
4819         PR gold/12220
4820         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4821         Check for ".zdebug_line".
4822
4823 2010-11-16  Doug Kwan  <dougkwan@google.com>
4824             Cary Coutant  <ccoutant@google.com>
4825
4826         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4827         by reference; adjust all callers.
4828         * output.cc (Output_segment::set_section_addresses): Adjust references
4829         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4830         list is empty.
4831         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4832         end at page boundary.
4833
4834 2010-11-16  Cary Coutant  <ccoutant@google.com>
4835
4836         PR gold/12220
4837         * layout.cc (Layout::choose_output_section): Transform names of
4838         compressed sections even when using a script with a SECTIONS clause.
4839         (Layout::output_section_name): Remove code to transform
4840         compressed debug section names.
4841         * output.cc (Output_section::add_input_section): Use uncompressed
4842         section size when tracking input sections.
4843
4844 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4845
4846         * symtab.h (Symbol::NON_PIC_REF): Remove.
4847         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4848         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4849         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4850         (Symbol::use_plt_offset): Take a flags argument and pass it
4851         directly to needs_dynamic_reloc.  Restrict check for undefined
4852         weak symbols to function calls.
4853         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4854         (Target_arm::Scan::global): Use it.
4855         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4856         (Target_arm::Relocate::relocate): Likewise.
4857         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4858         parameter with an r_type parameter.  Use get_reference_flags
4859         to get the flags.
4860         (Target_arm::Relocate::relocate): Update accordingly.
4861         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4862         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4863         (Target_i386::Scan::global): Likewise.
4864         (Target_i386::Relocate::relocate): Likewise.
4865         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4866         parameter with an r_type parameter.  Use get_reference_flags
4867         to get the flags.
4868         (Target_i386::Relocate::relocate): Update accordingly.
4869         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4870         (Target_powerpc::Scan::global): Use it.
4871         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4872         (Target_powerpc::Relocate::relocate): Likewise.
4873         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4874         (Target_sparc::Scan::global): Use it.
4875         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4876         (Target_sparc::Relocate::relocate): Likewise.
4877         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4878         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4879         (Target_x86_64::Scan::global): Likewise.
4880         (Target_x86_64::Relocate::relocate): Likewise.
4881
4882 2010-11-08  Doug Kwan  <dougkwan@google.com>
4883             Cary Coutant  <ccoutant@google.com>
4884
4885         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4886         (Arm_exidx_merge_section::section_contents_): New data member.
4887         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4888         (Arm_input_section::~Arm_input_section): De-allocate memory.
4889         (Arm_input_section::original_contents_): New data member.
4890         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4891         in parameters instead of calling Object::section_contents without
4892         locking.
4893         (Arm_output_section::group_section): New parameter TASK.  Pass it
4894         to callees that need locking objects.
4895         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4896         to lock EXIDX input sections.  Fix a formatting issue.  Call
4897         Arm_exidx_merged_section::build_contents to create merged section
4898         contents.
4899         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4900         to lock object of stub table owner.
4901         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4902         TEXT_SIZE to initialize data member TEXT_SIZE_.
4903         (Arm_exidx_input_section::addralign): Fix typo in comment.
4904         (Arm_exidx_input_section::text_size): New method.
4905         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4906         that require locking objects.  Lock objects before scanning for stubs
4907         and updating local symbols.
4908         (Arm_input_section<big_endian>::init): Copy contents of original
4909         input section.
4910         (Arm_input_section<big_endian>::do_write): Use saved contents of
4911         original input section instead of calling Object::section_contents
4912         without locking.
4913         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4914         size without calling Object::section_size().
4915         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4916         for size.  Allocate a buffer for merged EXIDX entries.
4917         (Arm_exidx_merged_section::build_contents): New method.
4918         (Arm_exidx_merged_section::do_write): Move merge section contents
4919         building code to Arm_exidx_merged_section::build_contetns.  Write
4920         out contetns in buffer instead of building it on the fly.
4921         (Arm_relobj::make_exidx_input_section): Also pass text section size
4922         to Arm_exidx_input_section constructor.
4923         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4924         (Arm_dynobj::do_read_symbols): Fix memory leak.
4925         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4926         * target.h: (class Task): Add forward declaration.
4927         (Target::relax): Add new parameter TASK and pass it to
4928         Target::do_relax().
4929         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4930
4931 2010-11-05  Cary Coutant  <ccoutant@google.com>
4932
4933         PR gold/10708
4934         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4935         object when reading from the file.
4936         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4937         second layout pass.
4938         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4939         when reading section contents.
4940         (get_section_contents): Likewise.
4941         (icf::find_identical_sections): Likewise.
4942         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4943         object when reading from the file.
4944         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4945         the object when doing deferred section layout.
4946
4947 2010-11-03  Nick Clifton  <nickc@redhat.com>
4948
4949         PR gold/12001
4950         * script.h (class Symbol_assignment: name): New member.  Returns
4951         the name of the symbol.
4952         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4953         Returns true if the given symbol name is on the list of
4954         assignments wating to be processed.
4955         * archive.cc (should_incldue_member): If the symbol is undefined,
4956         check to see if it is on the list of symbols pending assignment.
4957
4958 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4959
4960         * script-sections.cc (Script_sections::find_memory_region): Check
4961         for a NULL output section pointer.
4962
4963 2010-10-29  Doug Kwan  <dougkwan@google.com>
4964
4965         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4966         Output_section::add_relaxed_input_section.
4967         * output.cc (Output_section::add_relaxed_input_section): Add new
4968         arguments LAYOUT and NAME.  Set section order index.
4969         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4970         Copy section order index.
4971         * output.h (Output_section::add_relaxed_input_section): Add new
4972         arguments LAYOUT and NAME.
4973
4974 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4975
4976         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4977         NATIVE_OR_CROSS_LINKER.
4978         * testsuite/Makefile.in: Regenerate.
4979
4980 2010-10-20  Doug Kwan  <dougkwan@google.com>
4981
4982         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4983         without SHF_LINK_ORDER flags.
4984         * layout.cc (Layout::choose_output_section): Do not filter
4985         SHF_LINK_ORDER flag in a relocatable link.
4986
4987 2010-10-17  Cary Coutant  <ccoutant@google.com>
4988
4989         * output.h (Output_segment::set_section_addresses): Change function
4990         signature.  Update all callers.
4991         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4992         sections.
4993         (Output_segment::set_section_addresses): Align after last TLS
4994         section.  Add padding before last relro section instead of after.
4995
4996 2010-10-17  Doug Kwan  <dougkwan@google.com>
4997
4998         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4999         GOT output section to be writable.
5000
5001 2010-10-14  Cary Coutant  <ccoutant@google.com>
5002
5003         * debug.h (DEBUG_INCREMENTAL): New flag.
5004         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5005         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5006         mode.
5007         * incremental.cc (report_command_line): Ignore all forms of
5008         --incremental.
5009         * layout.cc (Layout::Layout): Check parameters for incremental link
5010         mode.
5011         * options.cc (General_options::parse_incremental): New function.
5012         (General_options::parse_no_incremental): New function.
5013         (General_options::parse_incremental_full): New function.
5014         (General_options::parse_incremental_update): New function.
5015         (General_options::incremental_mode_): New data member.
5016         (General_options::finalize): Check incremental_mode_.
5017         * options.h (General_options): Update help text for --incremental.
5018         Add --no-incremental, --incremental-full, --incremental-update.
5019         (General_options::Incremental_mode): New enum type.
5020         (General_options::incremental_mode): New function.
5021         (General_options::incremental_mode_): New data member.
5022         * parameters.cc (Parameters::incremental_mode_): New data member.
5023         (Parameters::set_options): Set incremental_mode_.
5024         (Parameters::set_incremental_full): New function.
5025         (Parameters::incremental): New function.
5026         (Parameters::incremental_update): New function.
5027         (set_parameters_incremental_full): New function.
5028         * parameters.h (Parameters::set_incremental_full): New function.
5029         (Parameters::incremental): New function.
5030         (Parameters::incremental_update): New function.
5031         (Parameters::incremental_mode_): New data member.
5032         (set_parameters_incremental_full): New function.
5033         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5034         incremental link mode.
5035         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5036         (Sized_relobj::do_relocate_sections): Likewise.
5037         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5038         option.
5039         * testsuite/Makefile.in: Regenerate.
5040         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5041
5042 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5043
5044         * script-sections.h (class Script_sections): Make
5045         Sections_elements typedef public.
5046         * script-sections.cc (class Sort_output_sections): Add elements_
5047         field.  Add constructor which sets it; change all callers.
5048         (Sort_output_sections::is_before): New function.
5049         (Sort_output_sections::operator()): Call is_before.
5050         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5051         conditional.
5052         * testsuite/script_test_10.sh: New test. Test script section
5053         order.
5054         * testsuite/script_test_10.t: Likewise.
5055         * testsuite/script_test_10.s: Likewise.
5056         * testsuite/Makefile.am: Wrap the cross linker tests and the
5057         common tests into NATIVE_OR_CROSS_LINKER.
5058         (check_SCRIPTS): Add script_test_10.sh.
5059         (check_DATA): Add script_test_10.stdout.
5060         (script_test_10.o, script_test_10): New targets.
5061         (script_test_10.stdout): New target.
5062         * configure, testsuite/Makefile.in: Regenerate.
5063
5064 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5065
5066         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5067         error for the deprecated relocations.
5068         (Target_arm::Scan::global): Likewise.
5069         (Target_arm::Relocate::relocate): Likewise.
5070
5071 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5072
5073         * fileread.cc (Input_file::find_file): Initialize *found_name
5074         and *namep when using the fallback search for case 4.
5075
5076 2010-10-11  Cary Coutant  <ccoutant@google.com>
5077
5078         * options.h (class General_options): Redefine -z lazy as an alias for
5079         the negation of -z now.
5080
5081 2010-10-11  Ian Lance Taylor  <iant@google.com>
5082
5083         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5084         binding.
5085
5086 2010-10-06  Nick Clifton  <nickc@redhat.com>
5087
5088         * script-sections.cc(class Memory_region): Remove
5089         current_lma_offset_ field.  Rename current_vma_offset_ to
5090         current_offset_.  Add last_section_ field.
5091         (Memory_region::get_current_vma_address): Rename to
5092         get_current_address.
5093         (Memory_region::get_current_lma_address): Delete.
5094         (Memory_region::increment_vma_offset): Rename to
5095         increment_offset.
5096         (Memory_region::increment_lma_offset): Delete.
5097         (Memory_region::attributes_compatible): New method.  Returns
5098         true if the provided section is compatible with the region.
5099         (Memory_region::get_last_section): New method.  Returns the last
5100         section to use the region.
5101         (Memory_region::set_last_section): New method.  Stores the last
5102         section to use the region.
5103         (Script_sections::block_in_region): New method.  Returns true if
5104         a block of memory is contained within a region.
5105         (Script_sections::find_memory_region): New method.  Locates a
5106         memory region to be used to set a VMA or LMA address.
5107         (Output_section_definition::set_section_addresses): Add code to
5108         check for addresses set by memory regions.
5109         (Output_segment::set_section_addresses): Remove memory region
5110         walking code.
5111         (Script_sections::create_segment): Add a warning if a header
5112         segment is created outside of any region.
5113         * script-sections.h (class Script_sections): Add prototypes for
5114         find_memory_region and block_in_region methods.
5115         * testsuite/memory_test.s: Use .long instead of .word.
5116         * testsuite/memory_test.t: Add some more output sections.
5117         * testsuite/memory_test.sh: Update expected output.
5118
5119 2010-10-02  Doug Kwan  <dougkwan@google.com>
5120
5121         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5122         defintion to symtab.h
5123         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5124         declaration to defintion.
5125
5126 2010-10-01  Nick Clifton  <nickc@redhat.com>
5127
5128         * expression.cc (eval): Replace dummy argument with NULL.
5129         (eval_maybe_dot): Check for a NULL result section pointer.
5130         (Symbol_expression::value): Likewise.
5131         (Dot_expression::value): Likewise.
5132         (BINARY_EXPRESSION): Likewise.
5133         (Max_expression::value): Likewise.
5134         (Min_expression::value): Likewise.
5135         (Absolute_expression::value): Likewise.
5136         (Addr_expression::value_from_output_section): Likewise.
5137         (Loaddddr_expression::value_from_output_section): Likewise.
5138         (Segment_start_expression::value): Likewise.
5139         * script-sections.cc
5140         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5141         argument with NULL.
5142         (Sections_elememt_dot_assignment::set_section_addresses):
5143         Likewise.
5144         (Output_data_expression::do_write_to_buffer): Likewise.
5145         (Output_section_definition::finalize_symbols): Likewise.
5146         (Output_section_definition::set_section_addresses): Likewise.
5147
5148 2010-09-30  Doug Kwan  <dougkwan@google.com>
5149
5150         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5151
5152 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5153
5154         * target.h (Target::can_icf_inline_merge_sections): New virtual
5155         function.
5156         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5157         virtual function.
5158         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5159         virtual function.
5160         * icf.cc (get_section_contents): Inline merge sections only when
5161         target allows it.
5162
5163 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5164
5165         * configure: Regenerate.
5166
5167 2010-09-17  Ian Lance Taylor  <iant@google.com>
5168
5169         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5170         * testsuite/Makefile.am (memory_test.o): New target.
5171         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5172         memory_test.t.
5173         * testsuite/Makefile.in: Rebuild.
5174
5175 2010-09-17  Doug Kwan  <dougkwan@google.com>
5176
5177         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5178         defintion if relocation uses GOT entries of the symbol.
5179         * testsuite/icf_safe_test.sh: Fix test.
5180         * testsuite/icf_safe_so_test.sh: Fix test.
5181
5182 2010-09-16  Cary Coutant  <ccoutant@google.com>
5183
5184         * script_sections.cc (class Memory_region): Remove "NULL" from
5185         vector initializations.
5186
5187 2010-09-15  Cary Coutant  <ccoutant@google.com>
5188
5189         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5190         Resolve forwarding symbols.
5191
5192 2010-09-15  Doug Kwan  <dougkwan@google.com>
5193
5194         * gold/testsuite/script_test_3.t: Add ARM special sections.
5195         * gold/testsuite/script_test_4.t: Same.
5196         * gold/testsuite/script_test_5.t: Same.
5197         * gold/testsuite/script_test_6.t: Same.
5198         * gold/testsuite/script_test_7.t: Same.
5199         * gold/testsuite/script_test_7.t: Same.
5200         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5201
5202 2010-09-14  Cary Coutant  <ccoutant@google.com>
5203
5204         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5205         (Target_x86_64::Relocate::relocate_tls): Replace check for
5206         saw_tls_block_reloc_ with test for executable section.
5207
5208 2010-09-12  Cary Coutant  <ccoutant@google.com>
5209
5210         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5211         position-independent executables to shared libraries need dynamic
5212         relocations.
5213         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5214         position-independent executables.
5215         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5216         * testsuite/Makefile.in: Regenerate.
5217
5218 2010-09-10  Nick Clifton  <nickc@redhat.com>
5219
5220         PR gold/11997
5221         * testsuite/memory_test.t: Discard any sections that are not
5222         needed.
5223
5224 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5225
5226         PR gold/11996
5227         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5228         "This::" to work around a bug in gcc 4.2.
5229
5230         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5231
5232 2010-09-09  Rafael Espindola  <espindola@google.com>
5233
5234         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5235         sections with different PF_X flags in the same segment.
5236         (Layout::find_first_load_seg): Search all segments to find the first
5237         one.
5238         * options.h (rosegment): New.
5239
5240 2010-09-08  Rafael Espindola  <espindola@google.com>
5241
5242         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5243
5244 2010-09-08  Doug Kwan  <dougkwan@google.com>
5245
5246         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5247         (Arm_relobj::do_relocate_sections): Add new parameter for output
5248         file to match the parent.
5249         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5250         of local symbols instead of input values.  Update code to track
5251         changes in gold::relocate_section.
5252         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5253         (Sized_relobj::compute_final_local_value_internal): New methods.
5254         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5255         body into private version of Sized_relobj::compute_final_local_value.
5256         Call the inline method.
5257         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5258         merged symbol value if there is one.
5259         (Symbol_value::has_output_value): New method defintiion.
5260         (Sized_relobj::Compute_final_local_value_status): New enum type.
5261         (Sized_relobj::compute_final_local_value): New methods.
5262         (Sized_relobj::compute_final_local_value_internal): New methods.
5263         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5264         and arm_cortex_a8.sh.
5265         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5266         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5267         New tests.
5268         * Makefile.in: Regenerate.
5269         * testsuite/arm_bl_out_of_range.s: Update test.
5270         * testsuite/thumb_bl_out_of_range.s: Ditto.
5271         * testsuite/thumb_blx_out_of_range.s: Ditto.
5272         * testsuite/arm_branch_out_of_range.sh: New file.
5273         * testsuite/arm_cortex_a8.sh: Ditto.
5274         * testsuite/arm_cortex_a8_b.s: Ditto.
5275         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5276         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5277         * testsuite/arm_cortex_a8_bl.s: Ditto.
5278         * testsuite/arm_cortex_a8_blx.s: Ditto.
5279         * testsuite/arm_cortex_a8_local.s: Ditto.
5280         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5281         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5282
5283 2010-09-08  Rafael Espindola  <espindola@google.com>
5284
5285         * Makefile.am (memory_test.stdout): Run readelf with -W.
5286         * Makefile.in: Regenerate.
5287         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5288         64 bit output.
5289
5290 2010-09-08  Rafael Espindola  <espindola@google.com>
5291
5292         * script-sections.cc (Script_sections::add_memory_region): Convert
5293         field precision to int.
5294         * script.cc (script_set_section_region, script_set_section_region):
5295         Convert field precision to int.
5296
5297 2010-09-08  Rafael Espindola  <espindola@google.com>
5298
5299         * arm.cc (do_finalize_sections): Create the __exidx_start and
5300         __exdix_end symbols even when the section is missing.
5301
5302 2010-09-08  Nick Clifton  <nickc@redhat.com>
5303
5304         * README: Remove claim that MEMORY is not supported.
5305         * expression.cc (script_exp_function_origin)
5306         (script_exp_function_length): Move from here to ...
5307         * script.cc: ... here.
5308         (script_set_section_region, script_add_memory)
5309         (script_parse_memory_attr, script_include_directive): New
5310         functions.
5311         * script-sections.cc
5312         (class Memory_region): New class.
5313         (class Output_section_definition): Add set_memory_region,
5314         set_section_vma, set_section_lma and get_section_name methods.
5315         (class Script_Sections): Add add_memory_region,
5316         find_memory_region, find_memory_region_origin,
5317         find_memory_region_length and set_memory_region methods.
5318         Have set_section_addresses method walk the list of set memory
5319         regions.
5320         Extend the print methos to display memory regions.
5321         * script-sections.h: Add prototypes for new methods.
5322         Add enum for MEMORY region attributes.
5323         * yyscript.y: Add support for parsing MEMORY regions.
5324         * script-c.h: Add prototypes for new functions.
5325         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5326         * testsuite/Makefile.in: Regenerate.
5327         * testsuite/memory_test.sh: New script.
5328         * testsuite/memory_test.s: New assembler source file.
5329         * testsuite/memory_test.t: New linker script.
5330
5331 2010-08-27  Doug Kwan  <dougkwan@google.com>
5332
5333         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5334         reference override an existing dynamic weak reference.
5335         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5336         * testsuite/Makefile.in: Regenerate.
5337         * testsuite/dyn_weak_ref.sh: New file.
5338         * testsuite/dyn_weak_ref_1.c: Ditto.
5339         * testsuite/dyn_weak_ref_2.c: Ditto.
5340
5341 2010-08-27  Ian Lance Taylor  <iant@google.com>
5342
5343         * incremental.h (class Incremental_input_entry): Add virtual
5344         destructor.
5345
5346 2010-08-27  Ian Lance Taylor  <iant@google.com>
5347
5348         * testsuite/start_lib_test_3.c: Mark t3 as used.
5349
5350 2010-08-27  Nick Clifton  <nickc@redhat.com>
5351
5352         * options.cc (version_script): Fix small typo in previous
5353         whitespace tidyup.
5354
5355 2010-08-25  Nick Clifton  <nickc@redhat.com>
5356
5357         * archive.cc: Formatting fixes: Remove whitespace between
5358         typename and following asterisk.  Remove whitespace between
5359         function name and opening parenthesis.
5360         * archive.h: Likewise.
5361         * arm.cc: Likewise.
5362         * attributes.cc: Likewise.
5363         * attributes.h: Likewise.
5364         * common.cc: Likewise.
5365         * copy-relocs.cc: Likewise.
5366         * dirsearch.h: Likewise.
5367         * dynobj.cc: Likewise.
5368         * ehframe.cc: Likewise.
5369         * ehframe.h: Likewise.
5370         * expression.cc: Likewise.
5371         * fileread.cc: Likewise.
5372         * fileread.h: Likewise.
5373         * gc.h: Likewise.
5374         * gold-threads.cc: Likewise.
5375         * gold.cc: Likewise.
5376         * i386.cc: Likewise.
5377         * icf.h: Likewise.
5378         * incremental-dump.cc: Likewise.
5379         * incremental.cc: Likewise.
5380         * layout.cc: Likewise.
5381         * layout.h: Likewise.
5382         * main.cc: Likewise.
5383         * merge.cc: Likewise.
5384         * merge.h: Likewise.
5385         * object.cc: Likewise.
5386         * object.h: Likewise.
5387         * options.cc: Likewise.
5388         * options.h: Likewise.
5389         * output.cc: Likewise.
5390         * output.h: Likewise.
5391         * plugin.cc: Likewise.
5392         * plugin.h: Likewise.
5393         * powerpc.cc: Likewise.
5394         * reloc.cc: Likewise.
5395         * script-c.h: Likewise.
5396         * script-sections.cc: Likewise.
5397         * script.cc: Likewise.
5398         * stringpool.cc: Likewise.
5399         * symtab.cc: Likewise.
5400         * symtab.h: Likewise.
5401         * target.cc: Likewise.
5402         * timer.cc: Likewise.
5403         * timer.h: Likewise.
5404         * version.cc: Likewise.
5405         * x86_64.cc: Likewise.
5406
5407 2010-08-24  Nick Clifton  <nickc@redhat.com>
5408
5409         PR 11899
5410         * layout.cc (segment_precedes): Sort segments by their physical
5411         addresses, if they have been set.
5412
5413 2010-08-23  Cary Coutant  <ccoutant@google.com>
5414
5415         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5416         symbols data.
5417         (Lib_group::include_member): Unlock object after deleting its
5418         symbols data.
5419         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5420         the bug fixed here.
5421
5422 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5423             Cary Coutant  <ccoutant@google.com>
5424
5425         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5426         constructor, and set_blocker.
5427         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5428         readsyms_blocker_.
5429         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5430         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5431         * testsuite/Makefile.am (start_lib_test): New test case.
5432         * testsuite/Makefile.in: Regenerate.
5433         * testsuite/start_lib_test_main.c: New file.
5434         * testsuite/start_lib_test_1.c: New file.
5435         * testsuite/start_lib_test_2.c: New file.
5436         * testsuite/start_lib_test_3.c: New file.
5437
5438 2010-08-19  Ian Lance Taylor  <iant@google.com>
5439
5440         * Makefile.in: Rebuild with automake 1.11.1.
5441         * aclocal.m4: Likewise.
5442         * testsuite/Makefile.in: Likewise.
5443
5444 2010-08-19  Ian Lance Taylor  <iant@google.com>
5445
5446         PR 10893
5447         * i386.cc (class Output_data_plt_i386): Update declarations.
5448         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5449         local_ifuncs_ fields.
5450         (Target_i386::do_plt_section_for_global): New function.
5451         (Target_i386::do_plt_section_for_local): New function.
5452         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5453         parameter; change all callers.  Initialize global_ifuncs_ and
5454         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5455         __rel_iplt_end.
5456         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5457         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5458         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5459         symbols.
5460         (Target_i386::make_plt_section): New function, broken out of
5461         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5462         (Target_i386::make_plt_entry): Call make_plt_section.
5463         (Target_i386::make_local_ifunc_plt_entry): New function.
5464         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5465         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5466         R_386_IRELATIVE to switch.
5467         (Target_i386::Scan::global): Likewise.
5468         (Target_i386::Relocate::relocate): Likewise.
5469         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5470         switch.
5471         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5472         (Target_x86_64::do_plt_section_for_global): New function.
5473         (Target_x86_64::do_plt_section_for_local): New function.
5474         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5475         parameter; change all callers.  If doing a static link define
5476         __rela_iplt_start and __rela_iplt_end.
5477         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5478         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5479         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5480         to point to .plt.
5481         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5482         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5483         switch.
5484         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5485         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5486         R_X86_64_IRELATIVE to switch.
5487         (Target_x86_64::Scan::global): Likewise.
5488         (Target_x86_64::Relocate::relocate): Likewise.
5489         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5490         switch.
5491         * target.h (class Target): Add plt_section_for_global and
5492         plt_section_for_local functions.  Add do_plt_section_for_global
5493         and do_plt_section_for_local virtual functions.
5494         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5495         clarifying comments.
5496         (Symbol::use_plt_offset): Handle IFUNC symbol.
5497         * object.cc (Sized_relobj::Sized_relobj): Initialize
5498         local_plt_offsets_.
5499         (Sized_relobj::local_has_plt_offset): New function.
5500         (Sized_relobj::local_plt_offset): New function.
5501         (Sized_relobj::set_local_plt_offset): New function.
5502         (Sized_relobj::do_count): Handle IFUNC symbol.
5503         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5504         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5505         is_ifunc_symbol functions.
5506         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5507         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5508         local_plt_offsets_ field.
5509         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5510         * output.h (class Output_section_data): Add non-const
5511         output_section function.
5512         (class Output_data_got): Update declarations.
5513         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5514         Add use_plt_offset parameter to global and local constructors.
5515         Change all callers.  Change local_sym_index_ field to 31 bits.
5516         Change GSYM_CODE and CONSTANT_CODE accordingly.
5517         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5518         doing a static link don't set sh_link field.
5519         (Output_data_got::Got_entry::write): Use PLT offset if
5520         appropriate.
5521         (Output_data_got::add_global_plt): New function.
5522         (Output_data_got::add_local_plt): New function.
5523         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5524         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5525         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5526         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5527         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5528         IFUNC conditional.
5529         * testsuite/ifunc-sel.h: New file.
5530         * testsuite/ifuncmain1.c: New file.
5531         * testsuite/ifuncmain1vis.c: New file.
5532         * testsuite/ifuncmod1.c: New file.
5533         * testsuite/ifuncdep2.c: New file.
5534         * testsuite/ifuncmain2.c: New file.
5535         * testsuite/ifuncmain3.c: New file.
5536         * testsuite/ifuncmod3.c: New file.
5537         * testsuite/ifuncmain4.c: New file.
5538         * testsuite/ifuncmain5.c: New file.
5539         * testsuite/ifuncmod5.c: New file.
5540         * testsuite/ifuncmain6pie.c: New file.
5541         * testsuite/ifuncmod6.c: New file.
5542         * testsuite/ifuncmain7.c: New file.
5543         * configure, testsuite/Makefile.in: Rebuild.
5544
5545 2010-08-18  Ian Lance Taylor  <iant@google.com>
5546
5547         * incremental.cc
5548         (Output_section_incremental_inputs::write_input_files): Add cast
5549         to avoid signed/unsigned comparison warning.
5550         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5551
5552 2010-08-12  Cary Coutant  <ccoutant@google.com>
5553
5554         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5555
5556 2010-08-13  Ian Lance Taylor  <iant@google.com>
5557
5558         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5559
5560 2010-08-12  Cary Coutant  <ccoutant@google.com>
5561             Doug Kwan  <dougkwan@google.com>
5562
5563         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5564         defintion overrides non-weak undef, remember that the original undef
5565         is not weak.
5566         * symtab.cc (Symbol_table::sized_write_global): For undef without
5567         an original weak binding, set binding to global in output.
5568         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5569         * testsuite/Makefile.in: Regenerate.
5570         * testsuite/strong_ref_weak_def.sh: New file.
5571         * testsuite/strong_ref_weak_def_1.c: Ditto.
5572         * testsuite/strong_ref_weak_def_2.c: Ditto.
5573
5574 2010-08-12  Cary Coutant  <ccoutant@google.com>
5575
5576         * testsuite/incremental_test.sh: Rewrite.
5577         * testsuite/incremental_test_1.c: Rewrite.
5578         * testsuite/incremental_test_2.c: Rewrite.
5579
5580 2010-08-12  Cary Coutant  <ccoutant@google.com>
5581
5582         * arm.cc (Target_arm::got_size): Add const.
5583         (Target_arm::got_entry_count): New function.
5584         (Target_arm::plt_entry_count): New function.
5585         (Target_arm::first_plt_entry_offset): New function.
5586         (Target_arm::plt_entry_size): New function.
5587         (Output_data_plt_arm::entry_count): New function.
5588         (Output_data_plt_arm::first_plt_entry_offset): New function.
5589         (Output_data_plt_arm::get_plt_entry_size): New function.
5590         * i386.cc (Target_i386::got_size): Add const.
5591         (Target_i386::got_entry_count): New function.
5592         (Target_i386::plt_entry_count): New function.
5593         (Target_i386::first_plt_entry_offset): New function.
5594         (Target_i386::plt_entry_size): New function.
5595         (Output_data_plt_i386::entry_count): New function.
5596         (Output_data_plt_i386::first_plt_entry_offset): New function.
5597         (Output_data_plt_i386::get_plt_entry_size): New function.
5598         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5599         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5600         * incremental.cc: Include target.h.
5601         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5602         parameter.  Adjust all callers.  Find incremental_got_plt section.
5603         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5604         section.
5605         (Output_section_incremental_inputs::set_final_data_size): Calculate
5606         size of incremental_got_plt section.
5607         (Output_section_incremental_inputs::do_write): Write the
5608         incremental_got_plt section.
5609         (Got_plt_view_info): New struct.
5610         (Local_got_offset_visitor): New class.
5611         (Global_got_offset_visitor): New class.
5612         (Global_symbol_visitor_got_plt): New class.
5613         (Output_section_incremental_inputs::write_got_plt): New function.
5614         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5615         Add parameter.  Adjust all callers.
5616         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5617         (Incremental_inputs::got_plt_section): New function.
5618         (Incremental_inputs::got_plt_section_): New data member.
5619         (Incremental_got_plt_reader): New class.
5620         * layout.cc (Layout::create_incremental_info_sections): Add the
5621         incremental_got_plt section.
5622         * object.h (Got_offset_list::get_list): New function.
5623         (Got offset_list::for_all_got_offsets): New function.
5624         (Sized_relobj::local_got_offset_list): New function.
5625         * powerpc.cc (Target_powerpc::got_size): Add const.
5626         (Target_powerpc::got_entry_count): New function.
5627         (Target_powerpc::plt_entry_count): New function.
5628         (Target_powerpc::first_plt_entry_offset): New function.
5629         (Target_powerpc::plt_entry_size): New function.
5630         (Output_data_plt_powerpc::entry_count): New function.
5631         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5632         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5633         * sparc.cc (Target_sparc::got_size): Add const.
5634         (Target_sparc::got_entry_count): New function.
5635         (Target_sparc::plt_entry_count): New function.
5636         (Target_sparc::first_plt_entry_offset): New function.
5637         (Target_sparc::plt_entry_size): New function.
5638         (Output_data_plt_sparc::entry_count): New function.
5639         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5640         (Output_data_plt_sparc::get_plt_entry_size): New function.
5641         * symtab.h (Symbol::got_offset_list): New function.
5642         (Symbol_table::for_all_symbols): New function.
5643         * target.h (Sized_target::got_entry_count): New function.
5644         (Sized_target::plt_entry_count): New function.
5645         (Sized_target::plt_entry_size): New function.
5646         * x86_64.cc (Target_x86_64::got_size): Add const.
5647         (Target_x86_64::got_entry_count): New function.
5648         (Target_x86_64::plt_entry_count): New function.
5649         (Target_x86_64::first_plt_entry_offset): New function.
5650         (Target_x86_64::plt_entry_size): New function.
5651         (Output_data_plt_x86_64::entry_count): New function.
5652         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5653         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5654
5655 2010-08-12  Cary Coutant  <ccoutant@google.com>
5656
5657         * archive.cc: Include incremental.h.
5658         (Archive::Archive): Initialize incremental_info_.
5659         (Archive::include_member): Record archive members in incremental info.
5660         (Add_archive_symbols::run): Record begin and end of an archive in
5661         incremental info.
5662         (Lib_group::include_member): Record objects in incremental info.
5663         * archive.h (Incremental_archive_entry): Forward declaration.
5664         (Archive::set_incremental_info): New member function.
5665         (Archive::incremental_info): New member function.
5666         (Archive::Unused_symbol_iterator): New class.
5667         (Archive::unused_symbols_begin): New member function.
5668         (Archive::unused_symbols_end): New member function.
5669         (Archive::incremental_info_): New data member.
5670         * incremental-dump.cc (find_input_containing_global): New function.
5671         (dump_incremental_inputs): Dump new incremental info sections.
5672         * incremental.cc: Include symtab.h.
5673         (Output_section_incremental_inputs): New class.
5674         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5675         new incremental info sections.
5676         (Sized_incremental_binary::do_check_inputs): Likewise.
5677         (Incremental_inputs::report_archive): Remove.
5678         (Incremental_inputs::report_archive_begin): New function.
5679         (Incremental_inputs::report_archive_end): New function.
5680         (Incremental_inputs::report_object): New function.
5681         (Incremental_inputs::finalize_inputs): Remove.
5682         (Incremental_inputs::report_input_section): New function.
5683         (Incremental_inputs::report_script): Rewrite.
5684         (Incremental_inputs::finalize): Do nothing but finalize string table.
5685         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5686         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5687         (Incremental_inputs::create_data_sections): New function.
5688         (Incremental_inputs::relocs_entsize): New function.
5689         (Output_section_incremental_inputs::set_final_data_size): New function.
5690         (Output_section_incremental_inputs::do_write): New function.
5691         (Output_section_incremental_inputs::write_header): New function.
5692         (Output_section_incremental_inputs::write_input_files): New function.
5693         (Output_section_incremental_inputs::write_info_blocks): New function.
5694         (Output_section_incremental_inputs::write_symtab): New function.
5695         * incremental.h (Incremental_script_entry): Forward declaration.
5696         (Incremental_object_entry): Forward declaration.
5697         (Incremental_archive_entry): Forward declaration.
5698         (Incremental_inputs): Forward declaration.
5699         (Incremental_inputs_header_data): Remove.
5700         (Incremental_inputs_header): Remove.
5701         (Incremental_inputs_header_write): Remove.
5702         (Incremental_inputs_entry_data): Remove.
5703         (Incremental_inputs_entry): Remove.
5704         (Incremental_inputs_entry_write): Remove.
5705         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5706         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5707         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5708         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5709         Likewise.
5710         (Incremental_input_entry): New class.
5711         (Incremental_script_entry): New class.
5712         (Incremental_object_entry): New class.
5713         (Incremental_archive_entry): New class.
5714         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5715         (Incremental_inputs::report_inputs): Remove.
5716         (Incremental_inputs::report_archive): Remove.
5717         (Incremental_inputs::report_archive_begin): New function.
5718         (Incremental_inputs::report_archive_end): New function.
5719         (Incremental_inputs::report_object): Change prototype.
5720         (Incremental_inputs::report_input_section): New function.
5721         (Incremental_inputs::report_script): Change prototype.
5722         (Incremental_inputs::get_reloc_count): New function.
5723         (Incremental_inputs::set_reloc_count): New function.
5724         (Incremental_inputs::create_data_sections): New function.
5725         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5726         (Incremental_inputs::inputs_section): New function.
5727         (Incremental_inputs::symtab_section): New function.
5728         (Incremental_inputs::relocs_section): New function.
5729         (Incremental_inputs::get_stringpool): Add const.
5730         (Incremental_inputs::command_line): Add const.
5731         (Incremental_inputs::inputs): Remove.
5732         (Incremental_inputs::command_line_key): New function.
5733         (Incremental_inputs::input_file_count): New function.
5734         (Incremental_inputs::input_files): New function.
5735         (Incremental_inputs::relocs_entsize): New function.
5736         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5737         (Incremental_inputs::finalize_inputs): Remove.
5738         (Incremental_inputs::Input_info): Remove.
5739         (Incremental_inputs::lock_): Remove.
5740         (Incremental_inputs::inputs_): Change type.
5741         (Incremental_inputs::inputs_map_): Remove.
5742         (Incremental_inputs::current_object_entry_): New data member.
5743         (Incremental_inputs::inputs_section_): New data member.
5744         (Incremental_inputs::symtab_section_): New data member.
5745         (Incremental_inputs::relocs_section_): New data member.
5746         (Incremental_inputs::reloc_count_): New data member.
5747         (Incremental_inputs_reader): New class.
5748         (Incremental_symtab_reader): New class.
5749         (Incremental_relocs_reader): New class.
5750         * layout.cc (Layout::finalize): Move finalization of incremental info
5751         and creation of incremental info sections to follow finalization of
5752         symbol table.  Set offsets for postprocessing sections.
5753         (Layout::create_incremental_info_sections): Call
5754         Incremental_inputs::create_data_sections.  Add incremental symtab
5755         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5756         sections to layout after input sections.
5757         * layout.h (struct Timespec): Forward declaration.
5758         (Layout::incremental_inputs): Add const.
5759         (Layout::create_incremental_info_sections): Add parameter.
5760         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5761         * object.cc: Include incremental.h.
5762         (Relobj::finalize_incremental_relocs): New function.
5763         (Sized_relobj::do_layout): Record input sections in incremental info.
5764         * object.h (Object::output_section): New function.
5765         (Object::output_section_offset): Moved from Relobj.
5766         (Object::get_incremental_reloc_base): New function.
5767         (Object::get_incremental_reloc_count): New function.
5768         (Object::do_output_section): New function.
5769         (Object::do_output_section_offset): Moved from Relobj.
5770         (Object::do_get_incremental_reloc_base): New function.
5771         (Object::do_get_incremental_reloc_count): New function.
5772         (Object::Object): Initialize new data members.
5773         (Relobj::output_section): Renamed do_output_section and moved to
5774         protected.
5775         (Relobj::output_section_offset): Moved to Object.
5776         (Relobj::do_get_incremental_reloc_base): New function.
5777         (Relobj::do_get_incremental_reloc_count): New function.
5778         (Relobj::allocate_incremental_reloc_counts): New function.
5779         (Relobj::count_incremental_reloc): New function.
5780         (Relobj::finalize_incremental_relocs): New function.
5781         (Relobj::next_incremental_reloc_index): New function.
5782         (Relobj::reloc_counts_): New data member.
5783         (Relobj::reloc_bases_): New data member.
5784         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5785         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5786         (Sized_relobj::incremental_relocs_scan): New function.
5787         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5788         (Sized_relobj::incremental_relocs_write): New function.
5789         (Sized_relobj::incremental_relocs_write_reltype): New function.
5790         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5791         incremental link.
5792         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5793         archives and object files elsewhere.
5794         (Add_symbols::run): Report object files here.
5795         (Finish_group::run): Report end of archive at end of group.
5796         * reloc.cc: Include layout.h, incremental.h.
5797         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5798         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5799         (Sized_relobj::incremental_relocs_scan): New function.
5800         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5801         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5802         (Sized_relobj::incremental_relocs_write): New function.
5803         (Sized_relobj::incremental_relocs_write_reltype): New function.
5804         * script.cc (read_input_script): Rewrite test for incremental link.
5805         Change call to Incremental_inputs::report_script.
5806         * symtab.h (Symbol_table::first_global_index): New function.
5807         (Symbol_table::output_count): New function.
5808
5809 2010-08-12  Doug Kwan  <dougkwan@google.com>
5810
5811         * arm.cc (Target_arm::merge_object_attributes): Check command line
5812         options --no-wchar-size-warning and --no-enum-size-warning.
5813         * options.h (General_options): Add ld-compatible options
5814         --no-enum-size-warning and --no-wchar-size-warning.
5815
5816 2010-08-04  Ian Lance Taylor  <iant@google.com>
5817
5818         * x86_64.cc (Target_x86_64::Scan::local): Use
5819         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5820         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5821         (Target_x86_64::Scan::global): Likewise.
5822         (Target_x86_64::Relocate::relocate): Likewise.
5823         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5824         Likewise.
5825
5826 2010-08-03  Cary Coutant  <ccoutant@google.com>
5827
5828         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5829         to reserve space in merged_strings vector. Keep total input size
5830         for stats.
5831         (Output_merge_string::do_print_merge_stats): Print total input size.
5832         * merge.h (Output_merge_string): Add input_size_ field.
5833         * stringpool.cc (Stringpool_template::string_length): Move
5834         implementations out of Stringpool_template class and place in
5835         stringpool.h.
5836         * stringpool.h (string_length): Move out of Stringpool_template.
5837
5838 2010-08-03  Ian Lance Taylor  <iant@google.com>
5839
5840         PR 11712
5841         * layout.cc (relaxation_loop_body): If address of load segment is
5842         set, adjust address to include headers if possible.
5843
5844 2010-08-03  Ian Lance Taylor  <iant@google.com>
5845
5846         * version.cc (version_string): Bump to 1.10.
5847
5848 2010-08-03  Ian Lance Taylor  <iant@google.com>
5849
5850         PR 11805
5851         * layout.h (enum Output_section_order): Define.
5852         (class Layout): Update declarations.
5853         * layout.cc (Layout::get_output_section): Add order parameter.
5854         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5855         is_first_non_relro parameters.  Change all callers.
5856         (Layout::choose_output_section): Likewise.
5857         (Layout::add_output_section_data): Likewise.
5858         (Layout::make_output_section): Likewise.  Set order.
5859         (Layout::default_section_order): New function.
5860         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5861         * output.cc (Output_section::Output_section): Initialize order_.
5862         Don't initialize deleted fields.
5863         (Output_segment::Output_segment): Don't initialize deleted
5864         fields.
5865         (Output_segment::add_output_section_to_load): New function
5866         replacing add_output_section.  Change all callers to call this or
5867         add_output_section_to_nonload.
5868         (Output_segment::add_output_section_to_nonload): New function.
5869         (Output_segment::remove_output_section): Rewrite.
5870         (Output_segment::add_initial_output_data): Likewise.
5871         (Output_segment::has_any_data_sections): Likewise.
5872         (Output_segment::is_first_section_relro): Likewise.
5873         (Output_segment::maximum_alignment): Likewise.
5874         (Output_segment::has_dynamic_reloc): New function replacing
5875         dynamic_reloc_count.  Change all callers.
5876         (Output_segment::has_dynamic_reloc_list): New function replacing
5877         dynamic_reloc_count_list.  Change all callers.
5878         (Output_segment::set_section_addresses): Rewrite.
5879         (Output_segment::set_offset): Rewrite.
5880         (Output_segment::find_first_and_last_list): Remove.
5881         (Output_segment::set_tls_offsets): Rewrite.
5882         (Output_segment::first_section_load_address): Likewise.
5883         (Output_segment::output_section_count): Likewise.
5884         (Output_segment::section_with_lowest_load_address): Likewise.
5885         (Output_segment::write_section_headers): Likewise.
5886         (Output_segment::print_sections_to_map): Likewise.
5887         * output.h (class Output_data): Remove dynamic_reloc_count_
5888         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5889         (Output_data::add_dynamic_reloc): Rewrite.
5890         (Output_data::has_dynamic_reloc): New function.
5891         (Output_data::dynamic_reloc_count): Remove.
5892         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5893         is_last_relro_, is_first_non_relro_, is_interp_,
5894         is_dynamic_linker_section_ fields.  Add order and set_order
5895         functions.  Remove is_relro_local, set_is_relro_local,
5896         is_last_relro, set_is_last_relro, is_first_non_relro,
5897         set_is_first_non_relro functions, is_interp, set_is_interp,
5898         is_dynamic_linker_section, and set_is_dynamic_linker_section
5899         functions.
5900         (class Output_segment): Change Output_data_list from std::list to
5901         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5902         output_bss_ fields.  Update declarations.
5903
5904 2010-08-02  Ian Lance Taylor  <iant@google.com>
5905
5906         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5907         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5908         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5909
5910 2010-08-02  Ian Lance Taylor  <iant@google.com>
5911
5912         PR 11855
5913         * script.cc (Script_options::Script_options): Initialize
5914         symbol_definitions_ and symbol_references_.
5915         (Script_options::add_symbol_assignment): Update
5916         symbol_definitions_ and symbol_references_.
5917         (Script_options::add_symbol_reference): New function.
5918         (script_symbol): New function.
5919         * script.h (class Script_options): Add symbol_definitions_ and
5920         symbol_references_ fields.
5921         (Script_options::referenced_const_iterator): New type.
5922         (Script_options::referenced_begin): New function.
5923         (Script_options::referenced_end): New function.
5924         (Script_options::is_referenced): New function.
5925         (Script_options::any_unreferenced): New function.
5926         * script-c.h (script_symbol): Declare.
5927         * yyscript.y (exp): Call script_symbol.
5928         * symtab.cc: Include "script.h".
5929         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5930         Change all callers.  Check symbols referenced by scripts.
5931         (Symbol_table::add_undefined_symbols_from_command_line): Add
5932         layout parameter.  Change all callers.
5933         (Symbol_table::do_add_undefined_symbols_from_command_line):
5934         Likewise.  Break out loop body.  Check symbols referenced by
5935         scripts.
5936         (Symbol_table::add_undefined_symbol_from_command_line): New
5937         function broken out of
5938         do_add_undefined_symbols_from_command_line.
5939         * symtab.h (class Symbol_table): Update declarations.
5940         * archive.cc: Include "layout.h".
5941         (Archive::should_include_member): Add layout parameter.  Change
5942         all callers.  Check for symbol mentioned in expression.
5943         * archive.h (class Archive): Update declaration.
5944         * object.cc (Sized_relobj::do_should_include_member): Add layout
5945         parameter.
5946         * object.h (Object::should_include_member): Add layout parameter.
5947         Change all callers.
5948         (Object::do_should_include_member): Add layout parameter.
5949         (class Sized_relobj): Update declaration.
5950         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5951         parameter.
5952         * dynobj.h (class Sized_dynobj): Update declaration.
5953         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5954         layout parameter.
5955         * plugin.h (class Sized_pluginobj): Update declaration.
5956
5957 2010-08-02  Ian Lance Taylor  <iant@google.com>
5958
5959         PR 11866
5960         * output.cc (Output_segment::set_offset): Search for the first and
5961         last sections rather than assuming that the list is in order.
5962         (Output_segment::find_first_and_last_list): New function.
5963         * output.h (class Output_segment): Update declarations.
5964         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5965         (relro_strip_test_SOURCES): New variable.
5966         (relro_strip_test_DEPENDENCIES): New variable.
5967         (relro_strip_test_LDFLAGS): New variable.
5968         (relro_strip_test_LDADD): New variable.
5969         (relro_strip_test.so): New target.
5970
5971 2010-08-02  Ian Lance Taylor  <iant@google.com>
5972
5973         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5974         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5975         (Target_i386::got_tlsdesc_section): New function.
5976         (Target_i386::got_section): Create space for GOT entries for
5977         TLSDESC relocations.
5978         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5979         R_386_TLS_GOTDESC.
5980         (Target_i386::Scan::global): Likewise.
5981         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5982         using TLSDESC GOT.
5983         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5984         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5985         (Target_x86_64::got_tlsdesc_section): New function.
5986         (Target_x86_64::got_section): Create space for GOT entries for
5987         TLSDESC relocations.
5988         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5989         R_386_TLS_GOTDESC.
5990         (Target_x86_64::Scan::global): Likewise.
5991         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5992         using TLSDESC GOT.
5993
5994 2010-08-02  Ian Lance Taylor  <iant@google.com>
5995
5996         * testsuite/final_layout.sh: Use dc to convert from hex to
5997         decimal.
5998
5999 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6000
6001         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6002         paramter to the call to gold::gc_process_relocs.
6003         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6004         paramter to the call to gold::gc_process_relocs.
6005         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6006         parameter to the call to gold::gc_process_relocs.
6007         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6008         template parameter to the call to gold::gc_process_relocs.
6009         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6010         paramter to the call to gold::gc_process_relocs.
6011         * gc.h (get_embedded_addend_size): New function.
6012         (gc_process_relocs): Save the size of the reloc for use by ICF.
6013         * icf.cc (get_section_contents): Get the addend from the text section
6014         for SHT_REL relocation sections.
6015         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6016         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6017         * int_encoding.h (read_from_pointer): New overloaded function.
6018         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6019         * testsuite/icf_sht_rel_addend_test.sh: New file.
6020         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6021         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6022
6023 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6024
6025         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6026         * Makefile.in: Regenerate.
6027         * testsuite/Makefile.in: Regenerate.
6028
6029 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6030
6031         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6032         * gold/testsuite/debug_msg.cc: Likewise.
6033         * gold/testsuite/odr_violation1.cc
6034         * gold/testsuite/odr_violation2.cc
6035
6036 2010-07-21  Cary Coutant  <ccoutant@google.com>
6037
6038         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6039         string, and length fields.
6040         (Output_merge_string::Merged_strings_list): New type.
6041         (Output_merge_string::Merged_strings_lists): New typedef.
6042         (Output_merge_string): Replace merged_strings_ with
6043         merged_strings_lists_.
6044         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6045         Merged_strings_list per input object and section.  Don't store pointer
6046         to the string.  Don't store length with each merged string entry.
6047         (Output_merge_string::finalize_merged_data): Loop over list of merged
6048         strings lists.  Recompute length of each merged string.
6049
6050 2010-07-15  Cary Coutant  <ccoutant@google.com>
6051
6052         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6053         here.
6054
6055 2010-07-14  Ian Lance Taylor  <iant@google.com>
6056
6057         * descriptors.cc (Descriptors::open): Report correct name in error
6058         message.
6059
6060 2010-07-13  Doug Kwan  <dougkwan@google.com>
6061
6062         * arm.cc (Arm_input_section::Arm_input_section): For a
6063         SHT_ARM_EXIDX section, always keeps the input sections.
6064         (Arm_input_section::set_exidx_section_link): New method.
6065         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6066         has_errors_ to false.
6067         (Arm_exidx_input_section::has_errors,
6068         Arm_exidx_input_section::set_has_errors): New methods.
6069         (Arm_exidx_input_section::has_errors_): New data member.
6070         (Arm_relobj::get_exidx_shndx_list): New method.
6071         (Arm_output_section::append_text_sections_to_list): Do not skip
6072         section without SHF_EXECINSTR.
6073         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6074         errors.
6075         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6076         section header.  Make error messages more verbose.  Check for
6077         a non-executable section linked to an EXIDX section.
6078         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6079         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6080         check that there is no deferred EXIDX section if we exit early.
6081         Instead of not making an EXIDX section in case of an error, make one
6082         and set the has_errors flag of it.
6083         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6084         in a relocatable link.
6085         (Target_arm::do_relax): Look for the EXIDX output section instead of
6086         assuming that it is called .ARM.exidx.
6087         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6088         section list.  Do not check for SHF_EXECINSTR section flags but
6089         skip any input section with errors.
6090         * output.cc (Output_section::Output_section): Initialize
6091         always_keeps_input_sections_ to false.
6092         (Output_section::add_input_section): Check for
6093         always_keeps_input_sections_.
6094         *  output.h (Output_section::always_keeps_input_sections,
6095         Output_section::set_always_keeps_input_sections): New methods.
6096         (Output_section::always_keeps_input_sections): New data member.
6097
6098 2010-07-13  Rafael Espindola  <espindola@google.com>
6099
6100         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6101         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6102
6103 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6104             Ian Lance Taylor  <iant@google.com>
6105
6106         * output.h (Output_section_lookup_maps::add_merge_section):
6107         Correct check of whether value was inserted.
6108         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6109         (Output_section_lookup_maps::add_relaxed_input_section):
6110         Likewise.
6111         * arm.cc (Target_arm::got_section): Remove used local os.
6112         * i386.cc (Target_i386::got_section): Likewise.
6113         * x86_64.cc (Target_x86_64::got_section): Likewise.
6114         * sparc.cc (Target_sparc::got_section): Likewise.
6115         (Target_sparc::relocate): Remove unused local have_got_offset.
6116         * powerpc.cc (Target_powerpc::relocate): Likewise.
6117
6118 2010-07-13  Ian Lance Taylor  <iant@google.com>
6119
6120         * compressed_output.cc (zlib_decompress): Fix signature in
6121         !HAVE_ZLIB_H case.
6122
6123         * archive.cc (Archive::include_member): Unlock an external member
6124         of a thin archive.  Don't bother to delete an object we know is
6125         NULL.
6126
6127 2010-07-12  Cary Coutant  <ccoutant@google.com>
6128
6129         * compressed_output.cc (zlib_decompress): New function.
6130         (get_uncompressed_size): New function.
6131         (decompress_input_section): New function.
6132         * compressed_output.h (get_uncompressed_size): New function.
6133         (decompress_input_section): New function.
6134         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6135         Handle compressed debug sections.
6136         * layout.cc (is_compressed_debug_section): New function.
6137         (Layout::output_section_name): Map compressed section names to
6138         canonical names.
6139         * layout.h (is_compressed_debug_section): New function.
6140         (is_debug_info_section): Recognize compressed debug sections.
6141         * merge.cc: Include compressed_output.h.
6142         (Output_merge_data::do_add_input_section): Handle compressed
6143         debug sections.
6144         (Output_merge_string::do_add_input_section): Handle compressed
6145         debug sections.
6146         * object.cc: Include compressed_output.h.
6147         (Sized_relobj::Sized_relobj): Initialize new data members.
6148         (build_compressed_section_map): New function.
6149         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6150         * object.h (Object::section_is_compressed): New method.
6151         (Object::do_section_is_compressed): New method.
6152         (Sized_relobj::Compressed_section_map): New type.
6153         (Sized_relobj::do_section_is_compressed): New method.
6154         (Sized_relobj::compressed_sections_): New data member.
6155         * output.cc (Output_section::add_input_section): Handle compressed
6156         debug sections.
6157         * reloc.cc: Include compressed_output.h.
6158         (Sized_relobj::write_sections): Handle compressed debug sections.
6159
6160 2010-07-08  Cary Coutant  <ccoutant@google.com>
6161
6162         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6163         weak when resolving to a dynamic def.
6164         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6165         for weak undef/dynamic def cases. Adjust callers.
6166         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6167         undef_binding_weak_.
6168         (Symbol_table::sized_write_globals): Adjust symbol binding.
6169         (Symbol_table::sized_write_symbol): Add binding parameter.
6170         * symtab.h (Symbol::set_undef_binding): New method.
6171         (Symbol::is_undef_binding_weak): New method.
6172         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6173         (Symbol_table::should_override): Add new parameter.
6174         (Symbol_table::sized_write_symbol): Add new parameter.
6175
6176         * testsuite/weak_undef_file1.cc: Add new test case.
6177         * testsuite/weak_undef_file2.cc: Fix header comment.
6178         * testsuite/weak_undef_test.cc: Add new test case.
6179
6180 2010-06-29  Doug Kwan  <dougkwan@google.com>
6181
6182         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6183         Initialize USE_SYMBOL_.
6184         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6185         definition.
6186         (Arm_reloc_property::uses_symbol_): New data member declaration.
6187         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6188         uses symbol value and symbol is undefined but not weakly undefined.
6189
6190 2010-06-28  Rafael Espindola  <espindola@google.com>
6191
6192         * plugin.cc (Plugin::load): Use dlerror.
6193
6194 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6195
6196         * symtab.cc (detect_odr_violations): When reporting an ODR
6197         violation, report an object where the symbol is defined.
6198
6199 2010-06-25  Doug Kwan  <dougkwan@google.com>
6200
6201         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6202         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6203         definition.
6204         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6205         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6206         target hook to detect function points.
6207         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6208         * icf.h (Icf::check_section_for_function_pointers): Change type of
6209         parameter SECTION_NAME to const reference to std::string.  Use
6210         target hook to determine if section may have unsafe pointers.
6211         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6212         method definition.
6213
6214 2010-06-21  Rafael Espindola  <espindola@google.com>
6215
6216         * fileread.cc (Input_file::find_fie): New
6217         (Input_file::open): Use Input_file::find_fie.
6218         * fileread.h (Input_file::find_fie): New
6219         * plugin.cc (set_extra_library_path): New.
6220         (Plugin::load): Add set_extra_library_path to the transfer vector.
6221         (Plugin_manager::set_extra_library_path): New.
6222         (Plugin_manager::add_input_file): Use the extra search path if set.
6223         (set_extra_library_path(): New.
6224         * plugin.h (Plugin_manager): Add set_extra_library_path and
6225         extra_search_path_.
6226
6227 2010-06-19  Cary Coutant  <ccoutant@google.com>
6228
6229         * layout.cc (gdb_sections): Add .debug_types.
6230         (lines_only_debug_sections): Likewise.
6231
6232 2010-06-18  Rafael Espindola  <espindola@google.com>
6233
6234         * plugin.cc (add_input_file,add_input_library)
6235         (Plugin_manager::add_input_file): Make filename arguments const.
6236         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6237         const.
6238
6239 2010-06-16  Doug Kwan  <dougkwan@google.com>
6240
6241         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6242         .ARM.attributes section if we have not merged any input
6243         attributes sections.
6244
6245 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6246
6247         * arm.cc: Allow combining objects with no EABI version
6248         information.
6249
6250 2010-06-15  Rafael Espindola  <espindola@google.com>
6251
6252         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6253
6254 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6255
6256         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6257         (struct iovec): Correct !HAVE_READV definition.
6258
6259 2010-06-10  Cary Coutant  <ccoutant@google.com>
6260
6261         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6262         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6263         reloc sections.
6264         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6265
6266         PR 11683
6267         * symtab.h (Symbol::is_placeholder): New member function.
6268         * target-reloc.h (relocate_section): Check for placeholder symbols.
6269
6270         * testsuite/Makefile.am (plugin_test_8): New test.
6271         (plugin_test_9): New test.
6272         * testsuite/Makefile.in: Regenerate.
6273
6274 2010-06-09  Nick Clifton  <nickc@redhat.com>
6275
6276         * yyscript.y (input_list_element): Allow strings prefixed with
6277         the '-' character.  Treat these as libraries.
6278         * script.cc (script_add_library): New function.  Adds a library
6279         specified by "-l<name>" found in an input script.
6280         * script-c.h: Add prototype for script_add_library.
6281
6282 2010-06-07  Doug Kwan  <dougkwan@google.com>
6283
6284         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6285         Restrict stub-group size to be within long conditional branch
6286         range when working around cortex-A8 erratum.
6287
6288 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6289
6290         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6291         #ifdef typo.
6292
6293 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6294
6295         PR gold/11658
6296         * output.cc
6297         (Output_section::Input_section_sort_entry::compare_section_ordering):
6298         Change to return non-zero correctly.
6299         (Output_section::Input_section_sort_section_order_index_compare
6300         ::operator()): Change to fix ambiguity in comparisons.
6301
6302 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6303
6304         * gold.h (is_wildcard_string): New function.
6305         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6306         (Layout::layout_eh_frame): Ditto.
6307         (Layout::find_section_order_index): New method.
6308         (Layout::read_layout_from_file): New method.
6309         * layout.h (Layout::find_section_order_index): New method.
6310         (Layout::read_layout_from_file): New method.
6311         (Layout::input_section_position_): New private member.
6312         (Layout::input_section_glob_): New private member.
6313         * main.cc (main): Call read_layout_from_file here.
6314         * options.h (--section-ordering-file): New option.
6315         * output.cc (Output_section::input_section_order_specified_): New
6316         member.
6317         (Output_section::Output_section): Initialize new member.
6318         (Output_section::add_input_section): Add new parameter.
6319         Keep input sections when --section-ordering-file is used.
6320         (Output_section::set_final_data_size): Sort input sections when
6321         section ordering file is specified.
6322         (Output_section::Input_section_sort_entry): Add new parameter.
6323         Check sorting type.
6324         (Output_section::Input_section_sort_entry::compare_section_ordering):
6325         New method.
6326         (Output_section::Input_section_sort_compare::operator()): Change to
6327         consider section_order_index.
6328         (Output_section::Input_section_sort_init_fini_compare::operator()):
6329         Change to consider section_order_index.
6330         (Output_section::Input_section_sort_section_order_index_compare
6331         ::operator()): New method.
6332         (Output_section::sort_attached_input_sections): Change to sort
6333         according to section order when specified.
6334         (Output_section::add_input_section<32, true>): Add new parameter.
6335         (Output_section::add_input_section<64, true>): Add new parameter.
6336         (Output_section::add_input_section<32, false>): Add new parameter.
6337         (Output_section::add_input_section<64, false>): Add new parameter.
6338         * output.h (Output_section::add_input_section): Add new parameter.
6339         (Output_section::input_section_order_specified): New
6340         method.
6341         (Output_section::set_input_section_order_specified): New method.
6342         (Input_section::Input_section): Initialize section_order_index_.
6343         (Input_section::section_order_index): New method.
6344         (Input_section::set_section_order_index): New method.
6345         (Input_section::section_order_index_): New member.
6346         (Input_section::Input_section_sort_section_order_index_compare): New
6347         struct.
6348         (Output_section::input_section_order_specified_): New member.
6349         * script-sections.cc (is_wildcard_string): Delete and move modified
6350         method to gold.h.
6351         (Output_section_element_input::Output_section_element_input): Modify
6352         call to is_wildcard_string.
6353         (Output_section_element_input::Input_section_pattern
6354         ::Input_section_pattern): Ditto.
6355         (Output_section_element_input::Output_section_element_input): Ditto.
6356         * testsuite/Makefile.am (final_layout): New test case.
6357         * testsuite/Makefile.in: Regenerate.
6358         * testsuite/final_layout.cc: New file.
6359         * testsuite/final_layout.sh: New file.
6360
6361 2010-06-01  Rafael Espindola  <espindola@google.com>
6362
6363         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6364
6365 2010-06-01  Rafael Espindola  <espindola@google.com>
6366
6367         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6368         visibility of symbols.
6369
6370 2010-05-27  Doug Kwan  <dougkwan@google.com>
6371
6372         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6373         from start of output section instead of address for a local symbol
6374         in a merged or relaxed section when doing a relocatable link.
6375
6376 2010-05-26  Rafael Espindola  <espindola@google.com>
6377
6378         PR 11604
6379         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6380         adding sections the garbage collector removed.
6381         * gold/testsuite/Makefile.am: Add test.
6382         * gold/testsuite/Makefile.in: Regenerate.
6383         * gold/testsuite/plugin_test_7.sh: New.
6384         * gold/testsuite/plugin_test_7_1.c: New.
6385         * gold/testsuite/plugin_test_7_2.c: New.
6386
6387 2010-05-26  Rafael Espindola  <espindola@google.com>
6388
6389         * script-sections.cc (Output_section_definition::set_section_addresses):
6390         Check for --section-start.
6391
6392 2010-05-26  Doug Kwan  <dougkwan@google.com>
6393
6394         * arm.cc (Arm_scan_relocatable_relocs): New class.
6395         (Target_arm::relocate_special_relocatable): New method.
6396         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6397         (Arm_relocate_functions::thumb_branch_common): Same.
6398         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6399         instead of Default_scan_relocatable_relocs.
6400         * target-reloc.h (relocate_for_relocatable): Let target handle
6401         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6402         * target.h (Sized_target::relocate_special_relocatable): New method.
6403
6404 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6405
6406         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6407
6408 2010-05-23  Doug Kwan  <dougkwan@google.com>
6409
6410         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6411         instead of a cast.
6412         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6413         with a direct branch, not a conditional branch, to a stub.
6414         * merge.cc (Output_merge_base::record_input_section): New method
6415         defintion.
6416         (Output_merge_data::do_add_input_section): Record input section if
6417         keeps-input-sections flag is set.
6418         (Output_merge_string::do_add_input_section): Ditto.
6419         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6420         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6421         INPUT_SECTIONS_.
6422         (Output_merge_base::keeps_input_sections,
6423         Output_merge_base::set_keeps_input_sections,
6424         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6425         method definitions.
6426         (Output_merge_base::Input_sections): New type declaration.
6427         (Output_merge_base::input_sections_begin,
6428         Output_merge_base::input_sections_end,
6429         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6430         (Output_merge_base::bool keeps_input_sections_,
6431         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6432         Output_merge_base::input_sections_): New data members.
6433         (Output_merge_data::do_set_keeps_input_sections): New method
6434         defintion.
6435         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6436         * output.cc (Output_section::Input_section::relobj): Move method
6437         defintion from class declaration to here and handle merge sections.
6438         (Output_section::Input_section::shndx): Ditto.
6439         (Output_section::Output_section): Remove initializations of removed
6440         data members and initialize new data member LOOKUP_MAPS_.
6441         (Output_section::add_input_section): Set keeps-input-sections flag
6442         for a newly created merge output section as appropriate.  Adjust code
6443         to use Output_section_lookup_maps class.
6444         (Output_section::add_relaxed_input_section): Adjst code for lookup
6445         maps code refactoring.
6446         (Output_section::add_merge_input_section): Add a new parameter
6447         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6448         class.  If adding input section to a newly created merge output
6449         section fails, remove the new merge section.
6450         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6451         Adjust code for use of the Output_section_lookup_maps class.
6452         (Output_section::find_merge_section): Ditto.
6453         (Output_section::build_lookup_maps): New method defintion.
6454         (Output_section::find_relaxed_input_section): Adjust code to use
6455         Output_section_lookup_maps class.
6456         (Output_section::get_input_sections): Export merge sections.  Adjust
6457         code to use Output_section_lookup_maps class.
6458         (Output_section:::add_script_input_section): Adjust code to use
6459         Output_section_lookup_maps class.  Update lookup maps for merge
6460         sections also.
6461         (Output_section::discard_states): Use Output_section_lookup_maps.
6462         (Output_section::restore_states): Same.
6463         * output.h (Merge_section_properties): Move class defintion out of
6464         Output_section.
6465         (Output_section_lookup_maps): New class.
6466         (Output_section::Input_section::is_merge_section): New method
6467         defintion.
6468         (Output_section::Input_section::relobj): Move defintion out of class
6469         defintion.  Declare method only.
6470         (Output_section::Input_section::shndx): Ditto.
6471         (Output_section::Input_section::output_merge_base): New method defintion.
6472         (Output_section::Input_section::u2_.pomb): New union field.
6473         (Output_section::Merge_section_by_properties_map,
6474         Output_section::Output_section_data_by_input_section_map,
6475         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6476         Remove types.
6477         (Output_section::add_merge_input_section): Add new parameter
6478         KEEPS_INPUT_SECTIONS.
6479         (Output_section::build_lookup_maps): New method declaration.
6480         (Output_section::merge_section_map_,
6481         Output_section::merge_section_by_properties_map_,
6482         Output_section::relaxed_input_section_map_,
6483         Output_section::is_relaxed_input_section_map_valid_): Remove data
6484         members.
6485         (Output_section::lookup_maps_): New data member.
6486
6487 2010-05-21  Doug Kwan  <dougkwan@google.com>
6488
6489         PR gold/11619
6490         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6491         avoid a compilation error.
6492
6493 2010-05-19  Rafael Espindola  <espindola@google.com>
6494
6495         * script-sections.cc (Output_section_definition::allocate_to_segment):
6496         Update the phdrs_list even when the output section is NULL.
6497         * testsuite/Makefile.am: Add test.
6498         * testsuite/Makefile.in: Regenerate.
6499         * testsuite/script_test_9.cc: New.
6500         * testsuite/script_test_9.sh: New.
6501         * testsuite/script_test_9.t: New.
6502
6503 2010-05-19  Doug Kwan  <dougkwan@google.com>
6504
6505         * arm.cc (Arm_input_section::original_size): New method.
6506         (Arm_input_section::do_addralign): Add a cast.
6507         (Arm_input_section::do_output_offset): Remove static cast.
6508         (Arm_input_section::original_addralign,
6509          Arm_input_section::original_size_): Change type to uint32_t.
6510         (Arm_input_section::init): Add safe casts for section alignment
6511         and size.
6512         (Arm_input_section::set_final_data_size): Do not set address and
6513         offset of stub table.
6514         (Arm_output_section::fix_exidx_coverage): Change use of of
6515         Output_section::Simple_input_section to that of
6516         Output_section::Input_section.
6517         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6518         except for the first pass.
6519         * output.cc (Output_section::get_input_sections): Change type of
6520         input_sections to std::list<Input_section>.
6521         (Output_section::add_script_input_section): Rename from
6522         Output_section::add_simple_input_section.  Change type of SIS
6523         parameter from Simple_input_section to Input_section.
6524         * output.h (Output_section::Simple_input_section): Remove class.
6525         (Output_section::Input_section): Change class visibility to public.
6526         (Output_section::Input_section::addralign): Use stored alignments
6527         for special input sections if set.
6528         (Output_section::Input_section::set_addralign): New method.
6529         (Output_section::get_input_sections): Change parameter type from
6530         list of Simple_input_section to list of Input_section.
6531         (Output_section::add_script_input_section): Rename from
6532         Output_section::add_simple_input_section. Change first parameter's
6533         type from Simple_input_section to Input_section and remove the
6534         second and third parameters.
6535         * script-sections.cc (Input_section::Input_section_list): Change
6536         type to list of Output_section::Input_section/
6537         (Input_section_info::Input_section_info): Change parameter type of
6538         INPUT_SECTION to Output_section::Input_section.
6539         (Input_section_info::input_section): Change return type.
6540         (Input_section_info::input_section_): Change type to
6541         Output_section::Input_section.
6542         (Output_section_element_input::set_section_addresses): Adjust code
6543         to use Output_section::Input_section instead of
6544         Output_section::Simple_input_section.  Adjust code for renaming
6545         of Output_section::add_simple_input_section.
6546         (Orphan_output_section::set_section_addresses): Ditto.
6547
6548 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6549
6550         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6551         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6552
6553 2010-05-18  Rafael Espindola  <espindola@google.com>
6554
6555         * options.cc (General_options::finalize): Handle -nostdlib.
6556         * options.h (nostdlib): New option.
6557         * script.cc (script_add_search_dir): Handle -nostdlib.
6558
6559 2010-05-12  Doug Kwan  <dougkwan@google.com>
6560
6561         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6562         attributes section only if there no attributes section after merging.
6563         (Target_arm::merge_object_attributes): Move value of
6564         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6565         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6566         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6567         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6568         and arm_attr_merge_7.stdout.
6569         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6570         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6571         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6572         arm_attr_merge_7b.o): New rules.
6573         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6574         arm_attr_merge_7
6575         * testsuite/Makefile.in: Regenerate.
6576         * testsuite/arm_attr_merge.sh: New file.
6577         * testsuite/arm_attr_merge_[67][ab].s: Same.
6578
6579 2010-05-05  Nick Clifton  <nickc@redhat.com>
6580
6581         * po/es.po: Updated Spanish translation.
6582
6583 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6584
6585         * Makefile.am (install-exec-local): Properly install gold as
6586         default cross linker.
6587         * Makefile.in: Regenerated.
6588
6589 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6590             Nick Clifton  <nickc@redhat.com>
6591
6592         * configure.ac (install_as_default): Define and set to false
6593         unless --enable-gold or --enable-gold=both/gold has been
6594         specified.
6595         * configure: Regenerate.
6596
6597         * Makefile.am (install-exec-local): Install the executable as
6598         'ld.gold'.  If install_as_default is true then also install it as
6599         'ld'.
6600         * Makefile.in: Regenerated.
6601
6602 2010-04-24  Ian Lance Taylor  <iant@google.com>
6603
6604         * layout.cc (Layout::layout_reloc): In relocatable link don't
6605         combine reloc sections for grouped sections.
6606
6607 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6608
6609         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6610         sections that are not ordinary to icf.
6611         * icf.cc (get_section_contents): Handle relocation pointing to section
6612         with no object or shndx information.
6613         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6614         * testsuite/Makefile.in: Regenerate.
6615         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6616         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6617
6618 2010-04-22  Ian Lance Taylor  <iant@google.com>
6619
6620         * expression.cc (Expression::Expression_eval_info): Add
6621         result_alignment_pointer field.
6622         (Expression::eval_with_dot): Add result_alignment_pointer
6623         parameter.  Change all callers.
6624         (Expression::eval_maybe_dot): Likewise.
6625         (class Binary_expression): Add alignment_pointer parameter to
6626         left_value and right_value.  Change all callers.
6627         (BINARY_EXPRESSION): Set result alignment.
6628         (class Trinary_expression): Add alignment_pointer parameter to
6629         arg2_value and arg3_value.  Change all callers.
6630         (Trinary_cond::value): Set result alignment.
6631         (Max_expression::value, Min_expression::value): Likewise.
6632         (Align_expression::value): Likewise.
6633         * script-sections.cc (class Sections_element): Add dot_alignment
6634         parameter to set_section_addresses virtual function.  Update
6635         instantiations.
6636         (class Output_section_element): Likewise.
6637         (Script_sections::create_segments): Add dot_alignment parameter.
6638         Change all callers.
6639         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6640         (Script_sections::set_phdrs_clause_addresses): Likewise.
6641         * script-sections.h: Update declarations.
6642         * script.h: Update declarations.
6643         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6644         min_p_align.
6645         * testsuite/script_test_3.t: Set large alignment.
6646         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6647         segment has expected alignment.
6648
6649 2010-04-22  Nick Clifton  <nickc@redhat.com>
6650
6651         * po/gold.pot: Updated by the Translation project.
6652         * po/vi.po: Updated Vietnamese translation.
6653
6654 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6655
6656         * testsuite/Makefile.am (check_PROGRAMS): Add
6657         icf_virtual_function_folding_test.
6658         * testsuite/Makefile.in: Regenerated.
6659
6660 2010-04-15  Andrew Haley  <aph@redhat.com>
6661
6662         * options.h (merge_exidx_entries): New option.
6663         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6664         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6665         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6666         (Target_arm::merge_exidx_entries): New function.
6667         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6668         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6669         to Arm_exidx_fixup constructor.
6670         Add new arg, merge_exidx_entries.
6671         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6672         Arm_output_section::fix_exidx_coverage.
6673
6674 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6675
6676         * icf.cc (get_section_contents): Check for preemptible functions.
6677         Ignore addend when appropriate.
6678         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6679         section folded.
6680         (add_from_relobj): Check for section folded.
6681         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6682         * symtab.h (should_add_dynsym_entry): Add new parameter.
6683         * target-reloc.h (scan_relocs): Check for section folded.
6684         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6685         Check reloc types for function pointers in shared objects.
6686         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6687         case.
6688         (icf_preemptible_functions_test): New test case.
6689         (icf_string_merge_test): New test case.
6690         * testsuite.Makefile.in: Regenerate.
6691         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6692         bar_glob.  Refactor code.
6693         * testsuite/icf_preemptible_functions_test.cc: New file.
6694         * testsuite/icf_preemptible_functions_test.sh: New file.
6695         * testsuite/icf_string_merge_test.cc: New file.
6696         * testsuite/icf_string_merge_test.sh: New file.
6697         * testsuite/icf_virtual_function_folding_test.cc: New file.
6698         * testsuite/icf_virtual_function_folding_test.sh: New file.
6699
6700 2010-04-14  Doug Kwan  <dougkwan@google.com>
6701
6702         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6703         for local symbol recounting if we remove a section due to ICF.
6704         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6705         there are no regular objects in input.
6706
6707 2010-04-13  Doug Kwan  <dougkwan@google.com>
6708
6709         * arm.cc (Arm_input_section::set_final_data_size): Compute
6710         accurate final data size instead of using current data size.
6711
6712 2010-04-09  Doug Kwan  <dougkwan@google.com>
6713
6714         * layout.cc (Layout::choose_output_section): Handle script section
6715         types.
6716         (Layout::make_output_section_for_script): Add section type parameter.
6717         Handle script section types.
6718         * layout.h (Layout::make_output_section_for_script): Add section
6719         type parameter.
6720         * output.cc (Output_section::Output_section): Initialize data member
6721         is_noload_.
6722         (Output_section::do_reset_address_and_file_offset): Do not set address
6723         to 0 if section is a NOLOAD section.
6724         * output.h (Output_section::is_noload): New method.
6725         (Output_section::set_is_noload): Ditto.
6726         (Output_section::is_noload_): New data member.
6727         * script-c.h (Script_section_type): New enum type.
6728         (struct Parser_output_section_header): Add new file section_type.
6729         * script-sections.cc (Sections_element::output_section_name): Add
6730         parameter for returning script section type.
6731         (Output_section_definition::output_section_name): Ditto.
6732         (Output_section_definition::section_type)P; New method.
6733         (Output_section_definiton::script_section_type_name): Ditto.
6734         (Output_section_definition::script_section_type_): New data member.
6735         (Output_section_definition::Output_section_definition): Initialize
6736         data member Output_section_definition::script_section_type_.
6737         (Output_section_definition::create_sections): Pass script section type
6738         to Layout::make_output_section_for_script.
6739         (Output_section_definition::output_section_name): Return script
6740         section type to caller.
6741         (Output_section_definition::set_section_address): Do not advance
6742         dot value and load address if section type is NOLOAD.  Set address
6743         of NOLOAD sections regardless of section flags.
6744         (Output_section_definition::print): Print section type if it is
6745         not SCRIPT_SECTION_TYPE_NONE.
6746         (Output_section_definition::section_type): New method.
6747         (Output_section_definition::script_section_type_name): Ditto.
6748         (Script_sections::output_section_name): Add new parameter
6749         PSECTION_TYPE for returning script section type.  Pass it to
6750         section elements.  Handle discard sections.
6751         (Sort_output_sections::operator()): Handle NOLOAD sections.
6752         * script-sections.h (Script_sections::Section_type): New enum type.
6753         (Script_sections::output_section_name): Add a new parameter for
6754         returning script section type.
6755         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6756         INFO and NOLOAD.
6757         * yyscript.y (union): Add new field SECTION_TYPE.
6758         (COPY, DSECT, INFO, NOLOAD): New tokens.
6759         (opt_address_and_section_type): Change type to output_section_header.
6760         (section_type): New non-terminal
6761         (section_header): Handle section type.
6762         (opt_address_and_section_type): Return section type value.
6763
6764 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6765
6766         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6767         * testsuite/plugin_common_test_2.c (foo): Likewise.
6768
6769 2010-04-08  Doug Kwan  <dougkwan@google.com>
6770
6771         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6772         Output_merge_data.
6773         * output.cc (Output_section::add_merge_input_section): Simplify
6774         code and return status of Output_merge_base::add_input_section.
6775         Update merge section map only if Output_merge_base::add_input_section
6776         returns true.
6777
6778 2010-04-07  Doug Kwan  <dougkwan@google.com>
6779
6780         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6781         if section is marked as containing instructions but has no mapping
6782         symbols.
6783         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6784         correct section index.
6785         (Arm_relobj::find_linked_text_section): Ditto.
6786
6787 2010-04-07  Cary Coutant  <ccoutant@google.com>
6788
6789         * archive.cc (include_member): Destroy Read_symbols_data object before
6790         releasing file.
6791         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6792         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6793         (Read_symbols_data::~Read_symbols_data) New destructor.
6794         (Section_relocs::Section_relocs) New constructor.
6795         (Section_relocs::~Section_relocs) New destructor.
6796         (Read_relocs_data::Read_relocs_data) New constructor.
6797         (Read_relocs_data::~Read_relocs_data) New destructor.
6798         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6799         pointers to NULL after deleting.
6800
6801 2010-04-07  Doug Kwan  <dougkwan@google.com>
6802
6803         * arm.cc: Replace "endianity" with "endianness" in comments.
6804         (Arm_exidx_cantunwind): Ditto.
6805         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6806         (Arm_relobj::merge_flags_and_attributes): New method.
6807         (Arm_relobj::merge_flags_and_attributes_): New data member.
6808         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6809         (Arm_relobj::scan_sections_for_stubs): Ditto.
6810         (Arm_relobj::do_read_symbols): Check to see if we really want to
6811         merge processor-specific flags and attributes.  Exit early if
6812         an object is empty except for section names and the undefined symbol.
6813         (Target_arm::do_finalize_sections): Move check for ELF format to
6814         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6815         attributes from a regular object only when we have determined that
6816         it is aapropriate.  Do not create an .ARM.attributes section in
6817         output if there is no regular input object.
6818         (Target_arm::merge_processor_specific_flags): Check
6819         --warn-mismatch before printing any error.
6820         (Target_arm::merge_object_attributes): Ditto.
6821         * gold.cc (queue_middle_tasks): Handle the case in which there is
6822         no regular object in input.
6823         * options.cc (General_options::parse_EB): New method.
6824         (General_options::parse_EL): Same.
6825         (General_options::General_options): Initialize endianness_.
6826         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6827         New options.
6828         (General_options::Endianness): New enum.
6829         (General_options::endianness): New method.
6830         (General_options::endianness_): New data member.
6831         * parameters.cc (Parameters::set_options): Check target endianness.
6832         (Parameters::set_target_once): Ditto.
6833         (Parameters::check_target_endianness): New method.
6834         (parameters_force_valid_target): If either -EL or -EB is specified,
6835         use it to define endianness of default target.
6836         * parameters.h (Parameters::check_target_endianness): New method
6837         declaration.
6838         * target.h (class Target): Change "endianity" to "endianness"
6839         in comments.
6840
6841 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6842
6843         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6844         * configure: Regenerate.
6845         * Makefile.in: Regenerate.
6846         * testsuite/Makefile.in: Regenerate.
6847
6848 2010-04-06  Cary Coutant  <ccoutant@google.com>
6849
6850         gcc PR lto/42757
6851         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6852         prevailing definitions of common symbols.
6853         * testsuite/plugin_test_6.sh: New test case.
6854         * testsuite/plugin_common_test_1.c: New test case.
6855         * testsuite/plugin_common_test_2.c: New test case.
6856         * testsuite/Makefile.am (plugin_test_6): New test case.
6857         * testsuite/Makefile.in: Regenerate.
6858
6859 2010-04-06  Nick Clifton  <nickc@redhat.com>
6860
6861         * po/vi.po: New Vietnamese translation.
6862
6863 2010-03-30  Doug Kwan  <dougkwan@google.com>
6864
6865         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6866
6867 2010-03-25  Doug Kwan  <dougkwan@google.com>
6868
6869         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6870         to avoid a conversion warning on a 32-bit host.
6871
6872 2010-03-24  Ian Lance Taylor  <iant@google.com>
6873
6874         * testsuite/script_test_3.t: Add a TLS segment.
6875         * testsuite/Makefile.am (check_PROGRAMS): Add
6876         tls_phdrs_script_test.
6877         (tls_phdrs_script_test_SOURCES): Define.
6878         (tls_phdrs_script_test_DEPENDENCIES): Define.
6879         (tls_phdrs_script_test_LDFLAGS): Define.
6880         (tls_phdrs_script_test_LDADD): Define.
6881         * testsuite/Makefile.in: Rebuild.
6882
6883 2010-03-23  Cary Coutant  <ccoutant@google.com>
6884
6885         * fileread.cc (find_or_make_view): Fix comment.
6886
6887 2010-03-23  Ian Lance Taylor  <iant@google.com>
6888
6889         * script-sections.cc (class Orphan_section_placement): Define
6890         PLACE_TLS and PLACE_TLS_BSS.
6891         (Orphan_section_placement::Orphan_section_placement): Initialize
6892         new places.
6893         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6894         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6895         (tls_script_test_SOURCES): Define.
6896         (tls_script_test_DEPENDENCIES): Define.
6897         (tls_script_test_LDFLAGS): Define.
6898         (tls_script_test_LDADD): Define.
6899         * testsuite/Makefile.in: Rebuild.
6900
6901 2010-03-22  Doug Kwan  <dougkwan@google.com>
6902
6903         * arm.cc (Arm_relocate_functions::abs8,
6904         Arm_relocate_functions::abs16): Use correct check for overflow
6905         specified in the ARM ELF specs.
6906         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6907         target of a BLX instruction specially.
6908         (Reloc_stub::stub_type_for_reloc): Ditto.
6909         (Relocate::relocate): Use symbolic names instead of numeric relocation
6910         codes to report error.
6911         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6912         workaround.
6913         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6914         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6915         thumb2_blx_out_of_range.stdout
6916         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6917         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6918         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6919         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6920         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6921         thumb2_blx_in_range, thumb2_blx_in_range.o,
6922         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6923         thumb2_blx_out_of_range.o): New rules.
6924         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6925         thumb2_blx_in_range and thumb2_blx_out_of_range.
6926         * testsuite/Makefile.in: Regenerate.
6927         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6928         * testsuite/thumb_blx_in_range.s: New file.
6929         * testsuite/thumb_blx_out_of_range.s: New file.
6930
6931 2010-03-22  Rafael Espindola  <espindola@google.com>
6932
6933         * archive.cc (Should_include): Move to archive.h.
6934         (should_include_member): Make it a member of Archive.
6935         (Lib_group): New.
6936         (Add_lib_group_symbols): New.
6937         * archive.h: Include options.h.
6938         (Archive_member): Moved from Archive.
6939         (Should_include): Moved from archive.cc.
6940         (Lib_group): New.
6941         (Add_lib_group_symbols): New.
6942         * dynobj.cc (do_should_include_member): New.
6943         * dynobj.h (do_should_include_member): New.
6944         * gold.cc (queue_initial_tasks): Update call to queue.
6945         * main.cc (main): Print lib group stats.
6946         * object.cc (do_should_include_member): New.
6947         * object.h: Include archive.h.
6948         (Object::should_include_member): New.
6949         (Object::do_should_include_member): New.
6950         (Sized_relobj::do_should_include_member): New.
6951         * options.cc (General_options::parse_start_lib): New.
6952         (General_options::parse_end_lib): New.
6953         (Input_arguments::add_file): Handle lib groups.
6954         (Input_arguments::start_group): Check we are not in a lib.
6955         (Input_arguments::start_lib): New.
6956         (Input_arguments::end_lib): New.
6957         * options.h (General_options): Add start_lib and end_lib.
6958         (Input_argument::lib_): New.
6959         (Input_argument::lib): New.
6960         (Input_argument::is_lib): New.
6961         (Input_file_lib): New.
6962         (Input_arguments::in_lib_): New.
6963         (Input_arguments::in_lib): New.
6964         (Input_arguments::start_lib): New.
6965         (Input_arguments::end_lib_): New.
6966         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6967         in unused members as preempted.
6968         (Sized_pluginobj::do_should_include_member): New.
6969         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6970         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6971         return the blocker.
6972         (Read_symbols::do_whole_lib_group): New.
6973         (Read_symbols::do_lib_group): New.
6974         (Read_symbols::do_read_symbols): Handle lib groups.
6975         (Read_symbols::get_name): Handle lib groups.
6976         * readsyms.h (Read_symbols): Add an archive member pointer.
6977         (Read_symbols::do_whole_lib_group): New.
6978         (Read_symbols::do_lib_group): New.
6979         (Read_symbols::member_): New.
6980         * script.cc (read_input_script): Update call to queue_soon.
6981
6982 2010-03-19  Doug Kwan  <dougkwan@google.com>
6983
6984         * arm.cc (Stub_table::Stub_table): Initialize new data members
6985         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6986         (Stub_table::add_reloc_stub): Assign stub offset and update
6987         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6988         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6989         New data members.
6990         (Stub_table::update_data_size_and_addralign): Use
6991         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6992         instead of going over all reloc stubs.
6993         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6994         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6995         Stringpool_template::offset_ to size of Stringpool_char.
6996         (Stringpool_template::new_key_offset): Remove code to initialize
6997         Stringpool_template::offset_.
6998         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6999         Stringpool_template::offset_ to zero.
7000
7001 2010-03-15  Doug Kwan  <dougkwan@google.com>
7002
7003         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7004         offset_.
7005         (Stringpool_template::new_key_offset): New method.
7006         (Stringpool_template::add_string): Assign offsets when adding new
7007         strings.
7008         (Stringpool_template::set_string_offsets): Do not set string offsets
7009         when not optimizing.
7010         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7011         member size_.
7012         (Chunked_vector::clear): Clear size_.
7013         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7014         (Chunked_vector::size): Return size_.
7015         (Chunked_vector::push_back): Use size_ to find insert position.
7016         (Chunked_vector::size_): New data member.
7017         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7018         (Stringpool_template::new_key_offset): New method declaration.
7019         (Stringpool_template::offset_): New data member.
7020
7021 2010-03-15   Rafael Espindola  <espindola@google.com>
7022
7023         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7024         Add_symbols' constructor.
7025         * readsyms.h (Add_symbols): Remove the input_group member.
7026
7027 2010-03-10  Ian Lance Taylor  <iant@google.com>
7028
7029         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7030         target to ask whether a reference to a symbol requires a stack
7031         split.
7032         * target.h (Target::is_call_to_non_split): New function.
7033         (Target::do_is_call_to_non_split): Declare virtual function.
7034         * target.cc: Include "symtab.h".
7035         (Target::do_is_call_to_non_split): New function.
7036         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7037
7038 2010-03-10  Cary Coutant  <ccoutant@google.com>
7039
7040         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7041         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7042         (File_read::open[2]): Add whole_file_view_ to list of views.
7043         (File_read::make_view): Remove test of whole_file_view_.
7044         (File_read::find_or_make_view): Create whole_file_view_ if
7045         necessary.
7046         (File_read::clear_views): Replace bool parameter with enum;
7047         adjust all callers.  Don't delete views with permanent data;
7048         do delete cached views and views from archives if
7049         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7050         if clearing the corresponding view.
7051         * fileread.h (File_read::Clear_views_mode): New enum.
7052         (File_read::View::is_permanent_view): New method.
7053         (File_read::clear_views): Replace bool parameter
7054         with enum; adjust all callers.
7055         * options.h (General_options): Change keep_files_mapped option;
7056         add map_whole_files.
7057         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7058         releasing the file.
7059         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7060         the file.
7061
7062 2010-03-10  David S. Miller  <davem@davemloft.net>
7063
7064         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7065
7066 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7067
7068         * icf.cc (get_section_contents): Add '@' marker after processing the
7069         merge reloc.
7070
7071 2010-03-08  Doug Kwan  <dougkwan@google.com>
7072
7073         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7074         due to a conversion warning.
7075         (Arm_relobj::update_output_local_symbol_count): Check for local
7076         symbol with unset output index.
7077
7078 2010-03-05  Ian Lance Taylor  <iant@google.com>
7079
7080         * options.h (class General_options): Add --spare-dynamic-tags.
7081         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7082         --spare-dynamic-tags.
7083
7084 2010-03-05  Ian Lance Taylor  <iant@google.com>
7085
7086         * incremental.cc: Include "libiberty.h".
7087
7088 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7089
7090         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7091         function, is_info_ member.
7092         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7093         (Versions::Versions): Update caller.
7094         (Versions::define_base_version): Likewise.
7095         (Versions::add_def): Likewise.
7096
7097 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7098
7099         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7100         (Scan::possible_function_pointer_reloc): New function.
7101         (Scan::local_reloc_may_be_function_pointer): Change to call
7102         possible_function_pointer_reloc.
7103         (Scan::global_reloc_may_be_function_pointer): Ditto.
7104         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7105         relocations in ".data.rel.ro._ZTV" section.
7106         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7107         * testsuite/icf_safe_so_test.cc: Ditto.
7108         * testsuite/icf_safe_test.cc: Ditto.
7109         * testsuite/icf_safe_test.sh: Ditto.
7110
7111 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7112             Ian Lance Taylor  <iant@google.com>
7113
7114         * target-reloc.h (relocate_section): Check the symbol table index
7115         for -1U before setting the local symbol index.
7116         (scan_relocatable_relocs): If copying the relocation, record that
7117         the local symbol is required.
7118         * object.h (Symbol_value::is_output_symtab_index_set): New
7119         function.
7120         (Symbol_value::may_be_discarded_from_output_symtab): New
7121         function.
7122         (Symbol_value::has_output_symtab_entry): New function.
7123         (Symbol_value::needs_output_symtab_entry): Remove.
7124         (Symbol_value::output_symtab_index): Make sure the symbol index is
7125         set.
7126         (Symbol_value::set_output_symtab_index): Make sure the symbol
7127         index is not set.  Make sure the new index is valid.
7128         (Symbol_value::set_must_have_output_symtab_entry): New function.
7129         (Symbol_value::has_output_dynsym_entry): New function.
7130         (Symbol_value::set_output_dynsym_index): Make sure the new index
7131         is valid.
7132         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7133         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7134         local symbol if permitted.
7135         (Sized_relobj::do_finalize_local_symbols): Call
7136         is_output_symtab_index_set rather than needs_output_symtab_entry.
7137         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7138         rather than needs_output_symtab_entry.  Call
7139         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7140         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7141         is_output_symtab_index_set rather than needs_output_symtab_entry.
7142         * testsuite/discard_locals_relocatable_test.c: New file.
7143         * testsuite/discard_locals_test.sh: Test -r.
7144         * testsuite/Makefile.am (check_DATA): Add
7145         discard_locals_relocatable_test1.syms,
7146         discard_local_relocatable_test2.syms.
7147         (MOSTLYCLEANFILES): Likewise.  Also add
7148         discard_locals_relocatable_test1.lout and
7149         discard_locals_relocatable_test2.out.
7150         (discard_locals_relocatable_test1.syms): New target.
7151         (discard_locals_relocatable_test.o): New target.
7152         (discard_locals_relocatable_test1.out): New target.
7153         (discard_locals_relocatable_test2.syms): New target.
7154         (discard_locals_relocatable_test2.out): New target.
7155         (various): Add missing ../ld-new dependencies.
7156         * testsuite/Makefile.in: Rebuild.
7157
7158 2010-03-03  Nick Clifton  <nickc@redhat.com>
7159
7160         * po/fi.po: New Finnish translation.
7161
7162 2010-03-01  Doug Kwan  <dougkwan@google.com>
7163
7164         * layout.cc (Layout::Layout): Force section types of .init_array*,
7165         .preinit_array* and .fini_array* sections.
7166         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7167         Fix check of return value of std::string::find.().
7168         (Output_section::Input_section_sort_compare::operator()): Remove
7169         comment about .init_array.
7170         (Output_section::Input_section_sort_init_fini_compare::operator()):
7171         New method.
7172         (Output_section::sort_attached_input_sections): Handle .init_array
7173         and .fini_array specially.
7174         * output.h (Output_section::Inut_section_sort_compare): Update
7175         comment.
7176         (Output_section::Input_section_sort_init_fini_compare): New struct.
7177
7178 2010-02-26  Doug Kwan  <dougkwan@google.com>
7179
7180         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7181         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7182         * testsuite/debug_msg.sh: Avoid matching source line number for
7183         use of global variable undef_int.
7184
7185 2010-02-26  Doug Kwan  <dougkwan@google.com>
7186
7187         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7188         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7189         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7190         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7191         * options.cc (General_options::General_options): Initialize member
7192         fix_v4bx_.
7193         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7194         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7195         and rm_no_fix_v4bx.stdout
7196         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7197         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7198         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7199         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7200         and arm_no_fix_v4bx.
7201         * Makefile.in: Regenerate.
7202         * testsuite/arm_fix_v4bx.s: New file.
7203         * testsuite/arm_fix_v4bx.sh: Ditto.
7204
7205 2010-02-24  Doug Kwan  <dougkwan@google.com>
7206
7207         * arm.cc (Target_arm::got_section): Make the .got section the first
7208         non RELRO section in the data segment.
7209         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7210         suffixes of section names.
7211
7212 2010-02-24  Doug Kwan  <dougkwan@google.com>
7213
7214         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7215         flags and attributes merging if an input file is a binary file.
7216         * fileread.cc (Input_file::open): Record format of original file.
7217         * fileread.h (Input_file::Format): New enum type.
7218         (Input_file::Input_file): Initialize data member format_.
7219         (Input_file::format): New method definition.
7220         (Input_file::format_):: New data member.
7221
7222 2010-02-24  Doug Kwan  <dougkwan@google.com>
7223
7224         * arm.cc (Arm_output_data_got): New class.
7225         (ARM_TCB_SIZE): New constant
7226         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7227         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7228         If user uses a script with a SECTIONS clause, issue only a warning
7229         for a misplaced EXIDX input section.  Otherwise, issue an error.
7230         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7231         garbage collection.
7232         (Target_arm::got_mode_index_entry): Handle static linking.
7233         (Target_arm::Scan::local): Ditto.
7234         (Target_arm::Scan::global): Ditto.
7235         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7236         all incorrectly implemented relocations.
7237         (Target_arm::fix_exidx_coverage): Pass layout to
7238         Arm_output_section::fix_exidx_coverage.
7239         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7240         from ".ARM.exidx." and ".ARM.extab.".
7241
7242 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7243
7244         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7245         section if it does not already exist.
7246         * attributes.cc (Attributes_section_data::Attributes_section_data):
7247         Don't crash if size is zero.
7248
7249 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7250             Ian Lance Taylor  <iant@google.com>
7251
7252         * gold.cc (queue_middle_tasks): If no input files were opened,
7253         exit.
7254         * workqueue.h (Task_function::Task_function): Assert that there is
7255         a blocker.
7256
7257 2010-02-22  Doug Kwan  <dougkwan@google.com>
7258
7259         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7260         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7261         types to avoid warnings due to different uint64_t implementations
7262         on different hosts.
7263
7264 2010-02-21  Doug Kwan  <dougkwan@google.com>
7265
7266         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7267         handling of the maximum backward branch offset.
7268         (Arm_relocate_functions::thumb_branch_common): Ditto.
7269         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7270         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7271         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7272         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7273         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7274         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7275         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7276         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7277         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7278         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7279         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7280         thumb2_bl_out_of_range.o): New rules.
7281         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7282         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7283         thumb2_bl_out_of_range
7284         * testsuite/Makefile.in: Regenerate.
7285         * testsuite/arm_bl_in_range.s: New file.
7286         * testsuite/arm_bl_out_of_range.s: Ditto.
7287         * testsuite/arm_branch_in_range.sh: Ditto.
7288         * testsuite/arm_branch_range.t: Ditto.
7289         * testsuite/thumb2_branch_range.t: Ditto.
7290         * testsuite/thumb_bl_in_range.s: Ditto.
7291         * testsuite/thumb_bl_out_of_range.s: Ditto.
7292         * testsuite/thumb_branch_range.t: Ditto.
7293
7294 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7295
7296         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7297         Add reloc offset information.
7298         * icf.cc (get_section_contents): Change iterators to point to the new
7299         vectors. Add reloc offset information to the contents.
7300         * icf.h (Icf::Sections_reachable_info): New typedef.
7301         (Icf::Sections_reachable_list): New typedef.
7302         (Icf::Offset_info): New typedef.
7303         (Icf::Reloc_info): New struct typedef.
7304         (Icf::Reloc_info_list): New typedef.
7305         (Icf::symbol_reloc_list): Delete method.
7306         (Icf::addend_reloc_list): Delete method.
7307         (Icf::section_reloc_list): Delete method.
7308         (Icf::reloc_info_list): New method.
7309         (Icf::reloc_info_list_): New member.
7310
7311 2010-02-19  Doug Kwan  <dougkwan@google.com>
7312
7313         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7314         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7315         * arm.cc (Arm_relocation_functions): New forward declaration.
7316         (Target_arm::Target_arm): Initialize new data members
7317         got_mod_index_offset_ and tls_base_symbol_defined_.
7318         (Target_arm::Relocate::relocate_tls): New method.
7319         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7320          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7321         New methods.
7322         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7323         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7324         (Target_arm::got_mod_index_offset_,
7325         Target_arm::tls_base_symbol_defined_): New data members.
7326         (Target_arm::Scan::local, Target::Scan::global,
7327         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7328         relocations.
7329
7330 2010-02-18  Doug Kwan  <dougkwan@google.com>
7331
7332         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7333         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7334         text section as a parameter becuase some broken tools may not set
7335         the link in section header.
7336         (Target_arm::has_got_section): New method.
7337         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7338         without any mapping symbol as data only.  Remove warning.
7339         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7340         link in its section header, try to discover the link by inspecting the
7341         REL31 relocation at the beginning of the section.
7342         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7343         in error message.
7344         (Target_arm::Scan::global): Treat any reference to the symbol
7345         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7346
7347 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7348
7349         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7350         (Scan::global_reloc_may_be_function_pointer): New function.
7351         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7352         (Scan::global_reloc_may_be_function_pointer): New function.
7353         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7354         (Scan::global_reloc_may_be_function_pointer): New function.
7355         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7356         (Scan::global_reloc_may_be_function_pointer): New function.
7357         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7358         (Scan::global_reloc_may_be_function_pointer): New function.
7359         (Scan::possible_function_pointer_reloc): New function.
7360         (Target_x86_64::can_check_for_function_pointers): New function.
7361         * gc.h (gc_process_relocs): Scan relocation types to determine if
7362         function pointers were taken for targets that support it.
7363         * icf.cc (Icf::find_identical_sections): Include functions for
7364         folding in safe ICF whose pointer is not taken.
7365         * icf.h (Secn_fptr_taken_set): New typedef.
7366         (fptr_section_id_): New member.
7367         (section_has_function_pointers): New function.
7368         (set_section_has_function_pointers): New function.
7369         (check_section_for_function_pointers): New function.
7370         * options.h: Fix comment for safe ICF option.
7371         * target.h (can_check_for_function_pointers): New function.
7372         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7373         Modify icf_safe_test for X86-64.
7374         * testsuite/Makefile.in: Regenerate.
7375         * testsuite/icf_safe_so_test.cc: New file.
7376         * testsuite/icf_safe_so_test.sh: New file.
7377         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7378         (main): Change to take pointer to function kept_func_3.
7379         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7380         folding is done correctly for X86-64.
7381
7382 2010-02-12  David S. Miller  <davem@davemloft.net>
7383
7384         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7385         is_symbolless parameter.
7386         (Output_reloc<SHT_REL>::is_symbolless): New.
7387         (Output_reloc<SHT_REL>::is_symbolless_): New.
7388         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7389         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7390         (Output_reloc<SHT_RELA>::is_symbolless): New.
7391         (Output_data_reloc::add_global): Handle is_symbolless.
7392         (Output_data_reloc::add_global_relative): Likewise.
7393         (Output_data_reloc::add_local): Likewise.
7394         (Output_data_reloc::add_local_relative): Likewise.
7395         (Output_data_reloc::add_symbolless_global_addend): New.
7396         (Output_data_reloc::add_symbolless_local_addend): New.
7397         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7398         is_symbolless.
7399         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7400         instead of ->is_relative_
7401         (Output_reloc::write): Likewise.
7402         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7403         (Output_reloc::write_rel): Simplify.
7404
7405         * sparc.cc (Target_sparc::Scan::local): Use
7406         ->add_symbolless_local_addend as needed.
7407         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7408         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7409         based upon relocation offset.
7410
7411 2010-02-11  Doug Kwan  <dougkwan@google.com>
7412
7413         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7414         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7415         beginning of function.
7416         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7417         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7418         parameter is_32bit in calls to should_apply_static_reloc.
7419         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7420         (check_DATA): Add arm_abs_global.stdout.
7421         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7422         arm_abs_global.stdout): New rules.
7423         (MOSTLLYCLEANFILES): Add arm_abs_global
7424         * Makefile.in: Regenerate.
7425         * testsuite/arm_abs_global.s: New file.
7426         * testsuite/arm_abs_global.sh: Ditto.
7427         * testsuite/arm_abs_lib.s: Ditto.
7428
7429 2010-02-11  Ian Lance Taylor  <iant@google.com>
7430
7431         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7432         Read_relocs task.
7433         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7434         Allocate_commons_task first.
7435         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7436         task, rather than symtab_lock_.
7437         (Gc_process_relocs::~Gc_process_relocs): New function.
7438         (Gc_process_relocs::is_runnable): Check this_blocker_.
7439         (Gc_process_relocs::locks): Use next_blocker_ rather than
7440         blocker_.
7441         (Scan_relocs::~Scan_relocs): New function.
7442         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7443         symtab_lock_.
7444         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7445         next_blocker_.
7446         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7447         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7448         constructor accordingly.
7449         (class Gc_process_relocs): Likewise.
7450         (class Scan_relocs): Likewise.
7451         * common.h (class Allocate_commons_task): Remove symtab_lock_
7452         field, and corresponding constructor parameter.
7453         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7454         symtab_lock_.
7455         (Allocate_commons_task::locks): Likewise.
7456
7457 2010-02-11  Ian Lance Taylor  <iant@google.com>
7458
7459         * gold-threads.h (class Once): Define.
7460         (class Initialize_lock): Rewrite as child of Once.
7461         * gold-threads.cc (class Once_initialize): Define.
7462         (once_pointer_control): New static variable.
7463         (once_pointer, once_arg): New static variables.
7464         (c_run_once): New static function.
7465         (Once::Once, Once::run_once, Once::internal_run): New functions.
7466         (class Initialize_lock_once): Remove.
7467         (initialize_lock_control): Remove.
7468         (initialize_lock_pointer): Remove.
7469         (initialize_lock_once): Remove.
7470         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7471         (Initialize_lock::initialize): Rewrite.
7472         (Initialize_lock::do_run_once): New function.
7473         * archive.cc (Archive::interpret_header): Only clear name if it is
7474         not already empty.
7475         * fileread.cc: Include "gold-threads.h"
7476         (file_counts_lock): New static variable.
7477         (file_counts_initialize_lock): Likewise.
7478         (File_read::release): Only increment counts when using --stats.
7479         Use a lock around the increment.
7480         * parameters.cc (class Set_parameters_target_once): Define.
7481         (set_parameters_target_once): New static variable.
7482         (Parameters::Parameters): Move here from parameters.h.
7483         (Parameters::set_target): Rewrite.
7484         (Parameters::set_target_once): New function.
7485         (Parameters::clear_target): Move here and rewrite.
7486         * parameters.h (class Parameters): Update declarations.  Add
7487         set_parameters_target_once_ field.
7488         (Parameters::Parameters): Move to parameters.cc.
7489         (Parameters::clear_target): Likewise.
7490         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7491         task.
7492         (Start_group::~Start_group): New function.
7493         (Start_group::is_runnable): New function.
7494         (Start_group::locks, Start_group::run): New functions.
7495         (Finish_group::run): Change saw_undefined to size_t.
7496         * readsyms.h (class Start_group): Define.
7497         (class Finish_group): Change saw_undefined_ field to size_t.
7498         (Finish_group::Finish_group): Remove saw_undefined and
7499         this_blocker parameters.  Change all callers.
7500         (Finish_group::set_saw_undefined): New function.
7501         (Finish_group::set_blocker): New function.
7502         * symtab.h (class Symbol_table): Change saw_undefined to return
7503         size_t.  Change saw_undefined_ field to size_t.
7504         * target-select.cc (Set_target_once::do_run_once): New function.
7505         (Target_selector::Target_selector): Initialize set_target_once_
7506         field.  Don't initialize lock_ and initialize_lock_ fields.
7507         (Target_selector::instantiate_target): Rewrite.
7508         (Target_selector::set_target): New function.
7509         * target-select.h (class Set_target_once): Define.
7510         (class Target_selector): Update declarations.  Make
7511         Set_target_once a friend.  Remove lock_ and initialize_lock_
7512         fields.  Add set_target_once_ field.
7513
7514 2010-02-10  Ian Lance Taylor  <iant@google.com>
7515
7516         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7517         queueing any tasks.
7518         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7519         (queue_middle_tasks): Add all blockers before queueing any tasks.
7520         (queue_final_tasks): Likewise.
7521         * token.h (Task_token::add_blockers): New function.
7522         * object.h (Input_objects::number_of_relobjs): New function.
7523
7524 2010-02-10  Ian Lance Taylor  <iant@google.com>
7525
7526         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7527         shared, not if not position independent.
7528         * x86_64.cc (Relocate::relocate_tls): Likewise.
7529         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7530         (tls_pie_pic_test): New target.
7531         * testsuite/Makefile.in: Rebuild.
7532
7533         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7534         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7535         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7536         * testsuite/Makefile.in: Rebuild.
7537
7538 2010-02-09  David S. Miller  <davem@davemloft.net>
7539
7540         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7541         R_SPARC_RELATIVE using ->add_local_relative().
7542         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7543
7544         * output.h (Output_data_dynamic::add_section_size): New method
7545         that takes two Output_data objects.
7546         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7547         entry param.  Handle it in initializers.
7548         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7549         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7550         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7551         arg.
7552         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7553         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7554         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7555         for dynrel_includes_plt.
7556         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7557         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7558         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7559         before .rela.plt
7560         (Target_sparc::do_finalize_sections): Update to pass true for
7561         dynrel_includes_plt.
7562         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7563         output before .rela.plt
7564         (Target_powerpc::do_finalize_sections): Update to pass true for
7565         dynrel_includes_plt when 32-bit.
7566
7567 2010-02-08  Doug Kwan  <dougkwan@google.com>
7568
7569         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7570         method.
7571         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7572         Arm_relobj::scan_section_for_cortex_a8_stubs,
7573         Arm_relobj::do_relocation_section): Instead of calling
7574         Output_section::output_address, use faster
7575         Arm_relobj::simple_input_section_output_address.
7576
7577 2010-02-08  David S. Miller  <davem@davemloft.net>
7578
7579         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7580         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7581         relocation helper function.
7582
7583         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7584         just like R_SPARC_GOT{10,13,22}.
7585         (Target_sparc::Scan::local): Likewise.
7586         (Target_sparc::Relocate:relocate): Likewise.
7587
7588 2010-02-06  Ian Lance Taylor  <iant@google.com>
7589
7590         * configure.ac: Rewrite targetobjs duplicate removal code to use
7591         only shell constructs.
7592         * configure: Rebuild.
7593
7594 2010-02-05  Doug Kwan  <dougkwan@google.com>
7595
7596         PR 11247
7597         * arm.cc (Arm_relobj::section_is_scannable): New method.
7598         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7599         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7600
7601 2010-02-04  Doug Kwan  <dougkwan@google.com>
7602
7603         PR 11247
7604         * arm-reloc-property.cc (cstdio): Include.
7605         * configure.ac (targetobjs): Remove duplicates.
7606         * configure: Regenerate.
7607         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7608         big and little endian version for a given address size.
7609
7610 2010-02-03  Doug Kwan  <dougkwan@google.com>
7611
7612         * arm-reloc-property.cc
7613         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7614         definition.
7615         * arm-reloc-property.h
7616         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7617         New method definition.
7618         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7619         declaration.
7620         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7621         overflow to N.
7622         (GOT_PREL): Change implemented to Y.
7623         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7624         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7625         (Arm_relocate_functions::movw_abs_nc): Remove method.
7626         (Arm_relocate_functions::movt_abs): Ditto.
7627         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7628         (Arm_relocate_functions::thm_movt_abs): Ditto.
7629         (Arm_relocate_functions::movw_rel_nc): Ditto.
7630         (Arm_relocate_functions::movw_rel): Ditto.
7631         (Arm_relocate_functions::movt_rel): Ditto.
7632         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7633         (Arm_relocate_functions:thm_movw_rel): Ditto.
7634         (Arm_relocate_functions:thm_movt_rel): Ditto.
7635         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7636         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7637         New method definitions.
7638         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7639         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7640         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7641         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7642         (Target_arm::Relocate::relocate): Check for non-static or
7643         unimplemented relocation code and exit early.  Change calls to
7644         Target_arm::reloc_uses_thumb_bit and
7645         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7646         instead.  Refactor code to handle similar relocations to increase
7647         code sharing.  Remove check for unsupported relocation code in switch
7648         statement.
7649         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7650         relocation property table to find out size.  Change error message to
7651         print out the name of a relocation code instead of the numeric value.
7652         (Target_arm::scan_reloc_for_stub): Use relocation property table
7653         instead of calling Target_arm::reloc_uses_thumb_bit().
7654
7655 2010-02-02  Doug Kwan  <dougkwan@google.com>
7656
7657         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7658         types of relaxed input section.
7659
7660 2010-02-02  Doug Kwan  <dougkwan@google.com>
7661
7662         * Makefile.am (HFILES): Add arm-reloc-property.h.
7663         (DEFFILES): New.
7664         (TARGETSOURCES): Add arm-reloc-property.cc
7665         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7666         (libgold_a_SOURCES): $(DEFFILES)
7667         * Makefile.in: Regenerate.
7668         * arm-reloc-property.cc: New file.
7669         * arm-reloc-property.h: New file.
7670         * arm-reloc.def: New file.
7671         * arm.cc: Update comments.
7672         (arm-reloc-property.h): New included header.
7673         (arm_reloc_property_table): New global variable.
7674         (Target_arm::do_select_as_default_target): New method definition.
7675         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7676         arm-reloc-property to targ_extra_obj.
7677         * parameters.cc (set_parameters_target): Call
7678         Target::select_as_default_target().
7679         * target.h (Target::select_as_default_target): New method definition.
7680         (Target::do_select_as_default_target): Same.
7681
7682 2010-02-01  Doug Kwan  <dougkwan@google.com>
7683
7684         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7685         first_output_text_section_.
7686         (Arm_exidx_fixup::first_output_text_section): New method definition.
7687         (Arm_exidx_fixup::first_output_text_section_): New data member.
7688         (Arm_exidx_fixup::process_exidx_section): Record the first text
7689         output section seen.
7690         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7691         and entsize in output section header.
7692
7693 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7694
7695         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7696         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7697         (Arm_relocate_functions::thm_alu11): New Method.
7698         (Arm_relocate_functions::thm_pc8): New Method.
7699         (Arm_relocate_functions::thm_pc12): New Method.
7700         (Target_arm::Scan::local): Handle the relocations.
7701         (Target_arm::Scan::global): Likewise.
7702         (Target_arm::Relocate::relocate): Likewise.
7703         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7704
7705 2010-01-29  Doug Kwan  <dougkwan@google.com>
7706
7707         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7708         of relocation types as ld.
7709
7710 2010-01-29  Doug Kwan  <dougkwan@google.com>
7711
7712         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7713         to public.
7714         (Arm_relocate_functions::thumb_branch_common): Ditto.
7715         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7716         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7717         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7718         Arm_relocate_functions::jump24): Remove.
7719         (Target_arm::Relocate::relocate): Adjust code to call
7720         Arm_relocation_functions::arm_branch_common and
7721         Arm_relocation_functions::thumb_branch_common instead of their removed
7722         wrappers.  Merge switch-cases together to reduce source code size.
7723
7724 2010-01-29  Doug Kwan  <dougkwan@google.com>
7725
7726         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7727         output_local_symbol_count_needs_update_.
7728         (Arm_relobj::output_local_symbol_count_needs_update,
7729          Arm_relobj::set_output_local_symbol_count_needs_update,
7730          Arm_relobj::update_output_local_symbol_count): New methods.
7731         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7732         member.
7733         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7734         of pointed function as in a R_ARM_PREL31 relocation.
7735         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7736         for output local symbol count updating.
7737         (Target_arm::do_relax): Update output local symbol counts in objects
7738         if necessary.
7739         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7740
7741 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7742
7743         * arm.cc: Added support for the ARM relocations:
7744         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7745         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7746         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7747         movw_prel_nc).
7748         (Arm_relocate_functions::movw_rel): New method.
7749         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7750         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7751         thm_movw_prel_nc).
7752         (Arm_relocate_functions::thm_movw_rel): New method.
7753         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7754         thm_movt_prel).
7755         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7756         relocations.
7757         (Target_arm::Scan::global): Likewise.
7758         (Target_arm::Relocate::relocate): Likewise.
7759         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7760         Likewise.
7761
7762 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7763
7764         * arm.cc: Added support for ARM group relocations.
7765         (Target_arm::reloc_needs_sym_origin): New method.
7766         (Arm_relocate_functions::calc_grp_kn): New method.
7767         (Arm_relocate_functions::calc_grp_residual): New method.
7768         (Arm_relocate_functions::calc_grp_gn): New method.
7769         (Arm_relocate_functions::arm_grp_alu): New Method.
7770         (Arm_relocate_functions::arm_grp_ldr): New Method.
7771         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7772         (Arm_relocate_functions::arm_grp_ldc): New Method.
7773         (Target_arm::Scan::local): Handle the ARM group relocations.
7774         (Target_arm::Scan::global): Likewise.
7775         (Target_arm::Relocate::relocate): Likewise.
7776         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7777         Likewise.
7778
7779 2010-01-26  Doug Kwan  <dougkwan@google.com>
7780
7781         * arm.cc (set): Include.
7782         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7783         pointer type.
7784         (Arm_output_section::Text_section_list): New type.
7785         (Arm_output_section::append_text_sections_to_list): New method.
7786         (Arm_output_section::fix_exidx_coverage): Ditto.
7787         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7788         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7789         Relobj::set_section_offset() instead of
7790         Sized_relobj::invalidate_section_offset().
7791         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7792         parameter for section headers. Ignore relocation sections for
7793         unallocated sections and EXIDX sections.
7794         (Target_arm::fix_exidx_coverage): New method.
7795         (Target_arm::output_section_address_less_than): New type.
7796         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7797         linked text section instead of the EXIDX section.
7798         (Arm_output_section::create_stub_group): Add an assertion to check
7799         that this is not an EXIDX output section.
7800         (Arm_output_section::append_text_sections_to_list): New method.
7801         (Arm_output_section::fix_exidx_coverage): Ditto.
7802         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7803         Arm_relobj::section_needs_reloc_stub_scanning.
7804         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7805         first pass.
7806         (Target_arm::fix_exidx_coverage): New method.
7807         * object.h (Relobj::set_output_section): New method.
7808         (Sized_relobj::invalidate_section_offset): Remove method.
7809         (Sized_relobj::do_invalidate_section_offset): Remove method.
7810         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7811
7812 2010-01-25  Doug Kwan  <dougkwan@google.com>
7813
7814         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7815         Fix warning due to signed and unsigned comparison on a 32-bit host.
7816
7817 2010-01-22  Doug Kwan  <dougkwan@google.com>
7818
7819         * arm.cc (Target_arm::do_relax): Record an output section for section
7820         offset adjustment it contains any stub table that has changed.
7821         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7822         offsets in an output section if necessary.
7823         * output.cc (Output_section::Output_section): Initialize
7824         section_offsets_need_adjustments_.
7825         (Output_section::add_input_section_for_script): Renamed to
7826         Output_section::add_simple_input_section.
7827         (Output_section::save_states): Add a comment.
7828         (Output_section::discard_states): New method defintion.
7829         (Output_section::adjust_section_offsets): Same.
7830         * output.h (Output_section::add_input_section_for_script): Renamed to
7831         Output_section::add_simple_input_section.
7832         (Output_section::discard_states): New method declaration.
7833         (Output_section::adjust_section_offsets): Same.
7834         (Output_section::section_offsets_need_adjustment,
7835         Output_section::set_section_offsets_need_adjustment): New method
7836         definitions.
7837         (Output_section::section_offsets_need_adjustment_): New data member.
7838         * script-sections.cc
7839         (Output_section_element_input::set_section_address): Adjust code for
7840         renaming of Output_section::add_input_section_for_script.
7841         (Orphan_output_section::set_section_address): Same.
7842
7843 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7844
7845         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7846         Fix_v4bx enum values .
7847         * gold/options.h (General_options): New option definitions.
7848         (General_options::fix_v4bx): New method.
7849         (General_options::Fix_v4bx): New enum.
7850         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7851         (General_options::parse_fix_v4bx_interworking): New method.
7852
7853 2010-01-22  Doug Kwan  <dougkwan@google.com>
7854
7855         * arm.cc (Arm_exidx_fixup): New class.
7856
7857 2010-01-21  Doug Kwan  <dougkwan@google.com>
7858
7859         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7860         classes.
7861         (Arm_exidx_section_offset_map): New type.
7862
7863 2010-01-21  Doug Kwan  <dougkwan@google.com>
7864
7865         * arm.cc (Arm_exidx_input_section): New class.
7866         (Arm_relobj::exidx_input_section_by_link,
7867         Arm_relobj::exidx_input_section_by_shndx,
7868         Arm_relobj::make_exidx_input_section): New methods.
7869         (read_arm_attributes_section): Remove.
7870         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7871         information about them.
7872         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7873         to here.
7874
7875 2010-01-20  Doug Kwan  <dougkwan@google.com>
7876
7877         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7878         Input_section_specifier to Section_id.
7879         (Target_arm::new_arm_input_section: Adjust code for change of key
7880         type.
7881         (Target_arm::find_arm_input_section): Ditto.
7882         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7883         (Section_id): Remove.
7884         (Garbage_collection::Section_id_hash): Remove.
7885         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7886         (Section_id): Remove.
7887         (Icf::Section_id_hash): Remove.
7888         * object.h (Section_id, Const_section_id, Section_id_hash,
7889         Const_section_id_hash): New type definitions.
7890         * output.cc (Output_section::add_relaxed_input_section): Change to
7891         use Const_section_id instead of Input_section_specifier as key type.
7892         (Output_section::add_merge_input_section): Ditto.
7893         (Output_section::build_relaxation_map): Change to use Section_id
7894         instead of Input_section_specifier as key type.
7895         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7896         Ditto.
7897         (Output_section::convert_input_sections_to_relaxed_sections): Change
7898         to use Const_section_id instead of Input_section_specifier as key type.
7899         (Output_section::find_merge_section): Ditto.
7900         (Output_section::find_relaxed_input_section): Ditto.
7901         * output.h (Input_section_specifier): Remove class.
7902         (Output_section::Output_section_data_by_input_section_map): Change
7903         key type to Const_section_id.
7904         (Output_section::Output_relaxed_input_section_by_input_section_map):
7905         Ditto.
7906         (Output_section::Relaxation_map): Change key type to Section_id.
7907
7908 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7909
7910         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7911         (class Arm_v4bx_stub): New class.
7912         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7913         (Stub_factory::make_arm_v4bx_stub): New method.
7914         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7915         (Stub_table::empty): Handle v4bx stubs.
7916         (Stub_table::add_arm_v4bx_stub): New method.
7917         (Stub_table::find_arm_v4bx_stub): New method.
7918         (Arm_relocate_functions::v4bx): New method.
7919         (Target_arm::fix_v4bx): New method.
7920         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7921         (Stub_table::relocate_stubs): Likewise.
7922         (Stub_table::do_write): Likewise.
7923         (Stub_table::update_data_size_and_addralign): Likewise.
7924         (Stub_table::finalize_stubs):  Likewise.
7925         (Target_arm::Scan::local): Likewise.
7926         (Target_arm::Scan::global): Likewise.
7927         (Target_arm::do_finalize_sections): Likewise.
7928         (Target_arm::Relocate::relocate): Likewise.
7929         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7930         Likewise.
7931         (Target_arm::scan_reloc_for_stub): Likewise.
7932         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7933
7934 2010-01-19  Ian Lance Taylor  <iant@google.com>
7935
7936         * output.cc (Output_section_headers::do_sized_write): Write large
7937         segment count to sh_info field.
7938         (Output_file_header::do_sized_write): For large segment count,
7939         write PN_XNUM to e_phnum field.
7940
7941 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7942
7943         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7944         (Arm_relocate_functions::thm_jump8): New function.
7945         (Arm_relocate_functions::thm_jump11): New function.
7946         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7947         R_ARM_THM_JUMP11.
7948         (Target_arm::Scan::global): Likewise.
7949         (Target_arm::Relocate::relocate): Likewise.
7950         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7951         Likewise.
7952
7953 2010-01-14  Doug Kwan  <dougkwan@google.com>
7954
7955         * arm.cc (map, utility): Include headers.
7956         (Target_arm::apply_cortex_a8_workaround): New method.
7957         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7958         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7959         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7960         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7961         the --[no-]fix-cortex-a8 command line options.
7962         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7963         (Target_arm::relocate_stub): Use addend in instruction template.
7964         * options.h (DEFINE_bool): Set the user-set flag.
7965         (General_options): Add --[no-]-fix-cortex options.
7966         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7967         : Update fast look-up map after conversion.
7968
7969 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7970
7971         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7972         in the first pass of do_layout.
7973
7974 2010-01-13  Doug Kwan  <dougkwan@google.com>
7975
7976         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7977         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7978         apparent compiler problem of not folding static constant integral
7979         data members of elfcpp::Elf_sizes<32>.
7980
7981 2010-01-13  Doug Kwan  <dougkwan@google.com>
7982
7983         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7984         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7985         Arm_relobj::scan_section_for_cortex_a8_erratum,
7986         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7987         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7988         sections to scan for relocation stubs into a new method
7989         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7990         relocation and Cortex-A8 stub scanning.
7991         (Target_arm::do_relax): Force stubs to be after stubbed sections
7992         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7993         the beginning of a new relaxation pass.  Update a comment.
7994         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7995
7996 2010-01-12  Ian Lance Taylor  <iant@google.com>
7997
7998         * target-reloc.h (visibility_error): New inline function.
7999         (relocate_section): Call visibility_error.
8000         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8001         (MOSTLYCLEANFILES): Likewise.
8002         (protected_4_pic.o, protected_3.err): New targets.
8003         * testsuite/protected_4.cc: New file.
8004
8005 2010-01-12  Doug Kwan  <dougkwan@google.com>
8006
8007         * arm.cc (Cortex_a8_reloc): New class.
8008         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8009         and cortex_a8_relocs_info_.
8010         (Target_arm::fix_cortex_a8): New method definition.
8011         (Target_arm::Cortex_a8_relocs_info): New type.
8012         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8013         New data member declarations.
8014         (Target_arm::scan_reloc_for_stub): Record information about
8015         relocations for THUMB branches that might be exempted from the
8016         Cortex-A8 workaround.
8017         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8018         at the beginning of a relaxation pass.
8019
8020 2010-01-12  Doug Kwan  <dougkwan@google.com>
8021
8022         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8023         (Arm_relobj::Mapping_symbol_position,
8024          Arm_reloj::Mapping_symbol_position_less,
8025          Arm_relobj::Mapping_symbols_info): New types.
8026         (Target_arm::is_mapping_symbol_name): New method definition.
8027         (Arm_relobj::do_count_local_symbols): Save information about mapping
8028         symbols.
8029
8030 2010-01-11  Doug Kwan  <dougkwan@google.com>
8031
8032         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8033         Arm_relocate_functions::thumb32_branch_upper,
8034         Arm_relocate_functions::thumb32_branch_lower,
8035         Arm_relocate_functions::thumb32_cond_branch_offset,
8036         Arm_relocate_functions::thumb32_cond_branch_upper,
8037         Arm_relocate_functions::thumb32_cond_branch_lower,
8038         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8039         branch offset encoding.
8040         (Arm_relocate_functions::thumb_branch_common): Use new branch
8041         offset encoding methods to avoid code duplication.
8042         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8043         (Stub_addend_reader::operator()): Use new branch encoding method
8044         to avoid code duplication.
8045
8046 2010-01-11  Doug Kwan  <dougkwan@google.com>
8047
8048         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8049         (Target_arm::do_finalize_sections): Define special EXIDX section
8050         symbols only if referenced.
8051         * gc.h (Garbage_collection::add_reference): New method.
8052         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8053         code duplication.
8054
8055 2010-01-11  Ian Lance Taylor  <iant@google.com>
8056
8057         * script.cc (Version_script_info::build_expression_list_lookup):
8058         Change complaing about duplicate wildcard match from error to
8059         warning.
8060
8061         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8062         of 2009-12-30.
8063         (Version_script_info::Version_script_info): Initialize globs_,
8064         default_version_, default_is_global_, and exact_.  Don't
8065         initialize globals_ or locals_.
8066         (Version_script_info::build_lookup_tables): Build local symbols
8067         first.
8068         (Version_script_info::unquote): New function.
8069         (Version_script_info::add_exact_match): New function.
8070         (Version_script_info::build_expression_list_lookup): Remove lookup
8071         parameter.  Add is_global parameter.  Change all callers.  Handle
8072         wildcard pattern specially.  Unquote pattern.  Call
8073         add_exact_match.
8074         (Version_script_info::get_name_to_match): New function.
8075         (Version_script_info::get_symbol_version): New function.
8076         (Version_script_info::get_symbol_version_helper): Remove.
8077         (Version_script_info::check_unmatched_names): Call unquote.
8078         * script.h (class Version_script_info): Change get_symbol_version
8079         to be non-inline and add is_global parameter; change all callers.
8080         Rewrite symbol_is_local.  Update declarations.  Define struct
8081         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8082         Remove globals_ and locals_ members.  Add exact_, globs_,
8083         default_version_, is_global_.
8084         (Version_script_info::Glob): Remove pattern, add expression and
8085         is_global.  Update constructor.  Change all callers.
8086         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8087         default version.
8088         (Versions::symbol_section_contents): If a symbol is undefined, or
8089         defined in a dynamic object, set the version index to
8090         VER_NDX_LOCAL.
8091         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8092         symbol_is_local.
8093         (Symbol_table::add_from_pluginobj): Likewise.
8094         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8095
8096 2010-01-11  Doug Kwan  <dougkwan@google.com>
8097
8098         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8099         (incremental_dump_LDADD): Add linking option for libintl.
8100         * Makefile.in: Regenerate.
8101
8102 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8103
8104         PR gold/11144
8105         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8106         instead of -Ds.
8107         * testsuite/Makefile.in: Regenerated.
8108
8109 2010-01-10  Doug Kwan  <dougkwan@google.com>
8110
8111         * options.h (DEFINE_var): Use parentheses around argument varname__
8112         in macro body to avoid any unintended subsequent substitutions.
8113
8114 2010-01-10  Ian Lance Taylor  <iant@google.com>
8115
8116         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8117         candidates before doing symbol resolution.
8118
8119         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8120         ODR candidates if only one is weak.
8121
8122 2010-01-08  Ian Lance Taylor  <iant@google.com>
8123
8124         * script.cc (Version_script_info::build_expression_list_lookup):
8125         Don't warn about ambiguous version, just record the ambiguity.
8126         (Version_script_info::get_symbol_version_helper): Give error if
8127         version is ambiguous.
8128
8129 2010-01-08  Doug Kwan  <dougkwan@google.com>
8130
8131         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8132         prev_data_size_ and prev_addralign_.  Remove initializer for
8133         deleted data member has_been_changed_.
8134         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8135         to determine if the table is empty.
8136         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8137         Remove.
8138         (Stub_table::add_reloc_stub): Define method in class definition
8139         instead of just declaring it there.
8140         (Stub_table::add_cortex_a8_stub): New method definition.
8141         (Stub_table::update_data_size_and_addralign): Ditto.
8142         (Stub_table::finalize_stubs): Ditto.
8143         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8144         (Stub_table::do_addralign_): Return address alignment in the
8145         (Stub_table::do_reset_address_and_file_offset): Define method in
8146         class definition instead of declaring it there.  Set current data
8147         size to be the data size of the previous pass.
8148         (Stub_table::set_final_data_size): Use current data size as the
8149         final data size.
8150         (Stub_table::relocate_stub): Change parameter type of stub from
8151         Reloc_stub pointer to Stub pointer.
8152         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8153         (Stub_table::Cortex_a8_stub_list): New typedef.
8154         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8155          Stub_table::prev_addralign_): New data member.
8156         (Arm_relobj::Arm_relobj): Initialize data member
8157         section_has_cortex_a8_workaround_.
8158         (Arm_relobj::section_has_cortex_a8_workaround,
8159          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8160          definitions.
8161         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8162         declarations.
8163         (Target_arm::relocate_stub): Change parameter type of stub from
8164         Reloc_stub pointer to Stub pointer.
8165         (Insn_template::size, Insn_template::alignment): Handle
8166         THUMB16_SPECIAL_TYPE.
8167         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8168          Stub_table::update_data_size_and_addralign,
8169          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8170         definitions.
8171         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8172         (Stub_table::do_write): Ditto.
8173         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8174
8175 2010-01-08  Ian Lance Taylor  <iant@google.com>
8176
8177         PR 11108
8178         * symtab.h (class Symbol): Remove fields is_target_special_ and
8179         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8180         (Symbol::is_defined_in_discarded_section): New function.
8181         (Symbol::set_is_defined_in_discarded_section): New function.
8182         (Symbol::has_plt_offset): Rewrite.
8183         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8184         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8185         Don't initialize is_target_special_ or has_plt_offset_.
8186         Initialize is_defined_in_discarded_section_.
8187         (Symbol_table::add_from_relobj): If appropriate, set
8188         is_defined_in_discarded_section.
8189         * resolve.cc (Symbol::override_base_with_special): Don't test
8190         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8191         * target-reloc.h (relocate_section): Do special handling for
8192         symbols defined in discarded sections for global symbols as well
8193         as local symbols.
8194
8195 2010-01-08  Ian Lance Taylor  <iant@google.com>
8196
8197         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8198         the SHT_SYMTAB case.
8199
8200 2010-01-08  Ian Lance Taylor  <iant@google.com>
8201
8202         * object.cc (Sized_relobj::do_layout): Don't get confused if
8203         layout_eh_frame returns NULL.
8204
8205 2010-01-08  Ian Lance Taylor  <iant@google.com>
8206
8207         PR 11084
8208         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8209         dynamic symbol table, use the normal symbol table.
8210         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8211         symbol table.
8212
8213 2010-01-08  Ian Lance Taylor  <iant@google.com>
8214
8215         PR 11072
8216         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8217         sections.
8218
8219 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8220
8221         * version.cc (print_version): Change to "Copyright 2010".
8222
8223 2010-01-08  Ian Lance Taylor  <iant@google.com>
8224
8225         PR 10287
8226         PR 11063
8227         * i386.cc (class Target_i386): Change return type of plt_section
8228         to be non-const.
8229         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8230         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8231         tls_desc_rel_ field.
8232         (Output_data_plt_i386::rel_tls_desc): New function.
8233         (Target_i386::rel_tls_desc_section): New function.
8234         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8235         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8236         R_386_TLS_DESC reloc in rel_tls_desc_section.
8237         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8238         Define struct Tlsdesc_info.
8239         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8240         (Target_x86_64::do_reloc_symbol_index): New function.
8241         (Target_x86_64::add_tlsdesc_info): New function.
8242         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8243         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8244         tlsdesc_rel_ field.
8245         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8246         all callers.
8247         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8248         (Target_x86_64::rela_tlsdesc_section): New function.
8249         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8250         handling.
8251         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8252         (Target_x86_64::do_reloc_addend): New function.
8253         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8254         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8255         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8256         (Output_reloc::type): New function.
8257         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8258         (Output_reloc::is_target_specific): New function.
8259         (Output_reloc::target_arg): New function.
8260         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8261         absolute relocs and target specific relocs.
8262         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8263         add_target_specific.
8264         (class Output_data_reloc) [SHT_RELA]: Likewise.
8265         * output.cc (Output_reloc::Output_reloc): Add four new versions
8266         for absolute relocs and target specific relocs.
8267         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8268         (Output_reloc::get_symbol_index): Likewise.
8269         (Output_reloc::local_section_offset): Check that local_sym_index_
8270         is not TARGET_CODE or 0.
8271         (Output_reloc::symbol_value): Likewise.
8272         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8273         reloc.
8274         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8275         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8276         functions.
8277         * layout.cc (add_target_dynamic_tags): Use output section for
8278         DT_PLTRELSZ and DT_JMPREL.
8279
8280 2010-01-07  Ian Lance Taylor  <iant@google.com>
8281
8282         PR 11061
8283         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8284         function.
8285         (class Output_data_reloc_generic): Define.
8286         (class Output_data_reloc_base): Change base class to
8287         Output_data_reloc_generic.  Change add() method to call
8288         bump_relative_reloc_count for a relative reloc.  Remove
8289         sort_relocs_ field.
8290         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8291         to sort_relocs().
8292         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8293         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8294         appropriate.
8295         * layout.h (class Layout): Update declaration.
8296
8297 2010-01-07  Ian Lance Taylor  <iant@google.com>
8298
8299         * output.h (class Output_data): Add const version of
8300         output_section and do_output_section.
8301         (class Output_section_data): Add const version of
8302         do_output_section.
8303         (class Output_section): Likewise.
8304         * layout.cc (Layout::add_target_dynamic_tags): New function.
8305         * layout.h (class Layout): Update declarations.
8306         * arm.cc (Target_arm::do_finalize_sections): Use
8307         add_target_dynamic_tags.
8308         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8309         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8310         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8311         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8312
8313 2010-01-07  Ian Lance Taylor  <iant@google.com>
8314
8315         PR 11042
8316         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8317         object as needed.
8318
8319 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8320             Ian Lance Taylor  <iant@google.com>
8321
8322         PR 11019
8323         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8324         Xindex::read_symtab_xindex.
8325
8326 2010-01-07  Doug Kwan  <dougkwan@google.com>
8327
8328         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8329         (Insn_template::thumb16_bcond_insn): New method declaration.
8330         (Insn_template): Fix spelling.
8331         (Stub::thumb16_special): New method declaration.
8332         (Stub::do_write): Define virtual method which was previously pure
8333         virtual.
8334         (Stub::do_thumb16_special): New method declaration.
8335         (Stub::do_fixed_endian_write): New template member.
8336         (Reloc_stub::do_write): Remove.
8337         (Reloc_stub::do_fixed_endian_write): Remove.
8338         (Cortex_a8_stub): New class definition.
8339         (Stub_factory::make_cortex_a8_stub): New method definition.
8340         (Stub_factory::Stub_factory): Add missing static storage class
8341         qualifier for elf32_arm_stub_a8_veneer_blx.
8342
8343 2010-01-07  Ian Lance Taylor  <iant@google.com>
8344
8345         PR 10980
8346         * options.h (class General_options): Add --warn-unresolved-symbols
8347         and --error-unresolved-symbols.
8348         * errors.cc (Errors::undefined_symbol): Implement
8349         --warn-unresolved-symbols.
8350
8351         * options.h (class General_options): Add -z text and -z textoff.
8352         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8353
8354 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8355
8356         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8357         (Garbage_collection::cident_sections): New function.
8358         (Garbage_collection::add_cident_section): New function.
8359         (Garbage_collection::cident_sections_): New member.
8360         (gc_process_relocs): Add references to sections whose names are C
8361         identifiers.
8362         * gold.h (cident_section_start_prefix): New constant.
8363         (cident_section_stop_prefix): New constant.
8364         (is_cident): New function.
8365         * layout.cc (Layout::define_section_symbols): Replace string constants
8366         with the newly defined constants.
8367         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8368         C identifiers.
8369         * testsuite/Makefile.am: Add gc_orphan_section_test.
8370         * testsuite/Makefile.in: Regenerate.
8371         * testsuite/gc_orphan_section_test.cc: New file.
8372         * testsuite/gc_orphan_section_test.sh: New file.
8373
8374 2010-01-06  Ian Lance Taylor  <iant@google.com>
8375
8376         PR 10980
8377         * options.h (class General_options): Add --warn-shared-textrel.
8378         * layout.cc (Layout::finish_dynamic_section): Implement
8379         --warn-shared-textrel.
8380
8381         PR 10980
8382         * options.h (class General_options): Add --warn-multiple-gp.
8383
8384 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8385
8386         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8387         $(THREADSLIB) and $(LIBDL).
8388         * Makefile.in: Rebuild.
8389
8390 2010-01-06  Ian Lance Taylor  <iant@google.com>
8391
8392         PR 10980
8393         * options.cc (General_options::parse_section_start): New function.
8394         (General_options::section_start): New function.
8395         (General_options::General_options): Initialize all members.
8396         * options.h: Include <map>
8397         (class General_options): Add --section-start.  Add section_starts_
8398         member.
8399         * layout.cc (Layout::attach_allocated_section_to_segment): If
8400         --section-start was used, set the address of the segment.  Remove
8401         local sort_sections.
8402         (Layout::relaxation_loop_body): If the address of the load segment
8403         has been set by --section-start, don't use it.
8404         * output.h (Output_segment::update_flags_for_output_section): New
8405         function.
8406         * output.cc (Output_segment::add_output_section): Call
8407         update_flags_for_output_section.
8408
8409 2010-01-05  Ian Lance Taylor  <iant@google.com>
8410
8411         PR 10980
8412         * options.h (class General_options): Add --undefined-version.
8413         * script.cc (struct Version_expression): Add was_matched_by_symbol
8414         field.
8415         (Version_script_info::matched_symbol): New function.
8416         (Version_script_info::get_symbol_version_helper): Call
8417         matched_symbol.
8418         (Version_script_info::check_unmatched_names): New function.
8419         * script.h (class Version_script_info): Update declarations.
8420         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8421
8422         * options.h (class General_options): Use DEFINE_bool_alias for
8423         allow_multiple_definition.
8424         * resolve.cc (Symbol_table::should_override): Don't test
8425         allow_multiple_definition.
8426
8427         PR 10980
8428         * options.h (class General_options): Add --cref.
8429         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8430         until after printing cref table.
8431         * cref.cc: Include "symtab.h".
8432         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8433         (Cref_table_compare::operator()): New function.
8434         (Cref_inputs::gather_cref): New function.
8435         (filecol): New static const.
8436         (Cref_inputs::print_cref): New function.
8437         (Cref::print_cref): New function.
8438         * cref.h: Include <cstdio>.
8439         (class Cref): Update declarations.
8440         * mapfile.h (Mapfile::file): New function.
8441         * object.h (class Object): Define Symbols.  Declare virtual
8442         do_get_global_symbols.
8443         (Object::get_global_symbols): New function.
8444         * object.cc (Input_objects::add_object): Pass object to cref_ if
8445         --cref.
8446         (Input_objects::archive_start): Likewise.
8447         (Input_objects::archive_stop): Likewise.
8448         (Input_objects::print_cref): New function.
8449         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8450         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8451         --cref.
8452         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8453         function.
8454         * plugin.h (class Sized_pluginobj): Update declarations.
8455
8456 2010-01-05  Ian Lance Taylor  <iant@google.com>
8457
8458         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8459         to is_default_version.  Rename insdef to insdefault.
8460         (Symbol_table::add_from_relobj): Rename def to is_default_version
8461         and local to is_forced_local.
8462         (Symbol_table::add_from_pluginobj): Likewise.
8463         (Symbol_table::add_from_dynobj): Likewise.
8464         (Symbol_table::define_special_symbol): Rename insdef to
8465         insdefault.
8466
8467 2010-01-04  Ian Lance Taylor  <iant@google.com>
8468
8469         PR 10980
8470         * options.h (class General_options): Add
8471         --allow-multiple-definition and -z muldefs.
8472         * resolve.cc (Symbol_table::should_override): Don't warn about a
8473         multiple symbol definition if --allow-multiple-definition or -z
8474         muldefs.
8475
8476         PR 10980
8477         * options.h (class General_options): Add --add-needed and
8478         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8479         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8480         error if --copy-dt-needed-entries aka --add-needed is used and
8481         would cause a change in behaviour.
8482
8483         PR 10980
8484         * options.h (class General_options): Add -G as a short version of
8485         --shared.  Add no-op options -assert, -g, and -i.
8486
8487 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8488
8489         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8490         check for .text or .gnu.linkonce.t sections.
8491         * icf.cc (Icf::find_identical_sections): Ditto.
8492         Change the detection for mangled function name within the section
8493         name.
8494         * icf.h (is_section_foldable_candidate): New function.
8495
8496 2009-12-30  Ian Lance Taylor  <iant@google.com>
8497
8498         PR 10980
8499         * options.h (class General_options): Permit two dashes with
8500         --retain-symbols-file.
8501
8502 2009-12-30  Ian Lance Taylor  <iant@google.com>
8503
8504         PR 10979
8505         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8506         don't put the file header and segment headers in the text
8507         segment.
8508
8509         PR 10979
8510         * common.cc (Sort_commons::operator()): Stabilize sort when both
8511         entries are NULL.
8512         (Symbol_table::do_allocate_commons_list): When allocating common
8513         symbols, skip a symbol which is no longer common.
8514         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8515         an object before checking its type.
8516         * testsuite/common_test_2.c: New file.
8517         * testsuite/common_test_3.c: New file.
8518         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8519         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8520         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8521         (common_test_2_pic.o, common_test_2.so): New targets.
8522         (common_test_3_pic.o, common_test_3.so): New targets.
8523         * testsuite/Makefile.in: Rebuild.
8524
8525         PR 10979
8526         * script.cc (read_input_script): If we see a new SECTIONS clause,
8527         and we have added an input section, give an error.
8528         * layout.h (class Layout): Add have_added_input_section function.
8529         Add have_added_input_section_ field.
8530         * layout.cc (Layout::Layout): Initialize
8531         have_added_input_section_.
8532         (Layout::layout): Set have_added_input_section_.
8533         (Layout::layout_eh_frame): Likewise.
8534
8535 2009-12-30  Ian Lance Taylor  <iant@google.com>
8536
8537         PR 10931
8538         * options.h (class General_options): Add --sort-common option.
8539         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8540         * common.cc (Sort_common): Add sort_order parameter to
8541         constructor.  Add sort_order_ field.
8542         (Sort_commons::operator): Check sort_order_.
8543         (Symbol_table::allocate_commons): Determine the sort order.
8544         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8545         Change all callers.
8546         (Symbol_table::do_allocate_commons_list): Likewise.
8547
8548 2009-12-30  Ian Lance Taylor  <iant@google.com>
8549
8550         PR 10916
8551         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8552         symbols from this object, don't change the visibility of an
8553         undefined symbol.
8554         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8555
8556 2009-12-30  Ian Lance Taylor  <iant@google.com>
8557
8558         PR 10861
8559         * script.h (class Version_script_info): Define Language enum.
8560         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8561         new fields globals_, locals_, and is_finalized_.
8562         * script.cc: Various formatting fixes.
8563         (class Parser_closure): Change language_stack_ from a vector of
8564         std::string to one of Version_script_info::Language.  Adjust all
8565         uses accordingly.
8566         (class Lazy_demangler): Remove.
8567         (struct Version_expression): Change language from std::string to
8568         Version_script_info::Language.
8569         (Version_script_info::Version_script_info): New function.
8570         (Version_script_info::~Version_script_info): Don't call clear.
8571         (Version_script_info::finalize): New function.
8572         (Version_script_info::build_lookup_tables): New function.
8573         (Version_script_info::build_expression_list_lookup): New
8574         function.
8575         (Version_script_info::get_symbol_version_helper): Rewrite to use
8576         lookup tables.
8577         (Version_script_info::print_expression_list): Adjust to use
8578         Version_script_info::Language.
8579         (script_push_lex_into_version_mode): Check that the version script
8580         has not been finalized.
8581         (version_script_push_lang): Change language string to
8582         Version_script_info::Language.
8583         * options.cc (Command_line::version_script): New function.
8584         * options.h (class General_options): Add finalize_dynamic_list
8585         function.  Change version_script from declaration to definition.
8586         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8587         * testsuite/version_script.map: Remove duplicate def of foo.
8588         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8589         version_script.map.
8590         * testsuite/Makefile.in: Rebuild.
8591
8592 2009-12-30  Ian Lance Taylor  <iant@google.com>
8593
8594         PR 10843
8595         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8596         if the input symbol index is 0, make the output symbol index 0.
8597
8598 2009-12-30  Ian Lance Taylor  <iant@google.com>
8599
8600         PR 10670
8601         * options.h (class General_options): Add -x/--discard-all.
8602         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8603         --discard-all.  If the local symbol needs a dynamic entry, check
8604         that before handling --discard-locals.
8605
8606 2009-12-30  Ian Lance Taylor  <iant@google.com>
8607
8608         PR 10450
8609         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8610         flags to PF_R.
8611         (Output_segment::add_output_section): Don't change the flags if
8612         the type is PT_TLS.
8613
8614         PR 10450
8615         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8616         GNU hash table if they need a dynamic value.  Otherwise, don't add
8617         them if they are defined in a dynamic object or are forced local.
8618
8619 2009-12-29  Ian Lance Taylor  <iant@google.com>
8620
8621         PR 10450
8622         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8623         .gnu.hash table for a 32-bit target.
8624
8625         PR 10450
8626         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8627         regular and a dynamic object only needs a dynamic symbol table
8628         entry if it is externally visible.
8629
8630         PR 10450
8631         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8632         constructor.  Add global_offset_table_ field.
8633         (Target_i386::got_section): Set global_offset_table_.
8634         (Target_i386::do_finalize_sections): Set global_offset_table_
8635         size.
8636         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8637         in constructor.  Add global_offset_table_ field.
8638         (Target_x86_64::got_section): Set global_offset_table_.
8639         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8640         size.
8641
8642         * layout.cc (Layout::Layout): Initialize increase_relro_.
8643         (Layout::get_output_section): Add is_relro, is_last_relro, and
8644         is_first_non_relro parameters.  Change all callers.
8645         (Layout::choose_output_section): Likewise.
8646         (Layout::add_output_section_data): Likewise.
8647         (Layout::make_output_section): Likewise.
8648         (Layout::set_segment_offsets): Clear increase_relro when using a
8649         linker script.
8650         * layout.h (class Layout): Add increase_relro method.  Add
8651         increase_relro_ field.  Update declarations.
8652         * output.cc (Output_section::Output_section): Initialize
8653         is_last_relro_ and is_first_non_relro_.
8654         (Output_segment::add_output_section): Group relro sections is
8655         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8656         (Output_segment::maximum_alignment): Remove relro handling.
8657         (Output_segment::set_section_addresses): Add increase_relro
8658         parameter.  Change all callers.  Add initial alignment to align
8659         relro sections on separate page.  Remove old relro handling.
8660         (Output_segment::set_section_list_addresses): Remove in_relro
8661         parameter.  Change all callers.
8662         (Output_segment::set_offset): Add increase parameter.  Change all
8663         callers.  Remove old relro handling.
8664         * output.h (class Output_section): Add new methods: is_last_relro,
8665         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8666         Add is_last_relro_ and is_first_non_relro_ fields.
8667         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8668         Create separate .got.plt section.  Call increase_relro.
8669         * x86_64.cc (Target_x86_64::got_section): Likewise.
8670         * testsuite/relro_script_test.t: Add .got.plt.
8671
8672         PR 10450
8673         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8674         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8675         (Layout::finalize): Call set_dynamic_symbol_size.
8676         (Layout::set_dynamic_symbol_size): New function.
8677         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8678         set_dynamic_symbol_size.
8679
8680         PR 10450
8681         * output.h (class Output_section): Add is_entsize_zero_ field.
8682         * output.cc (Output_section::Output_section): Initialize
8683         is_entsize_zero_.
8684         (Output_section::set_entsize): If two different entsizes are
8685         requested, force it to zero.
8686         (Output_section::add_input_section): Set flags for .debug_str
8687         before updating section flags.  Set entsize.
8688         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8689         and SHF_STRING if all input sections have those flags.
8690
8691 2009-12-29   Rafael Espindola  <espindola@google.com>
8692
8693         * main.cc (main): Fix the sys time reporting.
8694         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8695         reporting.
8696
8697 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8698
8699         * options.cc (General_options::parse_version): Allow -v to exit
8700         without an error if there is nothing to link.
8701
8702 2009-12-29  Ian Lance Taylor  <iant@google.com>
8703
8704         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8705         using a version of gcc before 4.1.
8706         * configure: Rebuild.
8707
8708 2009-12-28  Chris Demetriou  <cgd@google.com>
8709
8710         * attributes.cc (Output_attributes_section_data::do_write): Use
8711         std::vector::front rather than std::vector::data.
8712
8713 2009-12-28  Ian Lance Taylor  <iant@google.com>
8714
8715         * symtab.h (class Symbol_table): Add enum Defined.
8716         * resolve.cc (Symbol_table::should_override): Add defined
8717         parameter.  Change all callers.  Test whether object is NULL
8718         before calling a method on it.
8719         (Symbol_table::report_resolve_problem): Add defined parameter.
8720         Change all callers.
8721         (Symbol_table::should_override_with_special): Likewise.
8722         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8723         parameter.  Change all callers.
8724         (Symbol_table::do_define_in_output_data): Likewise.
8725         (Symbol_table::define_in_output_segment): Likewise.
8726         (Symbol_table::do_define_in_output_segment): Likewise.
8727         (Symbol_table::define_as_constant): Likewise.
8728         (Symbol_table::do_define_as_constant): Likewise.
8729         * script.h (class Symbol_assignment): Add is_defsym parameter to
8730         constructor; change all callers.
8731         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8732         parameter.  Change all callers.  Add is_defsym_ field.
8733         (class Parser_closure): Add parsing_defsym parameter to
8734         constructor; change all callers.  Add parsing_defsym accessor
8735         function.  Add parsing_defsym_ field.
8736
8737 2009-12-28  Ian Lance Taylor  <iant@google.com>
8738
8739         * gold.cc (queue_middle_tasks): Fix formatting.
8740         * object.cc (Relobj::is_section_name_included): Likewise.
8741
8742 2009-12-23  Ian Lance Taylor  <iant@google.com>
8743
8744         * i386.cc (Target_i386::do_calls_non_split): Recognize
8745         -fsplit-stack prologue for a function with a static chain.
8746         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8747         -fsplit-stack prologue when using %r11.
8748
8749 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8750
8751         * options.cc (General_options::parse_version): Make -v continue and do
8752         the link like GNU ld does.
8753
8754 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8755
8756         * Makefile.am (CCFILES): Add timer.cc.
8757         (HFILES): Add timer.h.
8758         * configure.ac: Check for sysconf and times.
8759         * main.cc: include timer.h.
8760         (main): Use Timer instead of get_run_time.
8761         * timer.cc: New.
8762         * timer.h: New.
8763         * workqueue.cc: include timer.h.
8764         (Workqueue::find_and_run_task):
8765         Report user, sys and wall time.
8766         * Makefile.in: Regenerate.
8767         * config.in: Regenerate.
8768         * configure: Regenerate.
8769
8770 2009-12-16  Doug Kwan  <dougkwan@google.com>
8771
8772         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8773         sections.
8774         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8775         relaxed input sections.
8776         * output.cc (Output_section::find_relaxed_input_section): Change
8777         return type to Output_relaxed_input_section pointer.  Adjust code
8778         for new type of relaxed_input_section_map_.
8779         * output.h (Output_section::find_relaxed_input_section): Change
8780         return type to Output_relaxed_input_section pointer.
8781         (Output_section::Output_relaxed_input_section_by_input_section_map):
8782         New type.
8783         (Output_section::relaxed_input_section_map_): Change type to
8784         Output_section::Output_relaxed_input_section_by_input_section_map.
8785         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8786         input section.
8787
8788 2009-12-15  Ian Lance Taylor  <iant@google.com>
8789
8790         * layout.cc (Layout::create_shstrtab): Only write out after input
8791         sections if we are compressing debug sections.
8792
8793 2009-12-15  Ian Lance Taylor  <iant@google.com>
8794
8795         * archive.cc (Archive::add_symbols): Only look up a symbol without
8796         a version if there is, in fact, a version.
8797
8798 2009-12-14  Ian Lance Taylor  <iant@google.com>
8799
8800         Revert -Wshadow changes, all changes from:
8801         2009-12-11  Doug Kwan  <dougkwan@google.com>
8802         2009-12-11  Nick Clifton  <nickc@redhat.com>
8803         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8804
8805 2009-12-11  Doug Kwan  <dougkwan@google.com>
8806
8807         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8808         due to -Wshadow.
8809         * attributes.cc (Object_attribute::size): Ditto.
8810         (Attributes_section_data::size): Ditto.
8811         (Attributes_section_data::Attributes_section_data): Ditto.
8812         (Output_attributes_section_data::do_write): Ditto.
8813         * attributes.h (Object_attribute::set_type): Ditto.
8814         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8815
8816 2009-12-11  Nick Clifton  <nickc@redhat.com>
8817
8818         * archive.cc: Fix shadowed variable warnings.
8819         * arm.cc: Likewise.
8820         * compressed_output.cc: Likewise.
8821         * compressed_output.h: Likewise.
8822         * configure: Likewise.
8823         * dwarf_reader.cc: Likewise.
8824         * dynobj.cc: Likewise.
8825         * dynobj.h: Likewise.
8826         * ehframe.cc: Likewise.
8827         * ehframe.h: Likewise.
8828         * errors.cc: Likewise.
8829         * expression.cc: Likewise.
8830         * fileread.cc: Likewise.
8831         * fileread.h: Likewise.
8832         * freebsd.h: Likewise.
8833         * i386.cc: Likewise.
8834         * icf.cc: Likewise.
8835         * incremental.h: Likewise.
8836         * layout.cc: Likewise.
8837         * layout.h: Likewise.
8838         * mapfile.cc: Likewise.
8839         * merge.cc: Likewise.
8840         * merge.h: Likewise.
8841         * object.cc: Likewise.
8842         * object.h: Likewise.
8843         * options.h: Likewise.
8844         * output.cc: Likewise.
8845         * output.h: Likewise.
8846         * parameters.cc: Likewise.
8847         * plugin.cc: Likewise.
8848         * powerpc.cc: Likewise.
8849         * reduced_debug_output.cc: Likewise.
8850         * reduced_debug_output.h: Likewise.
8851         * reloc.cc: Likewise.
8852         * reloc.h: Likewise.
8853         * resolve.cc: Likewise.
8854         * script-sections.cc: Likewise.
8855         * script.cc: Likewise.
8856         * script.h: Likewise.
8857         * sparc.cc: Likewise.
8858         * symtab.cc: Likewise.
8859         * symtab.h: Likewise.
8860         * target-select.cc: Likewise.
8861         * target-select.h: Likewise.
8862         * token.h: Likewise.
8863         * workqueue.cc: Likewise.
8864         * workqueue.h: Likewise.
8865         * x86_64.cc: Likewise.
8866
8867 2009-12-10  Doug Kwan  <dougkwan@google.com>
8868
8869         * arm.cc (attributes.h): New include.
8870         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8871         (Arm_relobj::~Arm_relobj): Delete object pointed by
8872         attributes_section_data_.
8873         (Arm_relobj::attributes_section_data): New method definition.
8874         (Arm_relobj::attributes_section_data_): New data member declaration.
8875         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8876         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8877         attributes_section_data_.
8878         (Arm_dynobj::attributes_section_data): New method definition.
8879         (Arm_dynobj::attributes_section_data_): New data member declaration.
8880         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8881         initialization value of may_use_blx_ to false.
8882         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8883         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8884         object attributes to compute results instead of hard-coding.
8885         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8886         Target_arm::get_secondary_compatible_arch,
8887         Target_arm::set_secondary_compatible_arch
8888         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8889         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8890         New method declarations.
8891         (Target_arm::get_aeabi_object_attribute): New method definition.
8892         (Target_arm::attributes_section_data_): New data member declaration.
8893         (read_arm_attributes_section): New template definition.
8894         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8895         (Arm_dynobj::do_read_symbols): Ditto.
8896         (Target_arm::do_finalize_sections): Merge attributes sections from
8897         input.  Check for BLX use after attributes section merging.
8898         Fix __exidx_start and __exidx_end visibility.  Create an
8899         .ARM.attributes section if necessary.
8900         (Target_arm::get_secondary_compatible_arch,
8901         Target_arm::set_secondary_compatible_arch,
8902         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8903         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8904         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8905         New method definitions.
8906
8907 2009-12-09  Ian Lance Taylor  <iant@google.com>
8908
8909         * plugin.cc (Plugin::load): Don't cast from void* to a function
8910         pointer.
8911
8912 2009-12-09  Ian Lance Taylor  <iant@google.com>
8913
8914         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8915         information fields.
8916
8917 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8918
8919         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8920         Replace two_file_shared_1.so with two_file_shared_2.so.
8921         * testsuite/Makefile.in: Regenerated.
8922
8923 2009-12-08  Doug Kwan  <dougkwan@google.com>
8924
8925         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8926         (HFILES): Add attributes.h and int_encoding.h.
8927         * Makefile.in: Regenerate.
8928         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8929         function definitions to int_encoding.cc
8930         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8931         prototypes to int_encoding.h
8932         * reduced_debug_output.cc (int_encoding.h): New include.
8933         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8934         function definitions to int_encoding.cc
8935         (insert_into_vector, read_from_pointer): Move template definitions to
8936         int_encoding.h
8937         * attributes.cc: New file.
8938         * attributes.h: New file.
8939         * int_encoding.cc: New file.
8940         * int_encoding.h: New file.
8941
8942 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8943
8944         PR gold/11055
8945         * incremental-dump.cc (dump_incremental_inputs): New.
8946         (main): Use dump_incremental_inputs.
8947
8948 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8949
8950         PR gold/10893
8951         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8952         checking elfcpp::STT_FUNC.
8953         (Target_i386::Relocate::relocate): Likewise.
8954         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8955
8956         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8957         symbols from shared libraries into normal FUNC symbols.
8958
8959         * symtab.h (Symbol): Add is_func and use it.
8960
8961 2009-12-05  Doug Kwan  <dougkwan@google.com>
8962
8963         * arm.cc (Target_arm::arm_info): Initialize new fields
8964         attributes_section and attributes_vendor.
8965         * i386.cc (Target_i386::i386_info): Same.
8966         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8967         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8968         fields attributes_section and attributes_vendor.
8969         * sparc.cc (Target_sparc::sparc_info): Same.
8970         * target.h (Target::attributes_section, Target::attributes_vendor,
8971         Target::is_attributes_section, Target::attribute_arg_type,
8972         Target::attributes_order): New method definitions.
8973         (Target::Target_info::attributes_section,
8974         Target::Target_info::attributes_vendor): New fields.
8975         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8976         virtual method definitions.
8977         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8978         attributes_section and attributes_vendor.
8979         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8980
8981 2009-12-05  Doug Kwan  <dougkwan@google.com>
8982
8983         * arm.cc: Update comments about interworking and stub generation.
8984         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8985         considered as non-PIC.
8986         (Arm_relocate_functions::base_abs): Fix formatting.
8987         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8988         of function to use GOT entry address instead of offset.
8989         (Target_arm::Scan::global): Issue an error if a symbol would need a
8990         PLT does not get one because it is untyped.  Remove code to create
8991         dynamic symbols for relative branches.
8992         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8993         takes unsigned integer instead of boolean.
8994
8995 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8996
8997         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8998         (two_file_test_LDADD): Likewise.
8999         (common_test_1_LDADD): Likewise.
9000         (exception_test_LDADD) Likewise.
9001         (weak_test_LDADD): Likewise.
9002         (many_sections_test_LDADD): Likewise.
9003         (initpri1_LDADD): Likewise.
9004         (script_test_1_LDADD): Likewise.
9005         (script_test_2_LDADD): Likewise.
9006         (justsyms_LDADD): Likewise.
9007         (binary_test_LDADD): Likewise.
9008         (large_LDADD): Likewise.
9009         * testsuite/Makefile.in: Regenerated.
9010
9011 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9012
9013         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9014         (Symbol_table::override_with_special): Likewise.
9015         (Symbol_table::add_from_object): Likewise.
9016
9017 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9018
9019         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9020         Don't set the data_offset twice.
9021
9022 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9023
9024         * testsuite/Makefile.in: Regenerate.
9025
9026 2009-12-03  Doug Kwan  <dougkwan@google.com>
9027
9028         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9029         (Target_arm::do_finalize_sections): Add parameter for symbol table
9030         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9031         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9032         parameter for symbol table pointer.
9033         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9034         an additional parameter for a pointer to symbol table.
9035         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9036         parameter for a symbol table pointer.
9037         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9038         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9039         Ditto.
9040         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9041         parameter for a symbol table pointer.
9042
9043 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9044
9045         * incremental.cc (Incremental_inputs_header)
9046         (Incremental_inputs_header_write, Incremental_inputs_entry)
9047         (Incremental_inputs_entry_write): Move ...
9048         * incremental.h (Incremental_inputs_header)
9049         (Incremental_inputs_header_write, Incremental_inputs_entry)
9050         (Incremental_inputs_entry_write): here.
9051
9052 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9053
9054         * incremental.cc (make_sized_incremental_binary): Set the target.
9055         Error if it is incompatible.
9056         * output.h (Output_file): Add filename method.
9057
9058 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9059
9060         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9061         from the get_* methods.
9062
9063 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9064
9065         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9066         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9067         Write 0 for the data_offset of scripts.
9068
9069 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9070
9071         * testsuite/Makefile.am: Add the incremental_test.sh test.
9072         * testsuite/incremental_test.sh: New.
9073         * testsuite/incremental_test_1.c: New.
9074         * testsuite/incremental_test_2.c: New.
9075
9076 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9077
9078         * incremental-dump.cc (main): Fix typos.
9079
9080 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9081
9082         PR gold/11025
9083         * incremental-dump.cc (main): Use llu to print 64 bit values.
9084
9085 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9086             H.J. Lu  <hongjiu.lu@intel.com>
9087
9088         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9089         $(LIBDL).
9090         (incremental_dump_LDADD): Likewise.
9091         * Makefile.in: Regenerated.
9092
9093 2009-11-25  Doug Kwan  <dougkwan@google.com>
9094
9095         Revert:
9096
9097         2009-11-25  Doug Kwan  <dougkwan@google.com>
9098
9099                 * arm.cc (Target_arm::Target_arm): Move method definition
9100                 outside of class definition.  Add code to handle
9101                 --target1-rel, --target1-abs and --target2= options.
9102                 (Target_arm::get_reloc_reloc_type): Change method to be
9103                 non-static and const.
9104                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9105                 New data member declaration.
9106                 (Target_arm::Scan::local, Target_arm::Scan::global,
9107                 Target_arm::Relocate::relocate,
9108                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9109                 Adjust call to Target_arm::get_real_reloc_type.
9110                 (Target_arm::get_real_reloc_type): Use command line options
9111                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9112                 * options.h (--target1-rel, --target1-abs, --target2): New
9113                 ARM-only options.
9114
9115 2009-11-25  Doug Kwan  <dougkwan@google.com>
9116
9117         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9118         class definition.  Add code to handle --target1-rel, --target1-abs
9119         and --target2= options.
9120         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9121         and const.
9122         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9123         member declaration.
9124         (Target_arm::Scan::local, Target_arm::Scan::global,
9125         Target_arm::Relocate::relocate,
9126         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9127         call to Target_arm::get_real_reloc_type.
9128         (Target_arm::get_real_reloc_type): Use command line options to
9129         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9130         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9131         options.
9132
9133 2009-11-25  Doug Kwan  <dougkwan@google.com>
9134
9135         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9136         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9137         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9138         formatting.
9139         (Arm_relocate_functions::thm_call): Replace body with a call to
9140         Arm_relocate_functions::thumb_branch_common.
9141         (Arm_relocate_functions::thm_jump24,
9142         Arm_relocate_functions::thm_xpc22): New method definitions.
9143         (Arm_relocate_functions::thumb_branch_common): New method definition.
9144         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9145         operator.
9146         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9147         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9148
9149 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9150
9151         * Makefile.am: Build incremental-dump
9152         * Makefile.in: Regenerate.
9153         * incremental-dump.cc: New.
9154         * incremental.cc (Incremental_inputs_header_data,
9155         Incremental_inputs_entry_data): Move to incremental.h
9156         * incremental.h: (Incremental_inputs_header_data,
9157         Incremental_inputs_entry_data): Move from incremental.cc
9158
9159 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9160
9161         * incremental.cc (Incremental_inputs_header,
9162         Incremental_inputs_header_write, Incremental_inputs_entry,
9163         Incremental_inputs_entry_write): Add a typedef with the data type.
9164
9165 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9166
9167         * incremental.cc (Incremental_inputs_header,
9168         Incremental_inputs_header_write, Incremental_inputs_entry,
9169         Incremental_inputs_entry_write): Update comment about which
9170         type has the filed descriptions.
9171
9172 2009-11-15  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9175         (Arm_relocate_functions::arm_branch_common): Change method defintion
9176         in class definition to a method declaration and update list of formal
9177         parameters.
9178         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9179         Arm_relocation_functions::jump24): Adjust call to
9180         Arm_relocate_functions::arm_branch_common.  Update list of formal
9181         parameters.
9182         (Arm_relocate_functions::xpc25): New method definition.
9183         (Arm_relocate_functions::arm_branch_common): Move method defintion
9184         out from class definition.  Use stubs for mode-switching and extending
9185         branch ranges.
9186         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9187         specially.  Change code to enable use of stubs in ARM branches.
9188
9189 2009-11-10  Doug Kwan  <dougkwan@google.com>
9190
9191         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9192         in method declaration.
9193         (Target_arm::relocate_stub): New method declaration.
9194         (Target_arm::default_target): Change to return a pointer instead of
9195         a const reference.
9196         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9197         Target_arm::default_target.
9198         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9199         method definition.
9200         (Target_arm::relocate_section): Adjust view.
9201         (Target_arm::relocate_stub): New method definition.
9202
9203 2009-11-10  Doug Kwan  <dougkwan@google.com>
9204
9205         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9206         a format warning.
9207         * incremental.cc (open_incremental_binary): Initialized local
9208         variables to avoid warnings.
9209         * object.cc (make_elf_object): Ditto.
9210         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9211         a format warning.
9212
9213 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9214
9215         PR gold/10930
9216         * testsuite/plugin_test.c: Include "config.h".
9217
9218 2009-11-09  Doug Kwan  <dougkwan@google.com>
9219
9220         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9221         (arm_symbol_value): Remove.
9222         (Arm_relocate_functions::arm_branch_common,
9223         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9224         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9225         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9226         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9227         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9228         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9229         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9230         Arm_relocate_functions::thm_mobw_abs_nc,
9231         Arm_relocate_functions::thm_mov_abs,
9232         Arm_relocate_functions::movw_prel_nc,
9233         Arm_relocate_functions::thm_movt_abs,
9234         Arm_relocate_functions::movt_prel,
9235         Arm_relocate_functions::thm_movw_prel_nc,
9236         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9237         (Target_arm::Relocate::relocate): Only decompose address into two
9238         parts if relocation type uses the thumb-bit and pass the actual
9239         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9240         calls to methods in Arm_relocate_functions for this change.
9241
9242 2009-11-08  Ian Lance Taylor  <iant@google.com>
9243
9244         PR 10925
9245         * reloc.cc: Instantiate
9246         Sized_relobj::initialize_input_to_output_maps and
9247         Sized_relobj:free_input_to_output_maps.
9248
9249 2009-11-06  Ian Lance Taylor  <iant@google.com>
9250
9251         PR 10876
9252         * defstd.cc (in_segment): Set only_if_ref true for "end".
9253
9254 2009-11-06  Doug Kwan  <dougkwan@google.com>
9255
9256         * arm.cc (class Reloc_stub): Correct a comment.
9257         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9258         (Target_arm::scan_section_for_stubs): New method declaration.
9259         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9260         Change methods from private to protected.
9261         (Target_arm::do_may_relax): New method definition.
9262         (Target_arm::do_relax, Target_arm::group_sections,
9263         Target_arm::scan_reloc_for_stub,
9264         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9265         (Target_arm::arm_input_section_map_): New data member declaration.
9266         (Target_arm::scan_reloc_for_stub,
9267         Target_arm::scan_reloc_section_for_stubs,
9268         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9269         Target_arm::do_relax): New method definitions.
9270
9271 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9272
9273         * configure.ac: Check for (struct stat)::st_mtim
9274         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9275         * config.in: Regenerate.
9276         * configure: Regenerate.
9277
9278 2009-11-05  Ian Lance Taylor  <iant@google.com>
9279
9280         PR 10910
9281         * output.cc (Output_segment::add_output_section): Add missing
9282         return statement.
9283
9284 2009-11-04  Ian Lance Taylor  <iant@google.com>
9285
9286         PR 10880
9287         * object.h (class Object): Add is_needed and set_is_needed
9288         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9289         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9290         defined in a dynamic object and referenced by a regular object,
9291         set is_needed for the dynamic object.
9292         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9293         if the file is marked with as_needed and it is not needed.
9294
9295 2009-11-04  Ian Lance Taylor  <iant@google.com>
9296
9297         PR 10887
9298         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9299         tags if data is discarded by linker script.
9300         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9301         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9302         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9303         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9304
9305 2009-11-04  Ian Lance Taylor  <iant@google.com>
9306
9307         * layout.cc (Layout::get_output_section): Add is_interp and
9308         is_dynamic_linker_section parameters.  Change all callers.
9309         (Layout::choose_output_section): Likewise.
9310         (Layout::make_output_section): Likewise.
9311         (Layout::add_output_section_data): Add is_dynamic_linker_section
9312         parameter.  Change all callers.
9313         * layout.h (class Layout): Update declarations.
9314         * output.h (class Output_section): Add is_interp, set_is_interp,
9315         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9316         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9317         generate_code_fills_at_write_ to a bitfield.
9318         * output.cc (Output_section::Output_sections): Initialize new
9319         fields.
9320         (Output_segment::add_output_section): Add do_sort parameter.
9321         Change all callers.
9322
9323 2009-11-03  Ian Lance Taylor  <iant@google.com>
9324
9325         PR 10860
9326         * options.h (class General_options): Add --warn-common.
9327         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9328         merging two common symbols.
9329         (Symbol_table::should_override): Handle --warn-common when merging
9330         a common symbol with a defined symbol.  Use report_resolve_problem
9331         for multiple definitions.
9332         (Symbol_table::report_resolve_problem): New function.
9333         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9334
9335 2009-11-03  Doug Kwan  <dougkwan@google.com>
9336
9337         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9338         stub_factory_.
9339         (Target_arm::stub_factory): New method definition.
9340         (Target_arm::new_arm_input_section,
9341         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9342         Target_arm::reloc_uses_thumb_bit): New method declarations.
9343         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9344         New type definitions.
9345         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9346         member declarations.
9347         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9348         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9349         New method definitions.
9350
9351 2009-11-03  Ian Lance Taylor  <iant@google.com>
9352
9353         * options.h (class General_options): Add --warn_constructors.
9354
9355 2009-11-03  Ian Lance Taylor  <iant@google.com>
9356
9357         PR 10893
9358         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9359         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9360
9361 2009-11-03  Ian Lance Taylor  <iant@google.com>
9362
9363         PR 10895
9364         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9365         --msgid-bugs-address.
9366         (install-pdf): New target.
9367         (install-data_yes): Look up one directory to find mkinstalldirs.
9368
9369 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9370
9371         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9372         tree.
9373
9374 2009-10-30  Doug Kwan  <dougkwan@google.com>
9375
9376         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9377
9378 2009-10-30  Doug Kwan  <dougkwan@google.com>
9379
9380         * arm.cc (Stub_addend_reader): New struct template definition
9381         and partial specializations.
9382         (Stub_addend_reader::operator()): New method definition for a
9383         partially specialized template.
9384
9385 2009-10-30  Doug Kwan  <dougkwan@google.com>
9386
9387         * arm.cc (Arm_relobj::processor_specific_flags): New method
9388         definition.
9389         (Arm_relobj::do_read_symbols): New method declaration.
9390         (Arm_relobj::processor_specific_flags_): New data member declaration.
9391         (Arm_dynobj): New class definition.
9392         (Target_arm::do_finalize_sections): Add input_objects parameter.
9393         (Target_arm::do_adjust_elf_header): New method declaration.
9394         (Target_arm::are_eabi_versions_compatible,
9395         (Target_arm::merge_processor_specific_flags): New method declaration.
9396         (Target_arm::do_make_elf_object): New overloaded method definitions
9397         and declaration.
9398         (Arm_relobj::do_read_symbols): New method definition.
9399         (Arm_dynobj::do_read_symbols): Ditto.
9400         (Target_arm::do_finalize_sections): Add input_objects parameters.
9401         Merge processor-specific flags from all input objects.
9402         (Target_arm::are_eabi_versions_compatible,
9403         Target_arm::merge_processor_specific_flags,
9404         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9405         New method definitions.
9406         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9407         Input_objects pointer type parameter.
9408         * layout.cc (Layout::finalize): Pass input objects to target's.
9409         finalize_sections function.
9410         * output.cc (Output_file_header::do_sized_write): Set ELF file
9411         header's processor-specific flags.
9412         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9413         Input_objects pointer type parameter.
9414         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9415         * target.h (Input_objects): New forward class declaration.
9416         (Target::processor_specific_flags,
9417         Target::are_processor_specific_flags_sect): New method definitions.
9418         (Target::finalize_sections): Add input_objects parameter.
9419         (Target::Target): Initialize processor_specific_flags_ and
9420         are_processor_specific_flags_set_.
9421         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9422         parameter.
9423         (Target::set_processor_specific_flags): New method definition.
9424         (Target::processor_specific_flags_,
9425         Target::are_processor_specific_flags_set_): New data member
9426         declarations.
9427         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9428         Input_objects pointer type parameter.
9429
9430 2009-10-30  Doug Kwan  <dougkwan@google.com>
9431
9432         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9433
9434 2009-10-28  Ian Lance Taylor  <iant@google.com>
9435
9436         * object.h (class Relobj): Drop options parameter from
9437         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9438         do_scan_relocs, do_relocate.  Change all callers.
9439         (class Sized_relobj): Drop options parameters from
9440         do_gc_process_relocs, do_scan_relocs, do_relocate,
9441         do_relocate_sections, relocate_sections, emit_relocs_scan,
9442         emit_relocs_scan_reltype.  Change all callers.
9443         (struct Relocate_info): Remove options field and all references to
9444         it.
9445         * reloc.h (class Read_relocs): Remove options constructor
9446         parameter and options_ field.  Change all callers.
9447         (class Gc_process_relocs, class Scan_relocs): Likewise.
9448         (class Relocate_task): Likewise.
9449         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9450         all callers.
9451         (scan_relocatable_relocs): Likewise.
9452         * target.h (class Sized_target): Remove options parameter from
9453         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9454         all callers.
9455         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9456         callers.
9457         * arm.cc: Update functions to remove options parameters.
9458         * i386.cc: Likewise.
9459         * powerpc.cc: Likewise.
9460         * sparc.cc: Likewise.
9461         * x86_64.cc: Likewise.
9462         * testsuite/testfile.cc: Likewise.
9463
9464 2009-10-28  Doug Kwan  <dougkwan@google.com>
9465
9466         * arm.cc (Arm_relobj): New class definition.
9467         (Arm_relobj::scan_sections_for_stubs,
9468         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9469         New method definitions.
9470
9471 2009-10-28  Cary Coutant  <ccoutant@google.com>
9472
9473         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9474         (Plugin::cleanup_done_): New member.
9475         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9476         (Plugin_manager::cleanup_done_): Remove.
9477         (Plugin_manager::add_input_file): Edit error message.
9478         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9479         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9480
9481 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9482
9483         * fileread.cc: (File_read::View::~View): Use the new
9484         data_ownership_ filed.
9485         (File_read::~File_read): Dispose the new whole_file_view_.
9486         (File_read::open): Mmap the whole file if needed.
9487         (File_read::open): Use whole_file_view_ instead of contents_.
9488         (File_read::find_view): Use whole_file_view_ if applicable.
9489         (File_read::do_read): Use whole_file_view_ instead of contents_.
9490         (File_read::make_view): Use whole_file_view_ instead of contents_,
9491         update File_read::View::View call.
9492         (File_read::find_or_make_view): Update File_read::View::View
9493         call.
9494         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9495         remove contents_
9496         (File_read::View::Data_ownership): New enum.
9497         (File_read::View::View): Replace bool mapped_ with Data_ownership
9498         argument.
9499         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9500         (File_read::View::data_ownership_): New field.
9501         (File_read::contents_): Remove (replaced by whole_file_view_).
9502         (File_read::whole_file_view_): New field.
9503         * options.h (class General_options): Add --keep-files-mapped.
9504
9505 2009-10-27  Cary Coutant  <ccoutant@google.com>
9506
9507         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9508         * testsuite/Makefile.am (plugin_test_5): New test case.
9509         * testsuite/Makefile.in: Regenerate.
9510
9511 2009-10-25  Doug Kwan  <dougkwan@google.com>
9512
9513         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9514         from private to protected to allow access by child class.
9515         (Sized_relobj::do_relocate_sections): New method declaration.
9516         (Sized_relobj::relocate_sections): Virtualize.
9517         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9518         Sized_relobj::relocate_sections.  Instantiate template explicitly
9519         for different target sizes and endianity.
9520
9521 2009-10-24  Doug Kwan  <dougkwan@google.com>
9522
9523         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9524         (Arm_input_section::as_arm_input_section): New method.
9525         (Arm_output_section): New class definition.
9526         (Arm_output_section::create_stub_group,
9527         Arm_output_section::group_sections): New method definitions.
9528
9529 2009-10-22  Doug Kwan  <dougkwan@google.com>
9530
9531         * arm.cc (Arm_input_section): New class definition.
9532         (Arm_input_section::init, Arm_input_section:do_write,
9533         Arm_input_section::set_final_data_size,
9534         Arm_input_section::do_reset_address_and_file_offset): New method
9535         definitions.
9536
9537 2009-10-21  Doug Kwan  <dougkwan@google.com>
9538
9539         * arm.cc (Stub_table, Arm_input_section): New forward class
9540         declarations.
9541         (Stub_table): New class defintion.
9542         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9543         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9544         New method definition.
9545
9546 2009-10-21  Doug Kwan  <dougkwan@google.com>
9547
9548         * arm.cc: Update copyright comments.
9549         (Target_arm): New forward class template declaration.
9550         (Arm_address): New type.
9551         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9552         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9553         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9554         constants.
9555         (Insn_template): Same.
9556         (DEF_STUBS): New macro.
9557         (Stub_type): New enum type.
9558         (Stub_template): New class definition.
9559         (Stub): Same.
9560         (Reloc_stub): Same.
9561         (Stub_factory): Same.
9562         (Target_arm::Target_arm): Initialize may_use_blx_ and
9563         should_force_pic_veneer_.
9564         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9565         Target_arm::should_force_pic_veneer,
9566         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9567         Target_arm::using_thumb_only, Target_arm:;default_target): New
9568         method defintions.
9569         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9570         New data member declarations.
9571         (Insn_template::size, Insn_template::alignment): New method defintions.
9572         (Stub_template::Stub_template): New method definition.
9573         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9574         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9575         (Stub_factory::Stub_factory): New method definition.
9576         * gold.h (string_hash): New template.
9577         * output.h (Input_section_specifier::hash_value): Use
9578         gold::string_hash.
9579         (Input_section_specifier::string_hash): Remove.
9580         * stringpool.cc (Stringpool_template::string_hash): Use
9581         gold::string_hash.
9582
9583 2009-10-20  Doug Kwan  <dougkwan@google.com>
9584
9585         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9586         symbols of relaxed input sections.
9587         * output.h (Output_section::find_relaxed_input_section): Make
9588         method public.
9589
9590 2009-10-16  Doug Kwan  <dougkwan@google.com>
9591
9592         * dynobj.cc (Versions::Versions): Initialize version_script_.
9593         Only insert base version symbol definition for a shared object
9594         if version script defines any version versions.
9595         (Versions::define_base_version): New method definition.
9596         (Versions::add_def): Check that base version is not needed.
9597         (Versions::add_need): Define base version lazily.
9598         * dynobj.h (Versions::define_base_version): New method declaration.
9599         (Versions::needs_base_version_): New data member declaration.
9600         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9601         (check_DATA): Add no_version_test.stdout.
9602         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9603         New make rules.
9604         * testsuite/Makefile.in: Regenerate.
9605         * testsuite/no_version_test.c: New file.
9606         * testsuite/no_version_test.sh: Ditto.
9607
9608 2009-10-16  Doug Kwan  <dougkwan@google.com>
9609
9610         * expression.cc (class Segment_start_expression): New class definition.
9611         (Segment_start_expression::value): New method definition.
9612         (script_exp_function_segment_start): Return a new
9613         Segment_start_expression.
9614         * gold/script-c.h (script_saw_segment_start_expression): New function
9615         prototype.
9616         * script-sections.cc (Script_sections::Script_sections): Initialize
9617         SAW_SEGMENT_START_EXPRESSION_ to false.
9618         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9619         and -Tbbs options to specify section addresses if given in
9620         command line and no SEGMENT_START expression is seen in a script.
9621         * script-sections.h (Script_sections::saw_segment_start_expression,
9622         Script_sections::set_saw_segment_start_expression): New method
9623         definition.
9624         (Script_sections::saw_segment_start_expression_): New data member
9625         declaration.
9626         * script.cc (script_saw_segment_start_expression): New function.
9627         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9628         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9629         script_test_7.sh and script_test_8.sh.
9630         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9631         script_test_8.stdout.
9632         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9633         (script_test_6, script_test_6.stdout, script_test_7,
9634         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9635         * Makefile.in: Regenerate.
9636         * testsuite/script_test_6.sh: New file.
9637         * testsuite/script_test_6.t: Same.
9638         * testsuite/script_test_7.sh: Same.
9639         * testsuite/script_test_7.t: Same.
9640         * testsuite/script_test_8.sh: Same.
9641
9642 2009-10-16  Doug Kwan  <dougkwan@google.com>
9643
9644         * output.cc (Output_segment::set_section_list_address): Cast
9645         expressions to unsigned long long type to avoid format warnings.
9646
9647 2009-10-15  Ian Lance Taylor  <iant@google.com>
9648
9649         * script.cc (Script_options::add_symbol_assignment): Always add a
9650         dot assignment to script_sections_.
9651         * script-sections.cc (Script_sections::add_dot_assignment):
9652         Initialize if necessary.
9653
9654         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9655         program headers with no load segment if there is a linker script.
9656
9657         * layout.cc (Layout::set_segment_offsets): Align the file offset
9658         to the segment aligment for -N or -n with no load segment.
9659         * output.cc (Output_segment::add_output_section): Don't crash if
9660         the first section is a TLS section.
9661         (Output_segment::set_section_list_addresses): Print an error
9662         message if the address moves backward in a linker script.
9663         * script-sections.cc
9664         (Output_section_element_input::set_section_addresses): Don't
9665         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9666         (Orphan_output_section::set_section_addresses): Likewise.
9667
9668 2009-10-15  Doug Kwan  <dougkwan@google.com>
9669
9670         * layout.cc (Layout::finish_dynamic_section): Generate tags
9671         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9672         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9673         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9674
9675 2009-10-14  Ian Lance Taylor  <iant@google.com>
9676
9677         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9678         fields.
9679         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9680         data_shdr fields of relinfo.
9681         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9682         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9683         R_386_TLS_LDO_32, adjust based on section flags.
9684         (Target_i386::Relocate::fix_up_ldo): Remove.
9685
9686 2009-10-13  Ian Lance Taylor  <iant@google.com>
9687
9688         Add support for -pie.
9689         * options.h (class General_options): Add -pie and
9690         --pic-executable.
9691         (General_options::output_is_position_independent): Test -pie.
9692         (General_options::output_is_executable): Return true if not shared
9693         and not relocatable.
9694         (General_options::output_is_pie): Remove.
9695         * options.cc (General_options::finalize): Reject incompatible uses
9696         of -pie.
9697         * gold.cc (queue_middle_tasks): A -pie link is not static.
9698         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9699         * symtab.cc (Symbol::final_value_is_known): Return false if
9700         output_is_position_independent.
9701         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9702         output_is_position_independent.
9703         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9704         output_is_position_independent.
9705         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9706         output_is_position_independent.
9707         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9708         two_file_pie_test.
9709         (basic_pie_test.o, basic_pie_test): New targets.
9710         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9711         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9712         (two_file_pie_test): New target.
9713         * testsuite/Makefile.in: Rebuild.
9714         * README: Remove note saying that -pie is not supported.
9715
9716 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9717
9718         * options.h (class General_options): Add -init and -fini.
9719         * layout.cc (Layout::finish_dynamic_section): Emit
9720         given init and fini functions.
9721
9722 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9723
9724         * gc.h (gc_process_relocs): Check if icf is enabled using new
9725         function.
9726         * gold.cc (queue_initial_tasks): Likewise.
9727         (queue_middle_tasks): Likewise.
9728         * object.cc (do_layout): Likewise.
9729         * symtab.cc (is_section_folded): Likewise.
9730         * main.cc (main): Likewise.
9731         * reloc.cc (Read_relocs::run): Likewise.
9732         (Sized_relobj::do_scan_relocs): Likewise.
9733         * icf.cc (is_function_ctor_or_dtor): New function.
9734         (Icf::find_identical_sections): Check if function is ctor or dtor when
9735         safe icf is chosen.
9736         * options.h (General_options::icf): Change option to be an enum.
9737         (Icf_status): New enum.
9738         (icf_enabled): New method.
9739         (icf_safe_folding): New method.
9740         (set_icf_status): New method.
9741         (icf_status_): New variable.
9742         * (options.cc) (General_options::finalize): Set icf_status_.
9743         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9744         icf_test and icf_keep_unique_test to use the --icf enum flag.
9745         * testsuite/icf_safe_test.sh: New file.
9746         * testsuite/icf_safe_test.cc: New file.
9747
9748 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9749
9750         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9751         includes to gc.h and icf.h.
9752         * arm.cc: Include gc.h.
9753         * gold.cc: Likewise.
9754         * i386.cc: Likewise.
9755         * powerpc.cc: Likewise.
9756         * sparc.cc: Likewise.
9757         * x86_64.cc: Likewise.
9758         * gc.h: Include icf.h.
9759
9760 2009-10-11  Ian Lance Taylor  <iant@google.com>
9761
9762         * plugin.cc: Include "gold.h" before other header files.
9763
9764 2009-10-10  Chris Demetriou  <cgd@google.com>
9765
9766         * options.h (Input_file_argument::Input_file_type): New enum.
9767         (Input_file_argument::is_lib_): Replace with...
9768         (Input_file_argument::type_): New member.
9769         (Input_file_argument::Input_file_argument): Take Input_file_type
9770         'type' rather than boolean 'is_lib' as second argument.
9771         (Input_file_argument::is_lib): Use type_.
9772         (Input_file_argument::is_searched_file): New function.
9773         (Input_file_argument::may_need_search): Handle is_searched_file.
9774         * options.cc (General_options::parse_library): Support -l:filename.
9775         (General_options::parse_just_symbols): Update for Input_file_argument
9776         changes.
9777         (Command_line::process): Likewise.
9778         * archive.cc (Archive::get_file_and_offset): Likewise.
9779         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9780         * script.cc (read_script_file, script_add_file): Likewise.
9781         * fileread.cc (Input_file::Input_file): Likewise.
9782         (Input_file::will_search_for): Handle is_searched_file.
9783         (Input_file::open): Likewise.
9784         * readsyms.cc (Read_symbols::get_name): Likewise.
9785         * testsuite/Makefile.am (searched_file_test): New test.
9786         * testsuite/Makefile.in: Regenerate.
9787         * testsuite/searched_file_test.cc: New file.
9788         * testsuite/searched_file_test_lib.cc: New file.
9789
9790 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9791             Ian Lance Taylor  <iant@google.com>
9792
9793         * descriptor.cc: Include <cstdio> and "binary-io.h".
9794         (Descriptors::open): Open the files in binary mode always.
9795         * script.cc (Lex::get_token): Treat \r as whitespace.
9796
9797 2009-10-09  Ian Lance Taylor  <iant@google.com>
9798
9799         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9800
9801 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9802             Ian Lance Taylor  <iant@google.com>
9803
9804         * configure.ac: Check for readv function also.
9805         * fileread.cc (readv): Define if not HAVE_READV.
9806         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9807         does not exist.
9808         * config.in: Regenerate.
9809         * configure: Regenerate.
9810
9811 2009-10-09  Doug Kwan  <dougkwan@google.com>
9812
9813         * layout.cc (Layout::make_output_section): Call target hook to make
9814         ordinary output section.
9815         (Layout::finalize): Adjust parameter list of call the
9816         Target::may_relax().
9817         * layout.h (class Layout::section_list): New method.
9818         * merge.h (Output_merge_base::entsize): Change visibility to public.
9819         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9820         New methods.
9821         (Output_merge_string::do_is_string): New method.
9822         * object.cc (Sized_relobj::do_setup): renamed from
9823         Sized_relobj::set_up.
9824         * object.h (Sized_relobj::adjust_shndx,
9825         Sized_relobj::initializ_input_to_output_maps,
9826         Sized_relobj::free_input_to_output_maps): Change visibilities to
9827         protected.
9828         (Sized_relobj::setup): Virtualize.
9829         (Sized_relobj::do_setup): New method declaration.
9830         (Sized_relobj::invalidate_section_offset,
9831         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9832         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9833         * options.cc (parse_int): New function.
9834         * options.h (parse_int): New declaration.
9835         (DEFINE_int): New macro.
9836         (stub_group_size): New option.
9837         * output.cc (Output_section::Output_section): Initialize memebers
9838         merge_section_map_, merge_section_by_properties_map_,
9839         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9840         (Output_section::add_input_section): Handled deferred code-fill
9841         generation and remove an old comment.
9842         (Output_section::add_relaxed_input_section): New method definition.
9843         (Output_section::add_merge_input_section): Use merge section by
9844         properties map to speed to search.  Update merge section maps
9845         as appropriate.
9846         (Output_section::build_relaxation_map): New method definition.
9847         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9848         Same.
9849         (Output_section::relax_input_section): Renamed to
9850         Output_section::convert_input_sections_to_relaxed_sections and change
9851         interface to take a vector of pointers to relaxed sections.
9852         (Output_section::find_merge_section,
9853         Output_section::find_relaxed_input_section): New method definitions.
9854         (Output_section::is_input_address_mapped,
9855         Output_section::output_offset, Output_section::output_address):
9856         Use output section data maps to speed up searching.
9857         (Output_section::find_starting_output_address): Add comments.
9858         (Output_section::do_write,
9859         Output_section::write_to_postprocessing_buffer): Do code-fill
9860         generation as appropriate.
9861         (Output_section::get_input_sections): Invalidate relaxed input section
9862         map.
9863         (Output_section::restore_states): Adjust type of checkpoint .
9864         Invalidate relaxed input section map.
9865         * output.h (Output_merge_base): New class declaration.
9866         (Input_section_specifier): New class defintion.
9867         (class Output_relaxed_input_section) Change base class to
9868         Output_section_data_build.
9869         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9870         base class initializer.
9871         (Output_section::add_relaxed_input_section): New method declaration.
9872         (Output_section::Input_section): Change visibility to protected.
9873         (Output_section::Input_section::relobj,
9874         Output_section::Input_section::shndx): Handle relaxed input sections.
9875         Output_section::input_sections) Change visibility to protected.  Also
9876         define overload to return a non-const pointer.
9877         (Output_section::Merge_section_properties): New class defintion.
9878         (Output_section::Merge_section_by_properties_map,
9879         Output_section::Output_section_data_by_input_section_map,
9880         Output_section::Relaxation_map): New types.
9881         (Output_section::relax_input_section): Rename method to
9882         Output_section::convert_input_sections_to_relaxed_sections and change
9883         interface to take a vector of relaxed section pointers.
9884         (Output_section::find_merge_section,
9885         Output_section::find_relaxed_input_section,
9886         Output_section::build_relaxation_map,
9887         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9888         New method declarations.
9889         (Output_section::merge_section_map_
9890         Output_section::merge_section_by_properties_map_,
9891         Output_section::relaxed_input_section_map_,
9892         Output_section::is_relaxed_input_section_map_valid_,
9893         Output_section::generate_code_fills_at_write_): New data members.
9894         * script-sections.cc
9895         (Output_section_element_input::set_section_addresses): Call
9896         current_data_size and addralign methods of relaxed input sections.
9897         (Orphan_output_section::set_section_addresses): Call current_data_size
9898         and addralign methods of relaxed input sections.
9899         * symtab.cc (Symbol_table::compute_final_value): Extract template
9900         from the body of Symbol_table::sized_finalize_symbol.
9901         (Symbol_table::sized_finalized_symbol): Call
9902         Symbol_table::compute_final_value.
9903         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9904         (Symbol_table::compute_final_value): New templated method declaration.
9905         * target.cc (Target::do_make_output_section): New method defintion.
9906         * target.h (Target::make_output_section): New method declaration.
9907         (Target::relax): Add more parameters for input objects, symbol table
9908         and layout.  Adjust call to do_relax.
9909         (Target::do_make_output_section): New method declaration.
9910         (Target::do_relax): Add parameters for input objects, symbol table
9911         and layout.
9912
9913 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9914
9915         * pread.c: Include stdio.h.
9916
9917 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9918
9919         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9920         defined.
9921
9922 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9923
9924         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9925         Change read_shndx type to unsigned int.
9926         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9927         int.
9928         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9929         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9930         Change read_shndx type to unsigned int.
9931         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9932         int.
9933         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9934         * layout.cc (Layout::create_symtab_sections): Cast the result of
9935         local_symcount * symsize to off_t in the gold_assert.
9936
9937 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9938
9939         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9940         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9941         R_ARM_BASE_ABS.
9942         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9943         (Arm_relocate_functions::thm_abs5): New function.
9944         (Arm_relocate_functions::abs12): New function.
9945         (Arm_relocate_functions::abs16): New function.
9946         (Arm_relocate_functions::base_abs): New function.
9947         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9948         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9949         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9950         R_ARM_BASE_ABS.
9951         (Scan::global): Likewise.
9952         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9953         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9954         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9955         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9956         R_ARM_BASE_ABS.
9957
9958 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9959
9960         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9961         (Arm_relocate_functions::movt_prel): New function.
9962         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9963         (Arm_relocate_functions::thm_movt_prel): New function.
9964         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9965         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9966         (Scan::global, Relocate::relocate): Likewise.
9967         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9968
9969 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9970
9971         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9972         Incremental_checker.
9973         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9974         unsigned int.
9975         (class Incremental_inputs_header): New class.
9976         (Incremental_inputs_header_writer): Edit comment.
9977         (Incremental_inputs_entry): New class.
9978         (Incremental_inputs_entry_writer): Edit comment.
9979         (Sized_incremental_binary::do_find_incremental_inputs_section):
9980         Add *strtab_shndx parameter, fill it.
9981         (Sized_incremental_binary::do_check_inputs): New method.
9982         (Incremental_checker::can_incrementally_link_output_file): Use
9983         Sized_incremental_binary::check_inputs.
9984         (Incremental_inputs::report_command_line): Save command line in
9985         command_line_.
9986         * incremental.h:
9987         (Incremental_binary::find_incremental_inputs_section): New
9988         method.
9989         (Incremental_binary::do_find_incremental_inputs_section): Add
9990         strtab_shndx parameter.
9991         (Incremental_binary::do_check_inputs): New pure virtual method.
9992         (Sized_incremental_binary::do_check_inputs): Declare.
9993         (Incremental_checker::Incremental_checker): Add incremental_inputs
9994         parameter, use it to initialize incremental_inputs_.
9995         (Incremental_checker::incremental_inputs_): New field.
9996         (Incremental_checker::command_line): New method.
9997         (Incremental_checker::inputs): New method.
9998         (Incremental_checker::command_line_): New field.
9999
10000 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10001
10002         * incremental.cc: Include <cstdarg> and "target-select.h".
10003         (vexplain_no_incremental): New function.
10004         (explain_no_incremental): New function.
10005         (Incremental_binary::error): New method.
10006         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10007         method.
10008         (make_sized_incremental_binary): New function.
10009         (open_incremental_binary): New function.
10010         (can_incrementally_link_file): Add checks if output is ELF and has
10011         inputs section.
10012         * incremental.h: Include "elfcpp_file.h" and "output.h".
10013         (Incremental_binary): New class.
10014         (Sized_incremental_binary): New class.
10015         (open_incremental_binary): Declare.
10016         * object.cc (is_elf_object): Use
10017         elfcpp::Elf_recognizer::is_elf_file.
10018         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10019         * output.h (Output_file::filesize): New method.
10020
10021 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10022
10023         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10024         New function.
10025         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10026         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10027         function.
10028         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10029         function.
10030         (Arm_relocate_functions::movw_abs_nc): New function.
10031         (Arm_relocate_functions::movt_abs): New function.
10032         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10033         (Arm_relocate_functions::thm_movt_abs): New function.
10034         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10035         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10036         (Scan::global): Likewise.
10037         (Relocate::relocate): Likewise.
10038         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10039
10040 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10041
10042         * arm.cc (Arm_relocate_functions::got_prel) New function.
10043         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10044         (Relocate::relocate): Likewise.
10045         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10046
10047 2009-10-06  Ian Lance Taylor  <iant@google.com>
10048
10049         * options.h (class General_options): Define
10050         split_stack_adjust_size parameter.
10051         * object.h (class Object): Add uses_split_stack_ and
10052         has_no_split_stack_ fields.  Add uses_split_stack and
10053         has_no_split_stack accessor functions.  Declare
10054         handle_split_stack_section.
10055         (class Reloc_symbol_changes): Define.
10056         (class Sized_relobj): Define Function_offsets.  Declare
10057         split_stack_adjust, split_stack_adjust_reltype, and
10058         find_functions.
10059         * object.cc (Object::handle_split_stack_section): New function.
10060         (Sized_relobj::do_layout): Call handle_split_stack_section.
10061         * dynobj.cc (Sized_dynobj::do_layout): Call
10062         handle_split_stack_section.
10063         * reloc.cc (Sized_relobj::relocate_sections): Call
10064         split_stack_adjust for executable sections in split_stack
10065         objects.  Pass reloc_map to relocate_section.
10066         (Sized_relobj::split_stack_adjust): New function.
10067         (Sized_relobj::split_stack_adjust_reltype): New function.
10068         (Sized_relobj::find_functions): New function.
10069         * target-reloc.h: Include "object.h".
10070         (relocate_section): Add reloc_symbol_changes parameter.  Change
10071         all callers.
10072         * target.h (class Target): Add calls_non_split method.  Declare
10073         do_calls_non_split virtual method.  Declare match_view and
10074         set_view_to_nop.
10075         * target.cc: Include "elfcpp.h".
10076         (Target::do_calls_non_split): New function.
10077         (Target::match_view): New function.
10078         (Target::set_view_to_nop): New function.
10079         * gold.cc (queue_middle_tasks): Give an error if mixing
10080         split-stack and non-split-stack objects with -r.
10081         * i386.cc (Target_i386::relocate_section): Add
10082         reloc_symbol_changes parameter.
10083         (Target_i386::do_calls_non_split): New function.
10084         * x86_64.cc (Target_x86_64::relocate_section): Add
10085         reloc_symbol_changes parameter.
10086         (Target_x86_64::do_calls_non_split): New function.
10087         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10088         parameter.
10089         * powerpc.cc (Target_powerpc::relocate_section): Add
10090         reloc_symbol_changes parameter.
10091         * sparc.cc (Target_sparc::relocate_section): Add
10092         reloc_symbol_changes parameter.
10093         * configure.ac: Call AM_CONDITIONAL for the default target.
10094         * configure: Rebuild.
10095         * testsuite/Makefile.am (TEST_AS): New variable.
10096         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10097         (check_DATA): Add split_i386 and split_x86_64 files.
10098         (SPLIT_DEFSYMS): Define.
10099         (split_i386_[1234n].o): New targets.
10100         (split_i386_[124]): New targets.
10101         (split_i386_[1234r].stdout): New targets.
10102         (split_x86_64_[1234n].o): New targets.
10103         (split_x86_64_[124]): New targets.
10104         (split_x86_64_[1234r].stdout): New targets.
10105         (MOSTLYCLEANFILES): Add new executables.
10106         * testsuite/split_i386.sh: New file.
10107         * testsuite/split_x86_64.sh: New file.
10108         * testsuite/split_i386_1.s: New file.
10109         * testsuite/split_i386_2.s: New file.
10110         * testsuite/split_i386_3.s: New file.
10111         * testsuite/split_i386_4.s: New file.
10112         * testsuite/split_i386_n.s: New file.
10113         * testsuite/split_x86_64_1.s: New file.
10114         * testsuite/split_x86_64_2.s: New file.
10115         * testsuite/split_x86_64_3.s: New file.
10116         * testsuite/split_x86_64_4.s: New file.
10117         * testsuite/split_x86_64_n.s: New file.
10118         * testsuite/testfile.cc (Target_test): Update relocation_section
10119         function.
10120         * testsuite/Makefile.in: Rebuild.
10121
10122 2009-10-06  Ian Lance Taylor  <iant@google.com>
10123
10124         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10125         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10126         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10127         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10128         the address on ldo_addrs_.
10129         (Target_i386::Relocate::fix_up_ldo): New function.
10130
10131 2009-10-06   Rafael Espindola  <espindola@google.com>
10132
10133         * plugin.cc (add_input_library): New.
10134         (Plugin::load): Add add_input_library to tv.
10135         (Plugin_manager::add_input_file): Add the is_lib argument.
10136         (add_input_file): Update call to Plugin_manager::add_input_file.
10137         (add_input_library): New.
10138         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10139
10140 2009-09-30  Doug Kwan  <dougkwan@google.com>
10141
10142         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10143         symbol and call Symbol::may_need_copy_reloc to determine if
10144         a copy reloc is needed.
10145         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10146         nocopyreloc is given in command line.
10147         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10148         given in command line.
10149         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10150         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10151         of the removed Target_i386::may_need_copy_reloc.
10152         * options.h (copyreloc): New option with default value false.
10153         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10154         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10155         instead of the removed Target_powerpc::may_need_copy_reloc.
10156         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10157         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10158         instead of the removed Target_sparc::may_need_copy_reloc.
10159         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10160         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10161         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10162         instead of the removed Target_x86_64::may_need_copy_reloc.
10163
10164 2009-09-30  Ian Lance Taylor  <iant@google.com>
10165
10166         * object.h (class Object): Remove target_ field, and target,
10167         sized_target, and set_target methods.
10168         (Object::sized_target): Remove.
10169         (class Sized_relobj): Update declarations.  Remove sized_target.
10170         * object.cc (Sized_relobj::setup): Remove target parameter.
10171         Change all callers.
10172         (Input_objects::add_object): Don't do anything with the target.
10173         (make_elf_sized_object): Add punconfigured parameter.  Change all
10174         callers.  Set or test parameter target.
10175         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10176         Change all callers.
10177         * parameters.cc (Parameters::set_target): Change parameter type to
10178         be non-const.
10179         (Parameters::default_target): Remove.
10180         (set_parameters_target): Change parameter type to be non-const.
10181         (parameters_force_valid_target): New function.
10182         (parameters_clear_target): New function.
10183         * parameters.h (class Parameters): Update declarations.  Remove
10184         default_target method.  Add sized_target and clear_target
10185         methods.  Change target_ to be non-const.
10186         (set_parameters_target): Update declaration.
10187         (parameters_force_valid_target): Declare.
10188         (parameters_clear_target): Declare.
10189         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10190         as NULL if we aren't searching.
10191         (Add_symbols::run): Don't check for compatible target.
10192         * fileread.cc (Input_file::open_binary): Call
10193         parameters_force_valid_target.
10194         * gold.cc (queue_middle_tasks): Likewise.
10195         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10196         set_target on object.
10197         * dynobj.h (class Sized_dynobj): Update declarations.
10198         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10199         make_elf_object returns NULL.
10200         (Archive::include_member): Don't check whether object target is
10201         compatible.
10202         * output.cc (Output_section::add_input_section): Get target from
10203         parameters.
10204         (Output_section::relax_input_section): Likewise.
10205         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10206         parameters.
10207         (Sized_relobj::do_scan_relocs): Likewise.
10208         (Sized_relobj::relocate_sections): Likewise.
10209         * resolve.cc (Symbol_table::resolve): Likewise.
10210         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10211         parameter.  Change all callers.
10212         (Symbol_table::add_from_object): Get target from parameters.
10213         (Symbol_table::add_from_relobj): Don't check object target.
10214         (Symbol_table::add_from_dynobj): Likewise.
10215         (Symbol_table::define_special_symbol): Get target from
10216         parameters.
10217         * symtab.h (class Symbol_table): Update declaration.
10218         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10219         parameter.  Change all callers.  Clear parameter target.
10220         (Binary_test): Test target here.
10221         * testsuite/object_unittest.cc (gold_testsuite): Remove
10222         target_test_pointer parameter.  Change all callers.
10223         (Object_test): Test target here.
10224
10225 2009-09-26  Ian Lance Taylor  <iant@google.com>
10226
10227         * testsuite/initpri1.c: Don't try to use constructor priorities if
10228         compiling with gcc before 4.3.
10229
10230 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10231
10232         * testsuite/retain_symbols_file_test.sh (check_present): Change
10233         output file name to retain_symbols_file_test.stdout.
10234         (check_absent): Likewise.
10235
10236 2009-09-18  Craig Silverstein  <csilvers@google.com>
10237
10238         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10239         * options.cc: Include <cerrno> and <fstream>.
10240         (General_options::finalize): Parse -retain-symbols-file tag.
10241         * options.h: New flag.
10242         (General_options): New method should_retain_symbol, new
10243         variable symbols_to_retain.
10244         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10245         should_retain_symbol map.
10246         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10247         * testsuite/Makefile.in: Regenerate.
10248         * testsuite/retain_symbols_file_test.sh: New file.
10249
10250 2009-09-18  Nick Clifton  <nickc@redhat.com>
10251
10252         * po/es.po: Updated Spanish translation.
10253
10254 2009-09-17  Doug Kwan  <dougkwan@google.com>
10255
10256         * debug.h (DEBUG_RELAXATION): New constant.
10257         (DEBUG_ALL): Add DEBUG_RELAXATION.
10258         (debug_string_to_enum): Add relaxation debug option.
10259         * layout.cc
10260         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10261         Layout::Relaxation_debug_check::read_sections,
10262         Layout::Relaxation_debug_check::read_sections): New method definitions.
10263         (Layout::Layout): Initialize data members
10264         record_output_section_data_from_scrips_,
10265         script_output_section_data_list_ and relaxation_debug_check_.
10266         (Layout::save_segments, Layout::restore_segments,
10267         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10268         Layout::relaxation_loop_body): New method definitions.
10269         (Layout::finalize): Support relaxation.  Move section layout code to
10270         Layout::relaxation_loop_body.
10271         (Layout::set_asection_address_from_script): Move code for orphan
10272         section placement out.
10273         (Layout::place_orphan_sections_in_script): New method definition.
10274         * layout.h (Output_segment_headers, Output_file_header):
10275         New forward class declarations.
10276         (Layout::~Layout): Define.
10277         (Layout::new_output_section_data_from_script): New method definition.
10278         (Layout::place_orphan_sections_in_script): New method declaration.
10279         (Layout::Segment_states): New type declaration.
10280         (Layout::save_segments, Layout::restore_segments,
10281         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10282         Layout::relaxation_loop_body): New method declarations.
10283         (Layout::Output_section_data_list): New type declaration.
10284         (Layout::Relaxation_debug_check): New class definition.
10285         (Layout::record_output_section_data_from_script_,
10286         Layout::script_output_section_data_list_, Layout::segment_states_,
10287         Layout::relaxation_debug_check_): New data members.
10288         * output.cc: (Output_section_headers::do_size): New method definition.
10289         (Output_section_headers::Output_section_headers): Move size
10290         computation to Output_section_headers::do_size.
10291         (Output_segment_headers::do_size): New method definition.
10292         (Output_file_header::Output_file_header): Move size computation to
10293         Output_file_header::do_size and call it.
10294         (Output_file_header::do_size): New method definition.
10295         (Output_data_group::Output_data_group): Adjust call to
10296         Output_section_data.
10297         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10298         (Output_symtab_xindex::do_write): Add array bound check.
10299         (Output_section::Input_section::print_to_mapfile): Handle
10300         RELAXED_INPUT_SECTION_CODE.
10301         (Output_section::Output_section): Initialize data member checkpoint_.
10302         (Output_section::~Output_section): Delete checkpoint object pointed
10303         by checkpoint_.
10304         (Output_section::add_input_section): Always add an Input_section if
10305         relaxing.
10306         (Output_section::add_merge_input_section): Add assert.
10307         (Output_section::relax_input_section): New method definition.
10308         (Output_section::set_final_data_size): Set load address to zero for
10309         an unallocated section.
10310         (Output_section::do_address_and_file_offset_have_reset_values):
10311         New method definition.
10312         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10313         Handle relaxed input section.
10314         (Output_section::sort_attached_input_sections): Checkpoint input
10315         section list lazily.
10316         (Output_section::get_input_sections): Change type of input_sections to
10317         list of Simple_input_section pointers.  Checkpoint input section list
10318         lazily.  Also handle relaxed input sections.
10319         (Output_section::add_input_section_for_script): Take a reference to
10320         a Simple_input_section object instead of Relobj pointer and section
10321         index as parameter.  Handle relaxed input sections.
10322         (Output_section::save_states, Output_section::restore_states): New
10323         method definitions.
10324         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10325         (Output_data::is_data_size_fixed): New method definition.
10326         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10327         if it is fixed.
10328         (Output_data::address_and_file_offset_have_reset_values): New method
10329         definition.
10330         (Output_data::do_address_and_file_offset_have_reset_values): New method
10331         definition.
10332         (Output_data::set_data_size): Check that data size is not fixed.
10333         (Output_data::fix_data_size): New method definition.
10334         (Output_data::is_data_size_fixed_): New data member.
10335         (Output_section_headers::set_final_data_size): New method definition.
10336         (Output_section_headers::do_size): New method declaration.
10337         (Output_segment_headers::set_final_data_size): New method definition.
10338         (Output_segment_headers::do_size): New method declaration.
10339         (Output_file_header::set_final_data_size)::New method definition.
10340         (Output_file_header::do_size)::New method declaration.
10341         (Output_section_data::Output_section_data): Add new parameter
10342         is_data_size_fixed and use it to fix data size.
10343         (Output_data_const::Output_data_const): Adjust call to base class
10344         constructor and fix data size.
10345         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10346         base class constructor and fix data size.
10347         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10348         base class constructor and fix data size.
10349         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10350         class constructor and fix data size.
10351         (Output_data_group::set_final_data_size): New method definition.
10352         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10353         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10354         class constructor and fix data size.
10355         (Output_relaxed_input_section): New class definition.
10356         (Output_section::Simple_input_section): New class definition.
10357         (Output_section::get_input_sections): Adjust parameter list.
10358         (Output_section::add_input_section_for_script): Same.
10359         (Output_section::save_states, Output_section::restore_states,
10360         Output_section::do_address_and_file_offset_have_reset_values,
10361         (Output_section::Input_section::Input_section): Handle
10362         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10363         Output_relaxed_input_section.
10364         (Output_section::Input_section::is_input_section,
10365         Output_section::Input_section::set_output_section): Handle relaxed
10366         input section.
10367         (Output_section::Input_section::is_relaxed_input_section,
10368         Output_section::Input_section::output_section_data,
10369         Output_section::Input_section::relaxed_input_section): New method
10370         definitions.
10371         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10372         value.
10373         (Output_section::Input_section::u1_): Update comments.
10374         (Output_section::Input_section::u2_): Add new union member poris.
10375         (Output_section::Checkpoint_output_section): New classs definition.
10376         (Output_section::relax_input_section): New method declaration.
10377         (Output_section::checkpoint_): New data member.
10378         (Output_segment): Update comments.
10379         (Output_segment::Output_segment): Un-privatize copy constructor.
10380         (Output_segment::operator=): Un-privatize.
10381         * script-sections.cc (Output_section_element::Input_section_list):
10382         Change element type to Output_section::Simple_input_section.
10383         (Output_section_element_dot_assignment::set_section_addresses):
10384         Register output section data for relaxation clean up.
10385         (Output_data_exression::Output_data_expression): Adjust call to base
10386         constructor to fix data size.
10387         (Output_section_element_data::set_section_addresses): Register
10388         Output_data_expression object for relaxation clean up.
10389         (struct Input_section_info): Replace Relobj pointer and section index
10390         pair with Output_section::Simple_input_section and Convert struct to a
10391         class.
10392         (Input_section_sorter::operator()): Adjust access to
10393         Input_section_info data member to use accessors.
10394         (Output_section_element_input::set_section_addresses): Use layout
10395         parameter.  Adjust code to use Output_section::Simple_input_section
10396         and Input_secction_info classes.  Register filler for relaxation
10397         clean up.
10398         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10399         and section index pair with Output_section::Simple_input_section
10400         class.  Adjust code accordingly.
10401         (Phdrs_element::release_segment): New method definition.
10402         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10403         segment list.
10404         (Script_sections::release_segments): New method definition.
10405         * gold/script-sections.h (Script_sections::release_segments): New
10406         method declaration.
10407         * gold/target.h (Target::may_relax, Target::relax,
10408         Target::do_may_relax, Target::do_relax): New method definitions.
10409
10410 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10411
10412         * arm.cc (has_signed_unsigned_overflow): New function.
10413         (Arm_relocate_functions::abs8): New function.
10414         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10415         (Target_arm::Scan::global): Likewise.
10416         (Target_arm::relocate::relocate): Likewise.
10417         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10418         Likewise.
10419
10420 2009-09-16  Cary Coutant  <ccoutant@google.com>
10421
10422         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10423         * testsuite/Makefile.in: Regenerate.
10424
10425 2009-09-11  Nick Clifton  <nickc@redhat.com>
10426
10427         * po/gold.pot: Updated by the Translation project.
10428
10429 2009-09-08  Cary Coutant  <ccoutant@google.com>
10430
10431         * output.cc (Output_file::open): Add execute permission to empty file.
10432         * testsuite/Makefile.am (permission_test): New test.
10433         * testsuite/Makefile.in: Regenerate.
10434
10435 2009-09-02  Ian Lance Taylor  <iant@google.com>
10436
10437         * output.cc (Output_file::resize): Call map_no_anonymous rather
10438         than map.
10439
10440 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10441
10442         * gold.cc: Include "incremental.h".
10443         (queue_initial_tasks): Call Incremental_checker methods.
10444         * incremental.cc: Include "output.h".
10445         (Incremental_checker::can_incrementally_link_output_file): New
10446         method.
10447         * incremental.h (Incremental_checker): New class.
10448
10449         * output.cc (Output_file::open_for_modification): New method.
10450         (Output_file::map_anonymous): Changed return type to bool.  Record
10451         map in base_ field.
10452         (Output_file::map_no_anonymous): New method, broken out of map.
10453         (Output_file::map): Use map_no_anonymous and map_anonymous.
10454         * output.h (class Output_file): Update declarations.
10455
10456 2009-08-24  Cary Coutant  <ccoutant@google.com>
10457
10458         * options.h (Command_line::Pre_options): New class.
10459         (Command_line::pre_options): New member.
10460         * options.cc (gold::options::ready_to_register): New variable.
10461         (One_option::register_option): Do nothing if not registering options.
10462         Assert if same short option registered twice.
10463         (General_options::General_options): Turn off option registration when
10464         done constructing.
10465         (Command_line::Pre_options::Pre_options): New constructor.
10466
10467 2009-08-24  Cary Coutant  <ccoutant@google.com>
10468
10469         * options.h (General_options::no_keep_memory): Remove incorrect
10470         short option.
10471
10472 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10473
10474         * Makefile.am (am__skiplex, am__skipyacc): New.
10475         * Makefile.in: Regenerate.
10476
10477 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10478
10479         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10480         (INCLUDES): ... this.
10481         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10482         (AM_CPPFLAGS): Renamed from ...
10483         (INCLUDE): ... this.
10484         * Makefile.in, testsuite/Makefile.in: Regenerate.
10485
10486         * Makefile.in: Regenerate.
10487         * aclocal.m4: Likewise.
10488         * config.in: Likewise.
10489         * configure: Likewise.
10490         * testsuite/Makefile.in: Likewise.
10491
10492         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10493         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10494         * Makefile.in: Regenerate.
10495         * testsuite/Makefile.in: Regenerate.
10496
10497 2009-08-19  Cary Coutant  <ccoutant@google.com>
10498
10499         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10500         symbols in shared libraries overridden by hidden or internal symbols
10501         in the main program.
10502
10503 2009-08-19  Chris Demetriou  <cgd@google.com>
10504
10505         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10506         checking source file names in error messages.
10507
10508 2009-08-18  Doug Kwan  <dougkwan@google.com>
10509
10510         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10511         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10512         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10513         an elfcpp::Ehdr as parameter.
10514         * object.cc (Object::set_target): Remove the version that looks up
10515         a target and sets it.
10516         (Sized_relobj::setup): Take a Target object instead of
10517         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10518         (make_elf_sized_object): Find target and ask target to
10519         make an ELF object.
10520         * object.h: (Object::set_target): Remove the version that looks up
10521         a target and sets it.
10522         (Sized_relobj::setup): Take a Target object instead of
10523         an elfcpp:Ehdr as parameter.
10524         * target.cc: Include dynobj.h.
10525         (Target::do_make_elf_object_implementation): New.
10526         (Target::do_make_elf_object): New.
10527         * target.h (Target::make_elf_object): New template declaration.
10528         (Target::do_make_elf_object): New method declarations.
10529         (Target::do_make_elf_object_implementation): New template declaration.
10530
10531 2009-08-14  Ian Lance Taylor  <iant@google.com>
10532
10533         * gold.h (FUNCTION_NAME): Define.
10534         (gold_unreachable): Use FUNCTION_NAME.
10535
10536 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10537
10538         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10539         symbol in the --keep-unique list is not found.
10540
10541 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10542
10543         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10544         been maked as --keep-unique.
10545         (Icf::unfold_section): New function.
10546         * icf.h (Icf::unfold_section): New function.
10547         * options.h (General_options::keep_unique): New option.
10548         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10549         * testsuite/Makefile.in: Regenerate.
10550         * testsuite/icf_keep_unique_test.sh: New file.
10551         * testsuite/icf_keep_unique_test.cc: New file.
10552
10553 2009-08-12  Cary Coutant  <ccoutant@google.com>
10554
10555         PR 10471
10556         * resolve.cc (Symbol_table::resolve): Check for references from
10557         dynamic objects to hidden and internal symbols.
10558         * testsuite/Makefile.am (hidden_test.sh): New test.
10559         * testsuite/Makefile.in: Regenerate.
10560         * testsuite/hidden_test.sh: New script.
10561         * testsuite/hidden_test_1.c: New test source.
10562         * testsuite/hidden_test_main.c: New test source.
10563
10564 2009-08-11  Doug Kwan  <dougkwan@google.com>
10565
10566         * arm.cc: Update comments.
10567         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10568         segment to locate the .ARM.exidx section if present.
10569
10570 2009-08-09  Doug Kwan  <dougkwan@google.com>
10571
10572         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10573         patch.
10574
10575 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10576         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10577         compiler warnings.
10578
10579 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10580
10581         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10582         valid tls_segment only for non-debug-section relocations.
10583         * testsuite/Makefile.am: Add gc_tls_test.
10584         * testsuite/Makefile.in: Regenerate.
10585         * testsuite/gc_tls_test.cc: New file.
10586         * testsuite/gc_tls_test.sh: New file.
10587
10588 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10589
10590         * icf.cc: New file.
10591         * icf.h: New file.
10592         * Makefile.am (CCFILES): Add icf.cc.
10593         (HFILES): Add icf.h
10594         * Makefile.in: Regenerate.
10595         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10596         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10597         section, symbol and addend information for the relocs.
10598         * gold.cc (queue_middle_tasks): Call identical code folding.
10599         * gold.h: Add defines for multimap.
10600         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10601         to the call of finalize_local_symbols.
10602         * main.cc (main): Create object of class Icf.
10603         * object.cc (Sized_relobj::do_layout): Allow this function to be
10604         called twice during icf.
10605         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10606         to sections marked as identical by icf.
10607         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10608         when available.
10609         (Sized_relobj::do_section_entsize): New function.
10610         * object.h (Object::section_entsize): New function.
10611         (Object::do_section_entsize): New pure virtual function.
10612         (Relobj::finalize_local_symbols): Add new parameter.
10613         (Relobj::do_section_entsize): New function.
10614         * options.h (General_options::icf): New option.
10615         (General_options::icf_iterations): New option.
10616         (General_options::print_icf_sections): New option.
10617         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10618         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10619         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10620         icf.
10621         * symtab.cc (Symbol_table::is_section_folded): New function.
10622         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10623         to sections marked as identical by icf.
10624         * symtab.h (Symbol_table::set_icf): New function.
10625         (Symbol_table::icf): New function.
10626         (Symbol_table::is_section_folded): New function.
10627         (Symbol_table::icf_): New data member.
10628         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10629         * testsuite/Makefile.am: Add commands to build icf_test.
10630         * testsuite/Makefile.in: Regenerate.
10631         * testsuite/icf_test.sh: New file.
10632         * testsuite/icf_test.cc: New file.
10633
10634 2009-07-24  Chris Demetriou  <cgd@google.com>
10635
10636         * layout.cc (is_compressible_debug_section): Fix incorrect
10637         comment about compressed section names.
10638
10639 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10640
10641         PR 10419
10642         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10643
10644 2009-07-16  Ian Lance Taylor  <iant@google.com>
10645
10646         PR 10400
10647         * layout.h: #include <map>.
10648         (class Kept_section): Change from struct to class.  Add accessors
10649         and setters.  Add section size to Comdat_group mapping.  Change
10650         Comdat_group to std::map.  Add is_comdat_ field.  Add
10651         linkonce_size field in union.
10652         (class Layout): Update declaration of find_or_add_kept_section.
10653         Don't declare find_kept_object.
10654         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10655         parameter.  Add object, shndx, is_comdat, and is_group_name
10656         parameters.  Change all callers.  Adjust for new Kept_section.
10657         (Layout::find_kept_object): Remove.
10658         * object.cc (Sized_relobj::include_section_group): Update use of
10659         Kept_section.  Rename secnum to shndx.  Only record
10660         Kept_comdat_section if sections are the same size.
10661         (Sized_relobj::include_linkonce_section): Update use of
10662         Kept_section.  Only record Kept_comdat_section if sections are the
10663         same size.  Set size of linkonce section.
10664         (Sized_relobj::map_to_kept_section): Update call to
10665         get_kept_comdat_section.
10666         * object.h (class Sized_relobj): Rename fields in
10667         Kept_comdat_section to drop trailing underscores; change object
10668         field to Relobj*.  Change Kept_comdat_section_table to store
10669         struct rather than pointer.
10670         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10671         Add kept_object and kept_shndx parameters.  Change all callers.
10672         (Sized_relobj::get_kept_comdat_section): Change return type to
10673         bool.  Add kept_object and kept_shndx parameters.  Change all
10674         callers.
10675         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10676         Layout::find_or_add_kept_section.
10677
10678 2009-07-09  Ian Lance Taylor  <iant@google.com>
10679
10680         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10681         Reserve space in the hash table.
10682
10683 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10684
10685         * fileread.cc (File_read::get_mtime): New method.
10686         * fileread.h (Timespec): New structure.
10687         (File_read::get_mtime): New method.
10688         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10689         Renamed from timestamp_nsec.
10690         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10691         Elf_Xword.
10692         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10693         timestamp_nsec.
10694         (Incremental_inputs::report_archive): Save mtime; style fix.
10695         (Incremental_inputs::report_obejct): Save mtime; style fix.
10696         (Incremental_inputs::report_script): Save mtime; style fix.
10697         (Incremental_inputs::finalize_inputs): Style fix.
10698         (Incremental_inputs::finalize): Style fix.
10699         (Incremental_inputs::create_input_section_data): Store inputs
10700         mtime.
10701         * incremental.h (Incremental_inputs::report_script): Add mtime
10702         argument.
10703         (Incremental_inputs::Input_info::Input_info): Intialize only one
10704         union member.
10705         (Incremental_inputs::Input_info::archive): Move to nameless
10706         union.
10707         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10708         (Incremental_inputs::Input_info::script): Move to nameless union.
10709         (Incremental_inputs::mtime): New field.
10710         * script.cc (read_input_script): Pass file mtime to
10711         Incremental_input.
10712         * script.h (Script_info::inputs): Style fix.
10713
10714 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10715
10716         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10717         instead of 32.
10718
10719 2009-06-24  Ian Lance Taylor  <iant@google.com>
10720
10721         PR 10156
10722         * layout.cc (Layout::choose_output_section): If we find an
10723         existing section, update the flags.
10724         (Layout::create_notes): New function, broken out of
10725         Layout::finalize.
10726         (Layout::finalize): Don't create note sections.
10727         (Layout::create_note): Don't crash if linker script discards
10728         section.
10729         (Layout::create_gold_note): Likewise.
10730         (Layout::create_build_id): Likewise.  Don't set
10731         after_input_sections on the section.
10732         (Layout::create_executable_stack_info): Remove target parameter.
10733         Change caller.
10734         * layout.h (class Layout): Declare create_notes.  Update
10735         declaration of create_executable_stack_info.
10736         * gold.cc (queue_middle_tasks): Call create_notes.
10737         * output.cc (Output_section::update_flags_for_input_section): Move
10738         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10739         invalid.
10740         * output.h (Output_data::mark_address_invalid): New function.
10741         (class Output_section): Only declare, not define,
10742         update_flags_for_input_section.  Remove set_flags.
10743
10744 2009-06-24  Ian Lance Taylor  <iant@google.com>
10745
10746         * script-sections.cc (Output_section_definition::
10747         set_section_addresses): Rename shadowing local load_address to
10748         laddr.
10749
10750 2009-06-24  Ian Lance Taylor  <iant@google.com>
10751
10752         PR 10244
10753         * reloc.cc (relocate_sections): Skip empty relocation sections.
10754
10755 2009-06-23  Ian Lance Taylor  <iant@google.com>
10756
10757         PR 10156
10758         * layout.cc (Layout::create_note): Use choose_output_section
10759         rather than make_output_section.
10760
10761 2009-06-23  Ian Lance Taylor  <iant@google.com>
10762
10763         PR 10237
10764         * options.cc (General_options::parse_V): Set printed_version_.
10765         (General_options::General_options): Initialize printed_version_.
10766         * options.h (class General_options): Add printed_version_ field.
10767         * gold.cc (queue_initial_tasks): If there are no input files,
10768         don't give a fatal error if we printed the version information.
10769         (queue_middle_tasks): If using -r with a shared object, give a
10770         fatal error rather than an ordinary error.
10771
10772 2009-06-23  Ian Lance Taylor  <iant@google.com>
10773
10774         PR 10219
10775         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10776         (Layout::make_output_section): Set have_stabstr_section_ if we see
10777         a .stab*str section.
10778         (Layout::finalize): Call link_stabs_sections.
10779         (Layout::link_stabs_sections): New file.
10780         * layout.h (class Layout): Add have_stabstr_section_ field.
10781         Declare link_stabs_sections.
10782
10783 2009-06-23  Doug Kwan  <dougkwan@google.com>
10784
10785         * Makefile.am (libgold_a_LIBADD): New.
10786         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10787         * Makefile.in: Regenerate.
10788         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10789         * configure: Regenerate.
10790         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10791         * fileread.cc: Include sys/state.h
10792         * gold.h: Declare memmem and strndup if found missing.
10793         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10794
10795 2009-06-23  Ian Lance Taylor  <iant@google.com>
10796
10797         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10798         * configure: Rebuild.
10799
10800 2009-06-23  Ian Lance Taylor  <iant@google.com>
10801
10802         PR 10147
10803         * object.cc (Object::section_contents): Don't try to get a view if
10804         the section has length zero.
10805         (Object::handle_gnu_warning_section): If the section is empty, use
10806         the name of the section as the warning.
10807
10808 2009-06-23  Ian Lance Taylor  <iant@google.com>
10809
10810         PR 10133
10811         * stringpool.h (class Stringpool_template): Add optimize_ field.
10812         (Stringpool_template::set_optimize): New function.
10813         * stringpool.cc (Stringpool_template::Stringpool_template):
10814         Initialize optimize_ field.
10815         (Stringpool_template::set_string_offsets): Test local optimize
10816         fild rather than parameter.
10817         * layout.cc (Layout::Layout): Call set_optimize on the section
10818         name stringpool.
10819
10820 2009-06-22  Ian Lance Taylor  <iant@google.com>
10821
10822         PR 10030
10823         * yyscript.y: Parse TARGET.
10824         * script.cc (script_set_target): New function.
10825         * script-c.h (script_set_target): Declare.
10826         * options.cc (General_options::string_to_object_format): Rename
10827         from string_to_object_format in anonymous namespace.  Change
10828         callers.
10829         * options.h (class General_options): Declare
10830         string_to_object_format.
10831
10832 2009-06-22  Ian Lance Taylor  <iant@google.com>
10833
10834         * script-sections.cc (Script_sections::create_segments): Don't put
10835         program headers in a PT_LOAD segment if -n or -N.
10836
10837 2009-06-22  Ian Lance Taylor  <iant@google.com>
10838
10839         PR 10141
10840         * options.h (class General_options): Add -z lazy and -z now.  Sort
10841         -z options into alphabetical order.
10842         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10843
10844 2009-06-21  Ian Lance Taylor  <iant@google.com>
10845
10846         * layout.cc (Layout::make_output_section): Call
10847         Target::new_output_section.
10848         (Layout::attach_allocated_section_to_segment): Put large section
10849         sections in a separate load segment with the large segment flag
10850         set.
10851         (Layout::segment_precedes): Sort large data segments after other
10852         load segments.
10853         (align_file_offset): New static function.
10854         (Layout::set_segment_offsets): Use align_file_offset.
10855         * output.h (class Output_section): Add is_small_section_ and
10856         is_large_section_ fields.
10857         (Output_section::is_small_section): New function.
10858         (Output_section::set_is_small_section):  New function.
10859         (Output_section::is_large_section): New function.
10860         (Output_section::set_is_large_section): New function.
10861         (Output_section::is_large_data_section): New function.
10862         (class Output_segment): Add is_large_data_segment_ field.
10863         (Output_segment::is_large_data_segment): New function.
10864         (Output_segment::set_is_large_data_segment): New function.
10865         * output.cc (Output_section::Output_section): Initialize new
10866         fields.
10867         (Output_segment::Output_segment): Likewise.
10868         (Output_segment::add_output_section): Add assertion that large
10869         data sections always go in large data segments.  Force small data
10870         sections to the end of the list of data sections.  Force small BSS
10871         sections to the start of the list of BSS sections.  For large BSS
10872         sections to the end of the list of BSS sections.
10873         * symtab.h (class Symbol): Declare is_common_shndx.
10874         (Symbol::is_defined): Check Symbol::is_common_shndx.
10875         (Symbol::is_common): Likewise.
10876         (class Symbol_table): Define enum Commons_section_type.  Update
10877         declarations.  Add small_commons_ and large_commons_ fields.
10878         * symtab.cc (Symbol::is_common_shndx): New function.
10879         (Symbol_table::Symbol_table): Initialize new fields.
10880         (Symbol_table::add_from_object): Put small and large common
10881         symbols in the right list.
10882         (Symbol_table::sized_finalized_symbol): Check
10883         Symbol::is_common_shndx.
10884         (Symbol_table::sized_write_globals): Likewise.
10885         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10886         common symbol lists.  Don't call do_allocate_commons_list if the
10887         list is empty.
10888         (Symbol_table::do_allocate_commons_list): Remove is_tls
10889         parameter.  Add comons_section_type parameter.  Change all
10890         callers.  Handle small and large common symbols.
10891         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10892         Symbol::is_common_shndx.
10893         * resolve.cc (symbol_to_bits): Likewise.
10894         * target.h (Target::small_common_shndx): New function.
10895         (Target::small_common_section_flags): New function.
10896         (Target::large_common_shndx): New function.
10897         (Target::large_common_section_flags): New function.
10898         (Target::new_output_section): New function.
10899         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10900         small_common_section_flags, and large_common_section_flags
10901         fields.
10902         (Target::do_new_output_section): New virtual function.
10903         * arm.cc (Target_arm::arm_info): Initialize new fields.
10904         * i386.cc (Target_i386::i386_info): Likewise.
10905         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10906         Likewise.
10907         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10908         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10909         (Target_x86_64::do_new_output_section): New function.
10910         * configure.ac: Define conditional MCMODEL_MEDIUM.
10911         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10912         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10913         (large_LDFLAGS): Define.
10914         * testsuite/large.c: New file.
10915         * testsuite/testfile.cc (Target_test::test_target_info):
10916         Initialize new fields.
10917         * configure, testsuite/Makefile.in: Rebuild.
10918
10919 2009-06-05  Doug Kwan  <dougkwan@google.com>
10920
10921         * Makefile.am (CCFILES): Add target.cc.
10922         * Makefile.in: Regenerate.
10923         * i386.cc (class Target_i386): Define new virtual method to
10924         override do_is_local_label_name in parent.
10925         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10926         local symbols if --discard-locals or -X is given.
10927         * options.h (class General_options): Declare new options
10928         '--discard-locals' and '-X' for discarding locals.
10929         * target.h (class Target): Define new methods is_local_label_name.
10930         Declare new virtual method do_is_local_label_name.
10931         * target.cc: New file.
10932         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10933         (check_SCRIPTS): Add discard_locals_test.sh.
10934         (check_DATA): Add discard_local_tests.syms.
10935         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10936         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10937         * testsuite/Makefile.in: Regenerate.
10938         * testsuite/discard_locals_test.c: New file.
10939         * testsuite/discard_locals_test.sh: Same.
10940
10941 2009-06-05  Doug Kwan  <dougkwan@google.com>
10942
10943         * object.cc (Sized_relobj::Sized_relobj): Initialize
10944         discarded_eh_frame_shndx_ to -1U.
10945         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10946         section.
10947         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10948         a discarded .eh_frame section.
10949         (Sized_relobj::do_finalize_local_symbols): Ditto.
10950         * object.h (class Sized_relobj): Declare new member
10951         discarded_eh_frame_shndx_.
10952         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10953         (local_labels_test.o, local_labels_test): New rules.
10954         * testsuite/Makefile.in: Regenerate.
10955
10956 2009-06-04  Doug Kwan  <dougkwan@google.com>
10957
10958         * layout.cc (Layout::section_name_mapping): Add mapping for
10959         special ARM sections.
10960
10961 2009-06-03  Doug Kwan  <dougkwan@google.com>
10962
10963         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10964         (utils::has_overflow): Same.
10965
10966 2009-06-03  Ian Lance Taylor  <iant@google.com>
10967
10968         * layout.cc (Layout::section_name_mapping): New array, replacing
10969         Layout::linkonce_mapping.
10970         (Layout::section_name_mapping_count): New variable, replacing
10971         Layout::linkonce_mapping_count.
10972         (Layout::linkonce_output_name): Remove.
10973         (Layout::output_section_name): Rewrite.
10974         * layout.h (class Layout): Rename Linkonce_mapping to
10975         Section_name_mapping, linkonce_mapping to section_name_mapping,
10976         linkonce_mapping_count to section_name_mapping_count.  Don't
10977         declare linkonce_output_name.
10978
10979 2009-06-03  Doug Kwan  <dougkwan@google.com>
10980
10981         * gold/arm.cc (namespace utils): New.
10982         (Target_arm::reloc_is_non_pic): Define new method.
10983         (class Arm_relocate_functions): New.
10984         (Target_arm::Relocate::relocate): Handle relocation types used by
10985         Android.
10986
10987 2009-06-03  Ian Lance Taylor  <iant@google.com>
10988
10989         * arm.cc (Target_arm::scan::global): Use || instead of |.
10990
10991 2009-06-02  Doug Kwan  <dougkwan@google.com>
10992
10993         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10994         issued_non_pic_error_.
10995         (class Target_arm::Scan): Declare new method check_non_pic.
10996         Define new method symbol_needs_plt_entry.
10997         Declare new data member issued_non_pic_error_.
10998         (class Target_arm::Relocate): Declare new method
10999         should_apply_static_reloc.
11000         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11001         (Target_arm::Scan::check_non_pic): Define new method.
11002         (Target_arm::Scan::local): Handle a small subset of reloc types used
11003         by Android.
11004         (Target_arm::Scan::local): Same.
11005         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11006
11007 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11008
11009         * incremental.cc (Incremental_inputs::report_command_line): Filter
11010         out --incremental-* options.
11011
11012 2009-05-29  Doug Kwan  <dougkwan@google.com>
11013
11014         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11015         template class.
11016         (class Target_arm): Update comment.
11017         (Target_arm::Target_arm): Initialize new data members GOT_,
11018         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11019         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11020         and Target_arm::rel_dyn_section.
11021         Declare new_enum Target_arm::Got_type.
11022         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11023         and DYNBSS_.
11024         Update commments for member do_dynsym_value.
11025         (Target_arm::got_size, Target_arm::plt_section,
11026         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11027         new methods inside class defintion.
11028         (Target_arm::got_section): Define new method.
11029         (Target_arm::rel_dyn_section): Same.
11030         (Output_data_plt_arm): New template class.
11031         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11032         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11033         (Output_data_plt_arm::add_entry): Same.
11034         (Output_data_plt_arm::first_plt_entry): Define new
11035         static data member for PLT instruction template.
11036         (Output_data_plt_arm::plt_entry): Same.
11037         (Output_data_plt_arm::do_write): Define new method.
11038         (Target_arm::make_plt_entry): Same.
11039         (Target_arm::do_finalize_sections): Same.
11040         (Target_arm::do_dynsym_value): Same.
11041
11042 2009-05-28  Doug Kwan  <dougkwan@google.com>
11043
11044         * Makefile.am (TARGETSOURCES): Add arm.cc.
11045         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11046         * Makefile.in: Regenerate.
11047         * arm.cc: New file.
11048         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11049
11050 2009-05-26  Doug Kwan  <dougkwan@google.com>
11051
11052         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11053         (General_options::check_excluded_libs): Strip off directories in
11054         archive name before matching like GNU ld does.
11055         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11056         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11057         (exclude_libs_test_LDFLAGS): Add linker option
11058         -Wl,--exclude-libs,libexclude_libs_test_3
11059         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11060         an explicit archive without using -l.
11061         (alt/libexclude_libs_test_3.a): New make rule.
11062         * testsuite/Makefile.in: Regenerate.
11063         * testsuite/exclude_libs_test.c : Declare lib3_default().
11064         (main): Call it.
11065         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11066         * exclude_libs_test_3.c: New file.
11067
11068 2009-05-26  Nick Clifton  <nickc@redhat.com>
11069
11070         * po/id.po: New Indonesian translation.
11071         * po/gold.pot: Updated template file.
11072
11073 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11074
11075         * testsuite/Makefile.am: Add -ffunction-sections to compile
11076         gc_comdat_test files.  Add -Wl,--gc-sections to build
11077         gc_comdat_test.
11078         * testsuite/Makefile.in: Regenerate.
11079         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11080
11081 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11082
11083         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11084         kept comdat section was garbage collected.
11085         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11086         * testsuite/Makefile.in: Regenerate.
11087         * testsuite/gc_comdat_test.sh: New file.
11088         * testsuite/gc_comdat_test_1.cc: New file.
11089         * testsuite/gc_comdat_test_2.cc: New file.
11090
11091 2009-05-19  Doug Kwan  <dougkwan@google.com>
11092
11093         * archive.cc (Archive::Archive): Move constructor from archive.h
11094         to here.  Initialize no_export_.
11095         (Archive::get_elf_object_for_member): Set no_export flag of object.
11096         * archive.h (Archive::Archive): Move constructor body to
11097         archive.cc.
11098         (Archive::no_export): New method.
11099         (Archive::no_export_): New field.
11100         * object.h (Object::Object): Initialize no_export_ to false.
11101         (Object::no_export, Object::set_no_export): New methods.
11102         (Object::no_export_): New field.
11103         * options.cc (General_options::parse_exclude_libs): New method.
11104         (General_options::check_excluded_libs) Same.
11105         * options.h (exclude_libs): New option.
11106         (General_options::check_excluded_libs): New method declaration.
11107         (General_options::excluded_libs_): New field.
11108         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11109         default or protected visibility if an object has no-export flag set.
11110         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11111         (check_SCRIPTS): Add exclude_libs_test.sh.
11112         (check_DATA): Add exclude_libs_test.syms.
11113         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11114         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11115         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11116         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11117         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11118         libexclude_libs_test_2.a): New rules.
11119         * testsuite/Makefile.in: Regenerate.
11120         * testsuite/exclude_libs_test.c: New file.
11121         * testsuite/exclude_libs_test.sh: Ditto.
11122         * testsuite/exclude_libs_test_1.c: Ditto.
11123         * testsuite/exclude_libs_test_2.c: Ditto.
11124
11125 2009-05-15  Ian Lance Taylor  <iant@google.com>
11126
11127         * configure.ac: Check for declarations for cases where libiberty.h
11128         checks HAVE_DECL_xxx.
11129         * configure, config.in: Rebuild.
11130
11131 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11132
11133         * gold.h (Incremental_argument_list): Remove (invalid) forward
11134         declaration.
11135         * incremental.cc (Incremental_inputs::report_achive): New method.
11136         (Incremental_inputs::report_object): New method.
11137         (Incremental_inputs::report_script): New method.
11138         (Incremental_inputs::finalize_inputs): New method.
11139         (Incremental_inputs::finalize): Call finalize_inputs().
11140         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11141         Create inputs entries.
11142         * incremental.h (Incremental_input_type): New enum.
11143         (Incremental_inputs::Incremental_input): Initialize new fields.
11144         (Incremental_inputs::report_inputs): New method.
11145         (Incremental_inputs::report_achive): New method.
11146         (Incremental_inputs::report_object): New method.
11147         (Incremental_inputs::report_script): New method.
11148         (Incremental_inputs::finalize_inputs): New method.
11149         (Incremental_inputs::Input_info): New struct.
11150         (Incremental_inputs::Input_info_map): New typedef.
11151         (Incremental_inputs::lock_): New field.
11152         (Incremental_inputs::Inputs_): New field.
11153         (Incremental_inputs::Inputs_map): New field.
11154         * main.cc (main): Call Incremental_input::report_inputs.
11155         * options.h (Input_argument_list): Typedef moved from
11156         Input_arguments.
11157         (Input_file_group::Files): Remove, use ::Input_argument_list.
11158         (Input_file_group::Input_argument_list): Remove, use
11159         ::Input_argument_list.
11160         * plugin.cc (Plugin_manager::add_input_file): Add error in
11161         incremental build.
11162         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11163         functions.
11164         * script.cc (read_input_script): Call
11165         Incremental_input::report_script.
11166         * script.h (Script_info): New class.
11167
11168 2009-04-27  Ian Lance Taylor  <iant@google.com>
11169
11170         * x86_64.cc (do_adjust_output_section): Set entsize to
11171         plt_entry_size.
11172
11173 2009-04-23  Elliott Hughes  <enh@google.com>
11174
11175         * output.cc (Output_file::close): After short writes, continue
11176         writing from the correct offset in the buffer being written.
11177
11178 2009-04-23  Chris Demetriou  <cgd@google.com>
11179
11180         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11181         * configure: Regenerate.
11182         * config.in: Regenerate.
11183         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11184         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11185
11186 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11187
11188         * incremental.cc (Incremental_inputs_header_data): Renamed from
11189         Incremental_input_header_data.
11190         (Incremental_inputs_header_data::data_size): New field.
11191         (Incremental_inputs_header_data::put_input_file_count): Renamed
11192         from input_file_count.
11193         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11194         from command_line_offset.
11195         (Incremental_inputs_header_data::put_reserved): Renamed from
11196         put_reserved.
11197         (Incremental_inputs_entry_data): Renamed from
11198         Incremental_input_entry_data.
11199         (Incremental_inputs_entry_data::data_size): New field.
11200         (Incremental_inputs::report_command_line): New method.
11201         (Incremental_inputs::finalize): New method.
11202         (Incremental_inputs::create_incremental_inputs_data): New method.
11203         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11204         * incremental.h: New file.
11205         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11206         (Layout::finalize): Create incremental inputs section in
11207         incremental builds.
11208         (Layout::create_incremental_info_sections): New method.
11209         * layout.h (Layout::incremental_inputs): New method.
11210         (Layout::create_incremental_info_sections): New method.
11211         (Layout::incremental_inputs_): New field.
11212         * main.cc (main): Notify Incremental_input of the command line.
11213
11214 2009-04-01  Ian Lance Taylor  <iant@google.com>
11215             Mikolaj Zalewski  <mikolajz@google.com>
11216
11217         * gold.h (reserve_unordered_map): Define, three versions, one for
11218         each version of Unordered_map.
11219         * layout.cc (Layout::Layout): Remove options parameter.  Add
11220         number_of_input_files parameter.  Don't initialize options_.
11221         Initialize number_of_input_files_ and resized_signatures_.  Move
11222         sections_are_attached_.
11223         (Layout::layout_group): Reserve space for group_signatures_.
11224         (Layout::find_or_add_kept_section): Change name parameter to be a
11225         reference.  Resize signatures_ map when it gets large enough.
11226         (Layout::layout_eh_frame): Use parameters->options() instead of
11227         this->options_.
11228         (Layout::make_output_section): Likewise.
11229         (Layout::attach_allocated_section_to_segment): Likewise.
11230         (Layout::finalize, Layout::create_executable_stack): Likewise.
11231         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11232         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11233         * layout.h (class Layout): Update declarations.  Remove options_
11234         field.  Add number_of_input_files_ and resized_signatures_
11235         fields.  Move sections_are_attached_ field.
11236         * main.cc (main): Pass number of input files to Layout
11237         constructor.  Don't pass options.
11238
11239 2009-03-30  Ian Lance Taylor  <iant@google.com>
11240
11241         * ffsll.c (ffsll): Correct implementation.
11242
11243 2009-03-27  Ian Lance Taylor  <iant@google.com>
11244
11245         * ffsll.c: New file.
11246         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11247         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11248         * ftruncate.c (ftruncate): Declare before definition.
11249         * mremap.c (mremap): Likewise.
11250         * pread.c (pread): Likewise.
11251         * configure, Makefile.in, config.in: Rebuild.
11252
11253         * mremap.c: New file.
11254         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11255         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11256         (mremap): Declare if HAVE_MREMAP is not defined.
11257         * configure, Makefile.in, config.in: Rebuild.
11258
11259 2009-03-27  Cary Coutant  <ccoutant@google.com>
11260
11261         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11262         position independent.
11263         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11264         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11265
11266 2009-03-24  Cary Coutant  <ccoutant@google.com>
11267
11268         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11269         an executable.
11270         (needs_dynamic_reloc): Likewise.
11271
11272 2009-03-24  Ian Lance Taylor  <iant@google.com>
11273
11274         * yyscript.y (file_cmd): Recognize EXTERN.
11275         (extern_name_list, extern_name_list_body): New nonterminals.
11276         * script.cc (script_add_extern): Define.
11277         * script-c.h (script_add_extern): Declare.
11278
11279 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11280
11281         * object.cc (is_elf_object): Define.
11282         * object.h (is_elf_object): Declare.
11283         * archive.cc (Archive::get_elf_object_for_member): Call
11284         is_elf_object.
11285         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11286
11287 2009-03-24  Elliott Hughes  <enh@google.com>
11288
11289         * output.cc (Output_file::map_anonymous): Define.
11290         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11291         try an anonymous one.  Report the size if the mmap fails.
11292         * output.h (class Output_file): Declare map_anonymous.
11293
11294 2009-03-24  Ian Lance Taylor  <iant@google.com>
11295
11296         * target-select.cc (instantiate_target): Don't acquire the lock if
11297         the instantiated_target_ field has already been set.
11298
11299 2009-03-23  Ian Lance Taylor  <iant@google.com>
11300
11301         * gold-threads.h (class Initialize_lock): Define.
11302         * gold-threads.cc (class Initialize_lock_once): Define.
11303         (initialize_lock_control): New static variable.
11304         (initialize_lock_pointer): New static variable.
11305         (initialize_lock_once): New static function.
11306         (Initialize_lock::Initialize_lock): Define.
11307         (Initialize_lock::initialize): Define.
11308         * target-select.h: Include "gold-threads.h".
11309         (class Target_selector): Add lock_ and initialize_lock_ fields.
11310         Don't define instantiate_target, just declare it.
11311         * target-select.cc (Target_selector::Target_selector): Initialize
11312         new fields.
11313         (Target_selector::instantiate_target): Define.
11314         * descriptors.h: Include "gold-threads.h".
11315         (class Descriptors): Add initialize_lock_ field.
11316         * descriptors.cc (Descriptors::Descriptors): Initialize new
11317         field.
11318         (Descriptors::open): Use initialize_lock_ field
11319         * errors.h (class Errors): Add initialize_lock_ field.
11320         * errors.cc (Errors::Errors): Initialize new field.
11321         (Errors::initialize_lock): Use initialize_lock_ field.
11322         * powerpc.cc (class Target_selector_powerpc): Remove
11323         instantiated_target_ field.  In do_recognize call
11324         instantiate_target rather than do_instantiate_target.  In
11325         do_instantiate_target just allocate a new target.
11326         * sparc.cc (class Target_selector_sparc): Likewise.
11327
11328         * freebsd.h: New file.
11329         * i386.cc: Include "freebsd.h".
11330         (Target_i386): Derive from Target_freebsd rather than
11331         Sized_target.
11332         (Target_selector_i386): Derive from Target_selector_freebsd rather
11333         than Target_selector.
11334         * x86_64.cc: Include "freebsd.h".
11335         (Target_x86_64): Derive from Target_freebsd rather than
11336         Sized_target.
11337         (Target_selector_x86_64): Derive from Target_selector_freebsd
11338         rather than Target_selector.
11339         * target.h (class Target): Add adjust_elf_header and
11340         do_adjust_elf_header.
11341         * output.cc (Output_file_header:: do_sized_write): Call target
11342         adjust_elf_header routine.
11343         * configure.tgt: Set targ_osabi.
11344         * configure.ac: Define GOLD_DEFAULT_OSABI.
11345         * parameters.cc (Parameters::default_target): Pass
11346         GOLD_DEFAULT_OSABI to select_target.
11347         * target-select.h (class Target_selector): Make instantiate_target
11348         protected rather than private.
11349         * Makefile.am (HFILES): Add freebsd.h.
11350         * configure, Makefile.in, config.in: Rebuild.
11351
11352         * merge.cc (do_add_input_section): Correct pend value.  Change
11353         message about last entry not being null terminated from error to
11354         warning.
11355
11356 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11357
11358         * incremental.cc: New file.
11359         * Makefile.am (CCFILES): Add incremental.cc.
11360         * Makefile.in: Rebuild.
11361
11362 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11363
11364         * layout.cc (Layout::output_section_name): Preserve names
11365         of '.note.' sections.
11366
11367 2009-03-19  Ian Lance Taylor  <iant@google.com>
11368
11369         * descriptors.cc (Descriptors::open): Check that the options are
11370         valid before using them.
11371
11372 2009-03-18  Ian Lance Taylor  <iant@google.com>
11373
11374         * script-sections.h: Include <list>.
11375         (class Script_sections): Change Sections_elements from std::vector
11376         to std::list.  Typedef public Elements_iterator.  Add
11377         orphan_section_placement_, data_segment_align_start_, and
11378         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11379         field.
11380         * script-sections.cc (class Orphan_section_placement): New class.
11381         (class Sections_element): Add virtual functions is_relro and
11382         orphan_section_init.  Remove virtual function place_orphan_here.
11383         (class Output_section_definition): Add is_relro and
11384         orphan_section_init.  Remove place_orphan_here.
11385         (class Orphan_output_section): Likewise.
11386         (Script_sections::Script_sections): Update for field changes.
11387         (Script_sections::data_segment_align): Set saw_data_segment_align_
11388         and data_segment_align_start_, not data_segment_align_index.
11389         (Script_sections::data_segment_relro_end): Check
11390         saw_data_segment_align_.  Use data_segment_align_start_ rather
11391         than data_segment_align_index_.
11392         (Script_sections::place_orphan): Rewrite to use
11393         Orphan_section_placement.
11394
11395 2009-03-17  Ian Lance Taylor  <iant@google.com>
11396
11397         * archive.cc (Archive::add_symbols): Check for a version attached
11398         to the symbol name in the archive map.
11399         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11400         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11401         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11402         (ver_test_11.a): New target.
11403         * testsuite/Makefile.in: Rebuild.
11404
11405         * configure.ac: Check for chsize and posix_fallocate.  Replace
11406         ftruncate.
11407         * ftruncate.c: New file, from gnulib.
11408         * output.cc (posix_fallocate): Define dummy version if not
11409         HAVE_POSIX_FALLOCATE.
11410         (Output_file::map): Call posix_fallocate rather than lseek and
11411         write.
11412         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11413         * configure, Makefile.in, config.in: Rebuild.
11414
11415 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11416
11417         * layout.h (Layout::create_note): Add section_name parameter.
11418         * layout.cc (Layout::create_note): Likewise.
11419         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11420
11421 2009-03-17  Ian Lance Taylor  <iant@google.com>
11422
11423         * descriptors.cc: Include "options.h".
11424         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11425         (Descriptors::open): Always use O_CLOEXEC when opening a new
11426         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11427         then set FD_CLOEXEC.
11428
11429         * sparc.cc (class Target_sparc): Add has_got_section.
11430         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11431         make sure we have a GOT section.
11432
11433         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11434         (Target_sparc::Scan::local): Likewise.
11435         (Target_sparc::Scan::global): Likewise.
11436         (Target_sparc::Relocate::relocate): Likewise.
11437         (Target_sparc::Relocate::relocate_tls): Likewise.
11438
11439         * symtab.cc (Symbol_table::define_default_version): New function,
11440         broken out of add_from_object.
11441         (Symbol_table::add_from_object): Call define_default_version.
11442         (Symbol_table::define_special_symbol): Add resolve_oldsym
11443         parameter.  Change all callers.  If the version for a symbol comes
11444         from a version script, resolve it with the symbol with the same
11445         name with no version.  Also add the symbol without a version if
11446         appropriate.
11447         (do_define_in_output_data): If resolving with oldsym, don't delete
11448         sym.
11449         (do_define_in_output_segment): Likewise.
11450         (do_define_as_constant): Likewise.
11451         * symtab.h (class Symbol_table): Update declarations.
11452
11453 2009-03-13  Ian Lance Taylor  <iant@google.com>
11454
11455         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11456         (Read_symbols::requeue): New function.
11457         (Read_symbols::do_read_symbols): If make_elf_object fails because
11458         the target type is not configured, and the file was searched for,
11459         issue a warning and retry with the next directory.
11460         (Add_symbols::run): If the file has an incompatible format, and
11461         it was searched for, requeue the Read_symbols task.  On error,
11462         release the object.
11463         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11464         dirindex parameter to constructor.  Change all callers.  Declare
11465         incompatible_warning and requeue.
11466         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11467         input_argument_ and input_group_ fields.  Add them to
11468         constructor.  Change all callers.
11469         (class Read_script): Add dirindex_ field.  Add it to constructor.
11470         Change all callers.
11471         * archive.cc (Archive::setup): Remove input_objects parameter.
11472         Change all callers.
11473         (Archive::get_file_and_offset): Likewise.
11474         (Archive::read_all_symbols): Likewise.
11475         (Archive::read_symbols): Likewise.
11476         (Archive::get_elf_object_for_member): Remove input_objects
11477         parameter.  Add punconfigured parameter.  Change all callers.
11478         (Archive::add_symbols): Change return type to bool.  Check return
11479         value of include_member.
11480         (Archive::include_all_members): Likewise.
11481         (Archive::include_member): Change return type to bool.  Return
11482         false if first included object has incompatible target.  Set
11483         included_member_ field.
11484         (Add_archive_symbols::run): If add_symbols returns false, requeue
11485         Read_symbols task.
11486         * archive.h (class Archive): Add included_member_ field.
11487         Initialize it in constructor.  Add input_file and searched_for
11488         methods.  Update declarations.
11489         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11490         input_argument_ fields.  Add them to constructor.  Change all
11491         callers.
11492         * script.cc: Include "target-select.h".
11493         (class Parser_closure): Add skip_on_incompatible_target_ and
11494         found_incompatible_target_ fields.  Add
11495         skip_on_incompatible_target parameter to constructor.  Change all
11496         callers.  Add methods skip_on_incompatible_target,
11497         clear_skip_on_incompatible_target, found_incompatible_target, and
11498         set_found_incompatible_target.
11499         (read_input_script): Add dirindex parameter.  Change all callers.
11500         If parser finds an incompatible target, requeue Read_symbols
11501         task.
11502         (script_set_symbol): Clear skip_on_incompatible_target in
11503         closure.
11504         (script_add_assertion, script_parse_option): Likewise.
11505         (script_start_sections, script_add_phdr): Likewise.
11506         (script_check_output_format): New function.
11507         * script.h (read_input_script): Update declaration.
11508         * script-c.h (script_check_output_format): Declare.
11509         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11510         (ignore_cmd): Remove OUTPUT_FORMAT.
11511         * fileread.cc (Input_file::Input_file): Add explicit this.
11512         (Input_file::will_search_for): New function.
11513         (Input_file::open): Add pindex parameter.  Change all callers.
11514         * fileread.h (class Input_file): Add input_file_argument method.
11515         Declare will_search_for.  Update declarations.
11516         * object.cc (make_elf_object): Add punconfigured parameter.
11517         Change all callers.
11518         * object.h (class Object): Make input_file public.  Add
11519         searched_for method.
11520         (make_elf_object): Update declaration.
11521         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11522         restart search.
11523         * dirsearch.h (class Dirsearch): Update declaration.
11524         * options.h (class General_options): Add --warn-search-mismatch.
11525         * parameters.cc (Parameters::is_compatible_target): New function.
11526         * parameters.h (class Parameters): Declare is_compatible_target.
11527         * workqueue.cc (Workqueue::add_blocker): New function.
11528         * workqueue.h (class Workqueue): Declare add_blocker.
11529
11530         * fileread.cc (Input_file::open): Remove options parameter.
11531         Change all callers.
11532         (Input_file::open_binary): Likewise.
11533         * script.cc (read_input_script): Likewise.
11534         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11535         options parameter from constructor.  Change all callers.
11536         (class Read_script): Likewise.
11537         * fileread.h (class Input_file): Update declarations.
11538         * script.h (read_input_script): Update declaration.
11539
11540 2009-03-10  Nick Clifton  <nickc@redhat.com>
11541
11542         * po/es.po: New Spanish translation.
11543
11544 2009-03-06  Cary Coutant  <ccoutant@google.com>
11545
11546         * options.cc (parse_short_option): Keep dash_z from registering itself.
11547
11548 2009-03-03  Ian Lance Taylor  <iant@google.com>
11549
11550         PR 9918
11551         * target-reloc.h (relocate_section): Pass output_section to
11552         relocate.
11553         * i386.cc (Target_i386::should_apply_static_reloc): Add
11554         output_section parameter.  Change all callers.
11555         (Target_i386::Relocate::relocate): Add output_section parameter.
11556         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11557         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11558         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11559         * testsuite/two_file_shared.sh: New script.
11560         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11561         (check_DATA): Add two_file_shared.dbg.
11562         (two_file_shared.dbg): New target.
11563         * testsuite/Makefile.in: Rebuild.
11564
11565 2009-03-01  Ian Lance Taylor  <iant@google.com>
11566
11567         * configure.ac: Check for byteswap.h.
11568         * configure: Rebuild.
11569         * config.in: Rebuild.
11570
11571 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11572
11573         * layout.cc (Layout::find_or_add_kept_section): New function.
11574         (Layout::add_comdat): Removed.
11575         * layout.h (struct Kept_section): Move out of class Layout.
11576         Remove trailing underscores from field names.  Add group_sections
11577         field.  Rename group_ field to is_group.  Change all uses.
11578         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11579         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11580         comdat_groups_ field.
11581         (Sized_relobj::include_section_group): Use
11582         find_or_add_kept_section and Kept_section::group_sections.
11583         (Sized_relobj::include_linkonce_section): Likewise.
11584         * object.cc (class Sized_relobj): Don't define Comdat_group or
11585         Comdat_group_table.  Remove find_comdat_group and
11586         add_comdat_group.  Remove comdat_groups_ field.
11587         * plugin.cc (include_comdat_group): Use
11588         Layout::find_or_add_kept_section.
11589
11590 2009-02-28  Ian Lance Taylor  <iant@google.com>
11591
11592         * README: --gc-sections and map files are now supported.  Document
11593         some build requirements.
11594
11595         PR 6992
11596         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11597         relocatable link set the value of the section symbol to zero.
11598         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11599         relocatable link don't include the section address in the local
11600         symbol value.
11601
11602 2009-02-27  Ian Lance Taylor  <iant@google.com>
11603
11604         PR 6811
11605         * options.h (class Search_directory): Add is_system_directory.
11606         (class General_options): Declare is_in_system_directory.
11607         * options.cc (get_relative_sysroot): Make static.
11608         (get_default_sysroot): Make static.
11609         (General_optoins::is_in_system_directory): New function.
11610         * fileread.cc (Input_file::is_in_system_directory): New function.
11611         * fileread.h (class Input_file): Declare is_in_system_directory.
11612         * object.h (class Object): Add is_in_system_directory.
11613         (class Input_objects): Remove system_library_directory_ field.
11614         * object.cc (Input_objects::add_object): Don't set
11615         system_library_directory_.
11616         (input_objects::found_in_system_library_directory): Remove.
11617         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11618         parameter.  Change all callers.
11619         (Symbol_table::sized_write_globals): Likewise.
11620         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11621         Call Object::is_in_system_directory.
11622         * symtab.h (class Symbol_table): Update declarations.
11623
11624         PR 5990
11625         * descriptors.h (Open_descriptor): Add is_on_stack field.
11626         * descriptors.cc (Descriptors::open): If the descriptor is on the
11627         top of the stack, remove it.  Initialize is_on_stack field.
11628         (Descriptors::release): Only add pod to stack if it is not on the
11629         stack already.
11630         (Descriptors::close_some_descriptor): Clear stack_next and
11631         is_on_stack fields.
11632
11633         PR 7091
11634         * output.cc (Output_section::find_starting_output_address): Rename
11635         from starting_output_address; add PADDR parameter; change return
11636         type.
11637         * output.h (class Output_section): Declare
11638         find_starting_output_address instead of starting_output_address.
11639         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11640         section symbol for which we can't find a merge section.
11641
11642         PR 9836
11643         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11644         hidden or internal, force the symbol to be local.
11645         * resolve.cc (Symbol::override_visibility): Define.
11646         (Symbol::override_base): Use override_visibility.
11647         (Symbol_table::resolve): Likewise.
11648         (Symbol::override_base_with_special): Likewise.
11649         (Symbol_table::override_with_special): If the visibility is hidden
11650         or internal, force the symbol to be local.
11651         * symtab.h (class Symbol): Add set_visibility and
11652         override_visibility.
11653         * testsuite/ver_test_1.sh: New file.
11654         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11655         (check_DATA): Add ver_test_1.syms.
11656         (ver_test_1.syms): New target.
11657         * testsuite/Makefile.in: Rebuild.
11658
11659 2009-02-25  Cary Coutant  <ccoutant@google.com>
11660
11661         * layout.cc (Layout::choose_output_section): Don't rename sections
11662         when using a linker script that has a SECTIONS clause.
11663         * Makefile.in: Regenerate.
11664
11665         * testsuite/Makefile.am (script_test_5.sh): New test case.
11666         * testsuite/Makefile.in: Regenerate.
11667         * testsuite/script_test_5.cc: New file.
11668         * testsuite/script_test_5.sh: New file.
11669         * testsuite/script_test_5.t: New file.
11670
11671 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11672
11673         * archive.cc (Archive::include_member): Update calls to add_symbols.
11674         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11675         the Layout argument.
11676         * dynobj.h (do_add_symbols): Add the Layout argument.
11677         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11678         Layout argument.
11679         * object.h (Object::add_symbols): Add the Layout argument.
11680         (Object::do_add_symbols): Add the Layout argument.
11681         (Sized_relobj::do_add_symbols): Add the Layout argument.
11682         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11683         Unify the two versions.
11684         (Add_plugin_symbols): Remove.
11685         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11686         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11687         (Add_plugin_symbols): Remove.
11688         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11689         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11690         (Add_symbols::run): Make it work with Pulginobj.
11691
11692 2009-02-06  Ian Lance Taylor  <iant@google.com>
11693
11694         * object.cc (Sized_relobj::do_layout): Make info message start
11695         with lower case letter.
11696
11697 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11698
11699         * binary.cc: Fix file comment.
11700
11701         * options.h (enum Incremental_disposition): Define.
11702         (class General_options): Add new options: --incremental,
11703         --incremental_changed, --incremental_unchanged,
11704         --incremental_unknown.  Add incremental_disposition_ and
11705         implicit_incremental_ fields.
11706         (General_options::incremental_disposition): New function.
11707         (class Position_dependent_options): Add incremental_disposition
11708         option.
11709         (Position_dependent_options::copy_from_options): Set incremental
11710         dispositions.
11711         * options.cc (General_options::parse_incremental_changed): New
11712         function.
11713         (General_options::parse_incremental_unchanged): New function.
11714         (General_options::parse_incremental_unknown): New function.
11715         (General_options::General_options): Initialize new fields
11716         incremental_disposition_ and implicit_incremental_.
11717         (General_options::finalize): Check for uasge of --incremental-*
11718         without --incremental.
11719
11720 2009-02-06  Chris Demetriou  <cgd@google.com>
11721
11722         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11723         pointer and to report location as the file name associated with
11724         the symbol.
11725         (gold_undefined_symbol_at_location): New function to replace the
11726         old gold_undefined_symbol functionality.
11727         * target-reloc.h (relocate_section): Update to use
11728         gold_undefined_symbol_at_location.
11729         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11730         Call gold_undefined_symbol function rather than gold_error.
11731         * errors.h (Errors::undefined_symbol): Take location as a
11732         string, rather than calculating it from a relocation.
11733         * errors.cc (Errors::fatal): Print "fatal error:" before the
11734         formatted message.
11735         (Errors::error, Errors::error_at_location): Print "error: "
11736         before the formatted message.
11737         (Errors::undefined_symbol): Take location as a string, rather
11738         than calculating it from a relocation.
11739         (gold_undefined_symbol_at_location): New function akin to
11740         old gold_undefined_symbol, calculates location from relocation.
11741         (gold_undefined_symbol): Change to take only a Symbol pointer
11742         and to report location as the file name associated with the symbol.
11743         * testsuite/debug_msg.sh: Update for changed error messages.
11744         * testsuite/undef_symbol.sh: Likewise.
11745
11746 2009-02-04  Duncan Sands  <baldrick@free.fr>
11747
11748         PR 9812
11749         * reduced_debug_output.h
11750         (Output_reduced_debug_abbrev_section::failed): Use format for
11751         gold_warning.
11752         (Output_reduced_debug_info_section::faild): Likewise.
11753
11754 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11755
11756         * script.cc (Lazy_demangler): New class.
11757         (Version_script_info::get_symbol_version_helper): Demangle a
11758         symbol only once.
11759
11760 2009-01-29  Cary Coutant  <ccoutant@google.com>
11761
11762         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11763         to __tls_get_addr.
11764         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11765
11766 2009-01-28  Ian Lance Taylor  <iant@google.com>
11767
11768         * version.cc (version_string): Bump to 1.9.
11769
11770         * gold.h: Include <cstring> and <stdint.h>.
11771         * version.cc: Include <cstdio>.
11772         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11773         warning.
11774         * reduced_debug_output.cc (insert_into_vector): Rename from
11775         Insert_into_vector; change all callers.  Use Swap_unaligned to
11776         avoid aliasing issue; remove union since it is unnecessary.
11777
11778 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11779
11780         * Makefile.am (CCFILES): Add gc.cc.
11781         (HFILES): Add gc.h.
11782         * Makefile.in: Regenerate.
11783         * gold.cc (Gc_runner): New class.
11784         (queue_initial_tasks): Call garbage collection related tasks
11785         when corresponding options are invoked.
11786         (queue_middle_gc_tasks): New function.
11787         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11788         processed early before laying out sections during garbage collection.
11789         * gold.h (queue_middle_gc_tasks): New function.
11790         (is_prefix_of): Move from "layout.cc".
11791         * i386.cc (Target_i386::gc_process_relocs): New function.
11792         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11793         * main.cc (main): Create object of class "Garbage_collection".
11794         * object.cc (Relobj::copy_symbols_data): New function.
11795         (Relobj::is_section_name_included): New function.
11796         (Sized_relobj::do_layout): Allow this function to be called twice
11797         during garbage collection and defer layout of section during the
11798         first call.
11799         * object.h (Relobj::get_symbols_data): New function.
11800         (Relobj::is_section_name_included): New function.
11801         (Relobj::copy_symbols_data): New function.
11802         (Relobj::set_symbols_data): New function.
11803         (Relobj::get_relocs_data): New function.
11804         (Relobj::set_relocs_data): New function.
11805         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11806         (Relobj::gc_process_relocs): New function.
11807         (Relobj::do_gc_process_relocs): New pure virtual function.
11808         (Relobj::sd_): New data member.
11809         (Sized_relobj::is_output_section_offset_invalid): New function.
11810         (Sized_relobj::do_gc_process_relocs): New function.
11811         * options.h (General_options::gc_sections): Modify to not be a no-op.
11812         (General_options::print_gc_sections): New option.
11813         * plugin.cc (Plugin_finish::run): Remove function call to
11814         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11815         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11816         * reloc.cc (Read_relocs::run): Add task to process relocs and
11817         determine unreferenced sections when doing garbage collection.
11818         (Gc_process_relocs): New class.
11819         (Sized_relobj::do_gc_process_relocs): New function.
11820         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11821         sections that are garbage collected.
11822         * reloc.h (Gc_process_relocs): New class.
11823         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11824         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11825         symbols whose corresponding sections are garbage collected.
11826         (Symbol_table::Symbol_table): Add new parameter for the garbage
11827         collection object.
11828         (Symbol_table::gc_mark_undef_symbols): New function.
11829         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11830         (Symbol_table::gc_mark_dyn_syms): New function.
11831         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11832         as garbage.
11833         (Symbol_table::add_from_object): Likewise.
11834         (Symbol_table::add_from_relobj): When building shared objects, do not
11835         treat externally visible symbols as garbage.
11836         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11837         table information for static and relocatable links.
11838         * symtab.h (Symbol_table::set_gc): New function.
11839         (Symbol_table::gc): New function.
11840         (Symbol_table::gc_mark_undef_symbols): New function.
11841         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11842         (Symbol_table::gc_mark_dyn_syms): New function.
11843         (Symbol_table::gc_): New data member.
11844         * target.h (Sized_target::gc_process_relocs): New pure virtual
11845         function.
11846         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11847         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11848
11849 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11850
11851         * options.h (General_options::gc_sections): Define as a no-op for now.
11852         (General_options::no_keep_memory): Ditto.
11853         (General_options::Bshareable): Define.
11854         * options.cc (General_options::finalize): Honor -Bshareable.
11855
11856 2009-01-20  Andreas Schwab  <schwab@suse.de>
11857
11858         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11859         read the value in the contents, since we don't use it.  Use the
11860         template endianness when writing.
11861         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11862
11863 2009-01-19  Andreas Schwab  <schwab@suse.de>
11864
11865         * configure.tgt (powerpc64-*): Fix targ_obj.
11866
11867 2009-01-15  Ian Lance Taylor  <iant@google.com>
11868
11869         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11870         local symbols when stripping all symbols.
11871
11872 2009-01-14  Cary Coutant  <ccoutant@google.com>
11873
11874         * output.cc (Output_reloc): Add explicit instantiations.
11875
11876 2009-01-14  Cary Coutant  <ccoutant@google.com>
11877
11878         * archive.cc (Archive::get_elf_object_for_member): Remove call
11879         to File_read::claim_for_plugin.
11880         * descriptors.cc (Descriptors::open): Remove reference to
11881         is_claimed.
11882         (Descriptors::claim_for_plugin): Remove.
11883         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11884         (Descriptors::is_claimed): Remove.
11885         (claim_descriptor_for_plugin): Remove.
11886         * fileread.cc (File_read::claim_for_plugin): Remove.
11887         * fileread.h (File_read::claim_for_plugin): Remove.
11888         (File_read::descriptor): Reopen descriptor if necessary.
11889         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11890         (Plugin_manager::all_symbols_read): Add task parameter. Change
11891         all callers.
11892         (Plugin_manager::get_input_file): New function.
11893         (Plugin_manager::release_input_file): New function.
11894         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11895         corresponding data member.
11896         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11897         and pass to base constructor. Change all callers.
11898         (get_input_file, release_input_file): New functions.
11899         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11900         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11901         (Plugin_manager::all_symbols_read): Add task parameter.
11902         (Plugin_manager::get_input_file): New function.
11903         (Plugin_manager::release_input_file): New function.
11904         (Plugin_manager::task_): New data member.
11905         (Pluginobj::Pluginobj): Add filesize parameter.
11906         (Pluginobj::filename): New function.
11907         (Pluginobj::descriptor): New function.
11908         (Pluginobj::filesize): New function.
11909         (Pluginobj::filesize_): New data member.
11910         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11911         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11912         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11913
11914         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11915         with archive libraries.
11916         * testsuite/Makefile.in: Regenerate.
11917         * testsuite/plugin_test.c (struct sym_info): New type.
11918         (get_input_file, release_input_file): New static variables.
11919         (onload): Capture new transfer vector entries.
11920         (claim_file_hook): Stop reading at end of file according to filesize.
11921         Factor out parsing of readelf output into separate function.
11922         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11923         APIs and get the source file name from the symbol table.  Convert
11924         source file name to corresponding object file name.  Print info
11925         message when adding new input files.
11926         (parse_readelf_line): New function.
11927         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11928         * testsuite/plugin_test_2.sh: Likewise.
11929         * testsuite/plugin_test_3.sh: Likewise.
11930         * testsuite/plugin_test_4.sh: New test case.
11931
11932 2009-01-07  Ian Lance Taylor  <iant@google.com>
11933
11934         * version.cc (version_string): Bump to 1.8.
11935
11936 2008-12-23  Cary Coutant  <ccoutant@google.com>
11937
11938         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11939         * plugin.cc (Plugin_manager::finish): Rename as
11940         layout_deferred_objects.  Move cleanup to separate function.
11941         (Plugin_manager::cleanup): New function.
11942         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11943         separately.
11944         * plugin.h (Plugin_manager::finish): Rename as
11945         layout_deferred_objects.
11946         (Plugin_manager::cleanup): New function.
11947         (Plugin_manager::cleanup_done): New field.
11948
11949 2008-12-23  Cary Coutant  <ccoutant@google.com>
11950
11951         * plugin.cc (is_visible_from_outside): New function.
11952         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11953         so we don't return "IR only" status for exported symbols or -r links.
11954
11955         * testsuite/Makefile.am (plugin_test_3): New test case.
11956         * testsuite/Makefile.in: Regenerate.
11957         * testsuite/plugin_test_3.sh: New file.
11958
11959 2008-12-22  Cary Coutant  <ccoutant@google.com>
11960
11961         * object.cc (Sized_relobj::layout_section): New function.
11962         (Sized_relobj::do_layout): Defer layout of input sections until after
11963         plugin has provided replacement files.
11964         (Sized_relobj::do_layout_deferred_sections): New function.
11965         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11966         (Relobj::layout_deferred_sections): New function.
11967         (Relobj::do_layout_deferred_sections): New function.
11968         (Sized_relobj::do_layout_deferred_sections): New function.
11969         (Sized_relobj::layout_section): New function.
11970         (Sized_relobj::Deferred_layout): New structure.
11971         (Sized_relobj::deferred_layout_): New field.
11972         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11973         Change all callers.  Layout deferred sections.
11974         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11975         references.
11976         (Plugin_hook::run): Move code from do_plugin_hook inline.
11977         (Plugin_hook::do_plugin_hook): Remove.
11978         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11979         (Plugin_manager::finish): Renamed, was cleanup.
11980         (Plugin_manager::should_defer_layout): New function.
11981         (Plugin_manager::add_deferred_layout_object): New function.
11982         (Plugin_manager::Deferred_layout_list): New type.
11983         (Plugin_manager::deferred_layout_objects_): New field.
11984         (Plugin_hook::do_plugin_hook): Remove.
11985
11986 2008-12-17  Ian Lance Taylor  <iant@google.com>
11987
11988         * options.h (class General_options): Add --no case for
11989         --export-dynamic.
11990
11991 2008-12-16  Cary Coutant  <ccoutant@google.com>
11992
11993         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11994         vector.
11995         (Plugin_manager::claim_file): Create plugin object even if
11996         plugin did not call the add_symbols callback.
11997         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11998         asking for more symbols than were added.
11999         * testsuite/Makefile.am (plugin_test_1): Add test case with
12000         no global symbols.
12001         (empty.syms): New target.
12002         * testsuite/Makefile.in: Regenerate.
12003         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12004         message. Don't call add_symbols if no globals.
12005         (all_symbols_read_hook): Don't provide replacement for empty
12006         claimed file.
12007
12008 2008-12-12  Ian Lance Taylor  <iant@google.com>
12009
12010         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12011         r_type == 0 for a local symbol with r_sym == 0.
12012         (scan_relocatable_relocs): Pass r_sym to
12013         local_non_section_strategy.
12014         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12015         r_sym parameter.
12016
12017         * configure.ac: Update test for TLS descriptors: they are
12018         supported as of glibc 2.9.
12019         * configure: Rebuild.
12020
12021 2008-12-11  Ian Lance Taylor  <iant@google.com>
12022
12023         PR 7091
12024         * target-reloc.h (Default_scan_relocatable_relocs): For each
12025         function, map r_type == 0 to RELOC_DISCARD.
12026
12027 2008-12-10  Cary Coutant  <ccoutant@google.com>
12028
12029         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12030         object to override a kept COMDAT group from a plugin object.
12031
12032 2008-12-09  Ian Lance Taylor  <iant@google.com>
12033
12034         PR 7088
12035         * yyscript.y (file_cmd): Handle INPUT.
12036
12037         * testsuite/initpri1.c: Change all declarations to be full
12038         prototypes by adding void, to avoid compiler warnings.
12039
12040 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12041
12042         * options.cc (General_options::parse_plugin_opt): New.
12043         (General_options::add_plugin): The argument now is just the filename.
12044         (General_options::add_plugin_option): New.
12045         * options.h (plugin_opt): New.
12046         (add_plugin): Change argument name.
12047         (add_plugin_option): New.
12048         * plugin.cc (Plugin::load): Don't parse the plugin option.
12049         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12050         (Plugin::add_option): New.
12051         (Plugin::args_): Change type.
12052         (Plugin::filename_): New.
12053         (Plugin_manager::add_plugin_option): New.
12054         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12055         * testsuite/Makefile.in: Regenerate.
12056
12057 2008-12-05  Cary Coutant  <ccoutant@google.com>
12058
12059         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12060         Handle --strip-lto-sections option.
12061         * options.h (strip_lto_sections): New option.
12062
12063 2008-12-01  Cary Coutant  <ccoutant@google.com>
12064
12065         * plugin.cc (ld_plugin_message): Change format parameter to const.
12066         Fix mismatch between new[] and delete.
12067
12068 2008-11-14  Cary Coutant  <ccoutant@google.com>
12069
12070         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12071         instead of -1U.
12072
12073 2008-11-05  Craig Silverstein  <csilvers@google.com>
12074
12075         * options.cc (General_options::parse_dynamic_list): New function.
12076         * options.h (General_options): New flags dynamic_list,
12077         dynamic_list_data, dynamic_list_cpp_new, and
12078         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12079         (General_options::in_dynamic_list): New function.
12080         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12081         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12082         (Lex::can_continue_name): Likewise.
12083         (yylex): Likewise.
12084         (read_script_file): New parameter script_options.
12085         (read_dynamic_list): New function.
12086         (Script_options::define_dynamic_list): New function.
12087         (dynamic_list_keyword_parsecodes): New variable.
12088         (dynamic_list_keywords): New variable.
12089         * script.h (Script_options::define_dynamic_list): New function
12090         prototype.
12091         (read_dynamic_list): New function prototype.
12092         * symtab.cc (strprefix): New macro.
12093         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12094         dynamic_list_data, dynamic_list_cpp_new, and
12095         dynamic_list_cpp_typeinfo.
12096         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12097         (dynamic_list_expr): New rule.
12098         (dynamic_list_nodes): Likewise.
12099         (dynamic_list_node): Likewise.
12100         * testsuite/Makefile.am (dynamic_list): New test.
12101         * testsuite/Makefile.in: Regenerated.
12102         * testsuite/dynamic_list.t: New file.
12103         * testsuite/dynamic_list.sh: New file.
12104
12105 2008-11-05  Craig Silverstein  <csilvers@google.com>
12106
12107         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12108         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12109         (t11_last): Likewise.
12110         * testsuite/ver_test_6.c (main): Likewise.
12111
12112 2008-10-07  Cary Coutant  <ccoutant@google.com>
12113
12114         * options.c (General_options::finalize): Add check for -static and
12115         -shared.
12116         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12117         is not empty.
12118
12119 2008-10-02  Cary Coutant  <ccoutant@google.com>
12120
12121         * plugin.cc (make_sized_plugin_object): Fix conditional
12122         compilation to work when not all targets are enabled.
12123
12124 2008-09-29  Cary Coutant  <ccoutant@google.com>
12125
12126         * archive.cc (Archive::get_file_and_offset): Use filename instead
12127         of name to get library path.
12128         (Archive::include_member): Unlock external member of a thin archive.
12129
12130         * testsuite/Makefile.am (TEST_AR): New variable.
12131         (thin_archive_test_1): New test.
12132         (thin_archive_test_2): New test.
12133         * testsuite/Makefile.in: Regenerate.
12134         * testsuite/thin_archive_main.cc: New file.
12135         * testsuite/thin_archive_test_1.cc: New file.
12136         * testsuite/thin_archive_test_2.cc: New file.
12137         * testsuite/thin_archive_test_3.cc: New file.
12138         * testsuite/thin_archive_test_4.cc: New file.
12139
12140 2008-09-29  Cary Coutant  <ccoutant@google.com>
12141
12142         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12143         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12144         instead of -1U.
12145         (Sized_relobj::do_finalize_local_symbols): Likewise.
12146         (Sized_relobj::map_to_kept_section): Likewise.
12147         * object.h (Sized_relobj::invalid_address): New constant.
12148         (Sized_relobj::do_output_section_offset): Check for invalid_address
12149         and return -1ULL.
12150         * output.cc (Output_reloc::local_section_offset): Use constant
12151         invalid_address instead of -1U.
12152         (Output_reloc::get_address): Likewise.
12153         (Output_section::output_address): Change -1U to -1ULL.
12154         * output.h (Output_reloc::invalid_address): New constant.
12155         * reloc.cc (Sized_relobj::write_sections): Use constant
12156         invalid_address instead of -1U.
12157         (Sized_relobj::relocate_sections): Likewise.
12158         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12159         values for merge sections.
12160         * target-reloc.h (relocate_for_relocatable): Use constant
12161         invalid_address instead of -1U.
12162
12163 2008-09-19  Cary Coutant  <ccoutant@google.com>
12164
12165         Add plugin functionality for link-time optimization (LTO).
12166         * configure.ac (plugins): Add --enable-plugins option.
12167         * configure: Regenerate.
12168         * config.in: Regenerate.
12169         * Makefile.am (LIBDL): New variable.
12170         (CCFILES): Add plugin.cc.
12171         (HFILES): Add plugin.h.
12172         (ldadd_var): Add LIBDL.
12173         * Makefile.in: Regenerate.
12174
12175         * archive.cc: Include "plugin.h".
12176         (Archive::setup): Don't preread archive symbols when using a plugin.
12177         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12178         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12179         files.
12180         (Archive::include_member): Add symbols from plugin objects.
12181         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12182         * descriptors.cc (Descriptors::open): Check for file descriptors
12183         abandoned by plugins.
12184         (Descriptors::claim_for_plugin): New function.
12185         * descriptors.h (Descriptors::claim_for_plugin): New function.
12186         (Open_descriptor::is_claimed): New field.
12187         (claim_descriptor_for_plugin): New function.
12188         * fileread.cc (File_read::claim_for_plugin): New function.
12189         * fileread.h (File_read::claim_for_plugin): New function.
12190         (File_read::descriptor): New function.
12191         * gold.cc: Include "plugin.h".
12192         (queue_initial_tasks): Add task to call plugin hooks for generating
12193         new object files.
12194         * main.cc: Include "plugin.h".
12195         (main): Load plugin libraries.
12196         * object.h (Pluginobj): Declare.
12197         (Object::pluginobj): New function.
12198         (Object::do_pluginobj): New function.
12199         (Object::set_target): New function.
12200         * options.cc: Include "plugin.h".
12201         (General_options::parse_plugin): New function.
12202         (General_options::General_options): Initialize plugins_ field.
12203         (General_options::add_plugin): New function.
12204         * options.h (Plugin_manager): Declare.
12205         (General_options): Add --plugin option.
12206         (General_options::has_plugins): New function.
12207         (General_options::plugins): New function.
12208         (General_options::add_plugin): New function.
12209         (General_options::plugins_): New field.
12210         * plugin.cc: New file.
12211         * plugin.h: New file.
12212         * readsyms.cc: Include "plugin.h".
12213         (Read_symbols::do_read_symbols): Check for archive before checking
12214         for ELF file.  Call plugin hooks to claim files.
12215         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12216         from a real object file; force override when processing replacement
12217         files.
12218         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12219         (Symbol::init_base_object): Likewise.
12220         (Symbol::init_base_output_data): Likewise.
12221         (Symbol::init_base_output_segment): Likewise.
12222         (Symbol::init_base_constant): Likewise.
12223         (Symbol::init_base_undefined): Likewise.
12224         (Symbol::output_section): Assert that object is not a plugin.
12225         (Symbol_table::add_from_pluginobj): New function.
12226         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12227         undefined.
12228         (Symbol_table::sized_write_globals): Likewise.
12229         (Symbol_table::add_from_pluginobj): Instantiate template.
12230         * symtab.h (Sized_pluginobj): Declare.
12231         (Symbol::in_real_elf): New function.
12232         (Symbol::set_in_real_elf): New function.
12233         (Symbol::in_real_elf_): New field.
12234         (Symbol_table::add_from_pluginobj): New function.
12235
12236         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12237         (LIBDL): New variable.
12238         (LDADD): Add LIBDL.
12239         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12240         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12241         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12242         (MOSTLYCLEANFILES): Likewise.
12243         * testsuite/Makefile.in: Regenerate.
12244         * testsuite/plugin_test.c: New file.
12245         * testsuite/plugin_test_1.sh: New file.
12246         * testsuite/plugin_test_2.sh: New file.
12247
12248 2008-09-16  Ian Lance Taylor  <iant@google.com>
12249
12250         * target-reloc.h (relocate_section): Check whether a symbol is
12251         defined by the ABI before reporting an undefined symbol error.
12252         * target.h (Target::is_defined_by_abi): Make parameter const.
12253         (Target::do_is_defined_by_abi): Likewise.
12254         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12255         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12256         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12257         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12258         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12259         * testsuite/Makefile.in: Rebuild.
12260
12261         * fileread.cc (make_view): Add casts to avoid warning.
12262
12263 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12264
12265         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12266         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12267
12268 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12269
12270         * options.h (General_options::output_is_executable): New.
12271         (General_options::output_is_pie): New.
12272         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12273         for shared libraries.
12274         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12275
12276 2008-09-11  Chris Demetriou  <cgd@google.com>
12277
12278         * options.h (origin): New -z option.
12279         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12280         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12281         in DT_FLAGS_1.
12282
12283 2008-09-05  Cary Coutant  <ccoutant@google.com>
12284
12285         * fileread.cc (File_read::make_view): Add check for attempt to map
12286         beyond end of file.
12287
12288 2008-09-05  Cary Coutant  <ccoutant@google.com>
12289
12290         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12291         explicit instantiations.
12292
12293 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12294
12295         PR gold/6858
12296         * options.cc (General_options::finalize): Allow undefined symbols
12297         in shlibs if linking -shared.
12298
12299         PR gold/6859
12300         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12301         symbols as not needing a dynsym entry.
12302
12303 2008-08-20  Craig Silverstein  <csilvers@google.com>
12304
12305         * fileread.cc (File_read::open): Do not lock the file unless it
12306         was successfully opened.
12307
12308 2008-08-14  Cary Coutant  <ccoutant@google.com>
12309
12310         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12311         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12312         * testsuite/tls_test.cc (struct int128): 128-bit struct
12313         for testing TLS relocs with non-zero addend.
12314         (v12): New TLS variable.
12315         (t12): New test.
12316         (t_last): Add check for v12.
12317         * testsuite/tls_test.h (t12): New function.
12318         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12319
12320 2008-08-13  Ian Lance Taylor  <iant@google.com>
12321
12322         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12323         set tls_segment_ or relro_segment_.
12324         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12325         when appropriate.
12326         * output.h (Output_section::clear_is_relro): New function.
12327         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12328         sections specially even when output_data_ is empty.
12329         (Output_segment::maximum_alignment): When first section is relro,
12330         only force alignment for PT_LOAD segments.
12331         * script.cc (script_data_segment_align): New function.
12332         (script_data_segment_relro_end): New function.
12333         * script-c.h (script_data_segment_align): Declare.
12334         (script_data_segment_relro_end): Declare.
12335         * script-sections.h (class Script_sections): Declare
12336         data_segment_align and data_segment_relro_end.  Add fields
12337         segment_align_index_ and saw_relro_end_.
12338         * script-sections.cc (class Sections_element): Add set_is_relro
12339         virtual function.  Add new bool* parameter to place_orphan_here.
12340         Add get_output_section virtual function.
12341         (class Output_section_definition): Add set_is_relro.  Add new
12342         bool* parameter to place_orphan_here.  Add get_output_section.
12343         Add is_relro_ field.
12344         (Output_section_definition::Output_section_definition): Initialize
12345         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12346         and is_relro_ fields.
12347         (Output_section_definition::place_orphan_here): Add is_relro
12348         parameter.
12349         (Output_section_definition::set_section_addresses): Set relro for
12350         output section.
12351         (Output_section_definition::alternate_constraint): Likewise.
12352         (class Orphan_output_section): Add new bool* parameter to
12353         place_orphan_here.  Add get_output_section.
12354         (Orphan_output_section::place_orphan_here): Add is_relro
12355         parameter.
12356         (Script_sections::Script_sections): Initialize
12357         data_segment_align_index_ and saw_relro_end_.
12358         (Script_sections::data_segment_align): New function.
12359         (Script_sections::data_segment_relro_end): New function.
12360         (Script_sections::place_orphan): Set or clear is_relro.
12361         (Script_sections::set_section_addresses): Force alignment of first
12362         TLS section.
12363         * yyscript.y (exp): Call script_data_segment_align and
12364         script_data_segment_relro_end.
12365         * testsuite/relro_script_test.t: New file.
12366         * testsuite/relro_test.cc (using_script): Declare.
12367         (t1, t2): Test using_script.
12368         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12369         (relro_script_test_SOURCES): Define.
12370         (relro_script_test_DEPENDENCIES): Define.
12371         (relro_script_test_LDFLAGS): Define.
12372         (relro_script_test_LDADD): Define.
12373         (relro_script_test.so): New target.
12374         * testsuite/Makefile.in: Rebuild.
12375
12376 2008-08-06  Cary Coutant <ccoutant@google.com>
12377
12378         * archive.cc (Archive::total_archives, Archive::total_members)
12379         (Archive::total_members_loaded): New variables.
12380         (Archive::setup): Add parameter.  Add option to preread
12381         archive symbols.
12382         (Archive::read_armap): Add counter.
12383         (Archive::get_file_and_offset): New function.
12384         (Archive::get_elf_object_for_member): New function.
12385         (Archive::read_all_symbols): New function.
12386         (Archive::read_symbols): New function.
12387         (Archive::add_symbols): Add counters.
12388         (Archive::include_all_members): Use armap to find members if it's
12389         already built.
12390         (Archive::include_member): Skip reading symbols if already read.
12391         Factored code into Archive::get_file_and_offset and
12392         Archive::get_elf_object_for_member.  Changed call to
12393         Mapfile::report_include_archive_member.
12394         (Archive::print_stats): New function.
12395         * archive.h: Declare Object and Read_symbols_data classes.
12396         (Archive::Archive): Add initializers for new members.
12397         (Archive::setup): Add parameter.
12398         (Archive::print_stats): New function.
12399         (Archive::total_archives, Archive::total_members)
12400         (Archive::total_members_loaded): New variables.
12401         (Archive::get_file_and_offset): New function.
12402         (Archive::get_elf_object_for_member): New function.
12403         (Archive::read_all_symbols): New function.
12404         (Archive::read_symbols): New function.
12405         (Archive::Archive_member): New class.
12406         (Archive::members_): New member.
12407         (Archive::num_members_): New member.
12408         * main.cc: Include archive.h.
12409         (main): Call Archive::print_stats.
12410         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12411         archive parameter; member_name is now the fully-decorated name.
12412         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12413         * options.h: (General_options): Add --preread-archive-symbols option.
12414         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12415         Archive::setup.
12416
12417 2008-08-04  Ian Lance Taylor  <iant@google.com>
12418
12419         * symtab.h (Symbol::use_plt_offset): New function.
12420         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12421         * powerpc.cc (Relocate::relocate): Likewise.
12422         * sparc.cc (Relocate::relocate): Likewise.
12423         * x86_64.cc (Relocate::relocate): Likewise.
12424         * testsuite/weak_plt.sh: New test.
12425         * testsuite/weak_plt_main.cc: New test.
12426         * testsuite/weak_plt_shared.cc: New test.
12427         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12428         (check_PROGRAMS): Add weak_plt.
12429         (check_DATA): Add weak_plt_shared.so.
12430         (weak_plt_main_pic.o, weak_plt): New targets.
12431         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12432         * testsuite/Makefile.in: Rebuild.
12433
12434         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12435         gcctestdir/ld.
12436         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12437         * testsuite/Makefile.in: Rebuild.
12438
12439 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12440
12441         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12442         * Makefile.in: Regenerate.
12443         * po/POTFILES.in: Regenerate.
12444
12445 2008-07-29  Ian Lance Taylor  <iant@google.com>
12446
12447         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12448         symbols before other symbols.
12449         * testsuite/script_test_2.cc (test_addr): Declare.
12450         (test_addr_alias): Declare.
12451         (main): Check that test_addr and test_addr_alias have the right
12452         values.
12453         * testsuite/script_test_2.t: Define test_addr_alias and
12454         test_addr.
12455
12456 2008-07-24  Ian Lance Taylor  <iant@google.com>
12457
12458         PR 5990
12459         * descriptors.cc: New file.
12460         * descriptors.h: New file.
12461         * gold-threads.h (class Hold_optional_lock): New class.
12462         * fileread.cc: Include "descriptors.h".
12463         (File_read::~File_read): Release descriptor rather than closing
12464         it.
12465         (File_read::open) [file]: Call open_descriptor rather than open.
12466         Set is_descriptor_opened_.
12467         (File_read::open) [memory]: Assert that descriptor is not open.
12468         (File_read::reopen_descriptor): New function.
12469         (File_read::release): Release descriptor.
12470         (File_read::do_read): Make non-const.  Reopen descriptor.
12471         (File_read::read): Make non-const.
12472         (File_read::make_view): Reopen descriptor.
12473         (File_read::do_readv): Likewise.
12474         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12475         Update declarations.
12476         * layout.cc: Include "descriptors.h".
12477         (Layout::create_build_id): Use open_descriptor rather than open.
12478         * output.cc: Include "descriptors.h".
12479         (Output_file::open): Use open_descriptor rather than open.
12480         * archive.cc (Archive::const_iterator): Change Archive to be
12481         non-const.
12482         (Archive::begin, Archive::end): Make non-const.
12483         (Archive::count_members): Likewise.
12484         * archive.h (class Archive): Update declarations.
12485         * object.h (Object::read): Make non-const.
12486         * Makefile.am (CCFILES): Add descriptors.cc.
12487         (HFILES): Add descriptors.h.
12488         * Makefile.in: Rebuild.
12489
12490         PR 6716
12491         * gold.h: Always include <clocale>.  Add Solaris workarounds
12492         following code in binutils/sysdep.h.
12493
12494         PR 6048
12495         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12496         this->eh_frame_hdr_ is NULL before using it.
12497
12498         * dynobj.cc (Versions::Versions): Update comment.
12499
12500         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12501         the base version name.
12502
12503         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12504         array size plus one.
12505         (Stringpool_template::set_string_offsets): Subtract one from key
12506         before using it as an array index.
12507         (Stringpool_template::get_offset_with_length): Likewise.
12508         (Stringpool_template::write_to_buffer): Likewise.
12509         * stringpool.h (Stringpool_template::get_offset_from_key):
12510         Likewise.
12511
12512 2008-07-23  Ian Lance Taylor  <iant@google.com>
12513
12514         PR 6658
12515         * object.h (Merged_symbol_value::value): Do our best to handle a
12516         negative addend.
12517
12518         PR 6647
12519         * script.cc (Version_script_info::get_versions): Don't add empty
12520         version tag to return value.
12521         (Version_script_info::get_symbol_version_helper): Change return
12522         type to bool.  Add pversion parameter.  Change all callers.
12523         (script_register_vers_node): Don't require a non-NULL tag.
12524         * script.h (class Version_script_info): Update declarations.
12525         (Version_script_info::get_symbol_version): Change return type to
12526         bool.  Add version parameter.  Change all callers.
12527         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12528         handling.  Handle an empty version from a version script.
12529         (Symbol_table::define_special_symbol): Likewise.
12530         * testsuite/ver_test_10.script: New file.
12531         * testsuite/ver_test_10.sh: New file.
12532         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12533         (check_DATA): Add ver_test_10.syms.
12534         (ver_test_10.syms, ver_test_10.so): New target.
12535         * testsuite/Makefile.in: Rebuild.
12536
12537 2008-07-23  Simon Baldwin  <simonb@google.com>
12538
12539         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12540         to zero for undefined symbols from dynamic libraries.
12541
12542 2008-07-23  Ian Lance Taylor  <iant@google.com>
12543
12544         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12545         Change all callers.
12546         * symtab.h (class Symbol_table): Update declaration.
12547         * testsuite/ver_test_9.cc: New file.
12548         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12549         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12550         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12551         (ver_test_9.so, ver_test_9.o): New targets.
12552         * testsuite/Makefile.in: Rebuild.
12553
12554 2008-07-22  Ian Lance Taylor  <iant@google.com>
12555
12556         * options.h (class General_options): Define --check-sections.
12557         * layout.cc (Layout::set_segment_offsets): Handle
12558         --check-sections.
12559
12560         * options.h (class General_options): Define -n/--nmagic and
12561         -N/--omagic.
12562         * options.cc (General_options::finalize): For -n/--nmagic or
12563         -N/--omagic, set -static.
12564         * layout.cc (Layout::attach_allocated_section_to_segment): If
12565         -N/--omagic, don't put read-only and read-write sections in
12566         different segments.
12567         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12568         finding a read-only segment.
12569         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12570         don't set the minimum segment alignment to the common page size,
12571         and don't set the file offset to the address modulo the page size.
12572         * script-sections.cc (Script_sections::create_segments): If
12573         -n/--omagic, don't put read-only and read-write sections in
12574         different segments.
12575
12576         * cref.cc: New file.
12577         * cref.h: New file.
12578         * options.h (class General_options): Add --print-symbol-counts.
12579         * main.cc (main): Issue defined symbol report if requested.
12580         * archive.cc (Archive::interpret_header): Make into a const member
12581         function.
12582         (Archive::add_symbols): Call Input_objects::archive_start and
12583         archive_stop.
12584         (Archive::const_iterator): Define new class.
12585         (Archive::begin, Archive::end): New functions.
12586         (Archive::include_all_members): Rewrite to use iterator.
12587         (Archive::count_members): New function.
12588         * archive.h (class Archive): Update declarations.
12589         (Archive::filename): New function.
12590         * object.cc: Include "cref.h".
12591         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12592         (Sized_relobj::do_get_global_symbol_counts): New function.
12593         (Input_objects::add_object): Add object to cross-referencer.
12594         (Input_objects::archive_start): New function.
12595         (Input_objects::archive_stop): New function.
12596         (Input_objects::print_symbol_counts): New function.
12597         * object.h: Declare Cref and Archive.
12598         (Object::get_global_symbol_counts): New function.
12599         (Object::do_get_global_symbol_counts): New pure virtual function.
12600         (class Sized_relobj): Add defined_count_ field.  Update
12601         declarations.
12602         (class Input_objects): Add cref_ field.  Update constructor.
12603         Update declarations.
12604         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12605         defined_count_.
12606         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12607         symbol counts.
12608         (Sized_dynobj::do_get_global_symbol_counts): New function.
12609         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12610         defined_count_.  Update declarations.  Define Symbols typedef.
12611         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12612         parameter.  Change all callers.
12613         (Symbol_table::add_from_dynobj): Add sympointers and defined
12614         parameters.  Change all callers.
12615         * symtab.h (class Symbol_table): Update declarations.
12616         * Makefile.am (CCFILES): Add cref.cc.
12617         (HFILES): Add cref.h.
12618         * Makefile.in: Rebuild.
12619
12620 2008-07-22  Simon Baldwin  <simonb@google.com>
12621
12622         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12623         to zero when writing undefined symbols.
12624
12625 2008-07-22  Ian Lance Taylor  <iant@google.com>
12626
12627         * output.cc (Output_section::add_input_section): Don't try to
12628         merge empty merge sections.
12629
12630 2008-07-21  Craig Silverstein  <csilvers@google.com>
12631
12632         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12633         Include symbol version in error message.
12634
12635 2008-07-20  Chris Demetriou  <cgd@google.com>
12636
12637         * configure.ac (gold_cv_c_random_seed): New configured variable.
12638         (RANDOM_SEED_CFLAGS): New substituted variable.
12639         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12640         * configure: Rebuild.
12641         * Makefile.in: Likewise.
12642         * testsuite/Makefile.in: Likewise.
12643
12644 2008-07-18  Ian Lance Taylor  <iant@google.com>
12645
12646         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12647         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12648         * testsuite/ver_test_main.cc (main): Call t4.
12649         (t4, t4_2a): Define.
12650         * testsuite/ver_test_2.cc (t4_2): Define.
12651         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12652         * testsuite/ver_test_4.cc (t4_2a): Define.
12653         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12654         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12655
12656 2008-07-17  Ian Lance Taylor  <iant@google.com>
12657
12658         * dynobj.cc (Versions::add_def): If we give an error about a
12659         missing version, go ahead and create the version anyhow.
12660
12661 2008-07-10  Ian Lance Taylor  <iant@google.com>
12662
12663         Handle output sections with more than 0x7fffffff bytes.
12664         * object.h (class Relobj): Change map_to_output_ to
12665         output_sections_, and just keep a section pointer.  Change all
12666         uses.  Move comdat group support to Sized_relobj.
12667         (Relobj::is_section_specially_mapped): Remove.
12668         (Relobj::output_section): Remove poff parameter.  Change all
12669         callers.
12670         (Relobj::output_section_offset): New function.
12671         (Relobj::set_section_offset): Rewrite.
12672         (Relobj::map_to_output): Remove.
12673         (Relobj::output_sections): New function.
12674         (Relobj::do_output_section_offset): New pure virtual function.
12675         (Relobj::do_set_section_offset): Likewise.
12676         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12677         group support from Relobj.  Update declarations.
12678         (Sized_relobj::get_output_section_offset): New function.
12679         (Sized_relobj::do_output_section_offset): New function.
12680         (Sized_relobj::do_set_section_offset): New function.
12681         * object.cc (Relobj::output_section_address): Remove.
12682         (Sized_relobj::Sized_relobj): Initialize new fields.
12683         (Sized_relobj::include_section_group): Cast find_kept_object to
12684         Sized_relobj.
12685         (Sized_relobj::include_linkonce_section): Likewise.
12686         (Sized_relobj::do_layout): Use separate arrays for output section
12687         and output offset.
12688         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12689         output_sections.
12690         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12691         output_sections and section_offsets.
12692         (Sized_relobj::write_local_symbols): Likewise.
12693         (map_to_kept_section): Compute output address directly.
12694         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12695         output_sections and section_offsets.
12696         (Sized_relobj::write_sections): Likewise.
12697         (Sized_relobj::relocate_sections): Likewise.
12698         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12699         * output.h (class Output_reloc): Update declarations.  Change
12700         u2_.relobj to Sized_relobj*.
12701         (class Output_data_reloc): Change add functions to use
12702         Sized_relobj*.
12703         * output.cc (Output_reloc::Output_reloc): Change relobj to
12704         Sized_relobj*.
12705         (Output_reloc::local_section_offset): Change return type to
12706         Elf_Addr.  Use get_output_section_offset.
12707         (Output_reloc::get_address): Likewise.
12708         (Output_section::is_input_address_mapped): Don't call
12709         is_section_specially_mapped.
12710         (Output_section::output_offset): Likewise.
12711         (Output_section::output_address): Likewise.
12712         (Output_section::starting_output_address): Likewise.
12713         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12714         parameter to Sized_relobj*.
12715         (Copy_relocs::need_copy_reloc): Likewise.
12716         (Copy_relocs::save): Likewise.
12717         * copy-relocs.h (class Copy_relocs): Update declarations.
12718         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12719         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12720         * target-reloc.h (relocate_for_relocatable): Change
12721         offset_in_output_section type to Elf_Addr.  Change code that uses
12722         it as well.
12723         * layout.cc (Layout::layout): Always set *off.
12724         * mapfile.cc (Mapfile::print_input_section): Use
12725         output_section_offset.
12726         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12727         Sized_relobj*.
12728         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12729         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12730         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12731
12732 2008-07-03  Ian Lance Taylor  <iant@google.com>
12733
12734         * layout.cc (Layout::include_section): Do not discard unrecognized
12735         SHT_STRTAB sections.
12736
12737 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12738
12739         * script.cc (Lex::can_continue_name): Make '?' allowable in
12740         version-script names.
12741         * testsuite/version_script.map: Change glob pattern to use '?'
12742
12743 2008-06-30  Manish Singh  <yosh@gimp.org>
12744
12745         PR 6585
12746         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12747         Correct typo.
12748
12749 2008-06-30  Ian Lance Taylor  <iant@google.com>
12750
12751         PR 6660
12752         PR 6682
12753         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12754         versions]: Don't try to read the value in the contents, since we
12755         don't use it.  Use the template endianness when writing.
12756
12757 2008-06-25  Cary Coutant  <ccoutant@google.com>
12758
12759         * fileread.cc (File_read::make_view): Assert on zero-length view.
12760         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12761         symbol table when there are no symbols to read.
12762
12763 2008-06-23  Craig Silverstein  <csilvers@google.com>
12764
12765         * version.cc (version_string): Bump to 1.7
12766
12767 2008-06-18  Craig Silverstein  <csilvers@google.com>
12768
12769         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12770         constant 0xFFFF to type Valtype.
12771         (Powerpc_relocate_functions::rel16_ha): Likewise.
12772
12773 2008-06-17  Ian Lance Taylor  <iant@google.com>
12774
12775         * output.h (Output_section::Input_section): Initialize p2align_ to
12776         zero for Output_section_data constructors.
12777         (Output_section::Input_section::addralign): If not an input
12778         section, return the alignment of the Output_section_data.
12779         * testsuite/copy_test.cc: New file.
12780         * testsuite/copy_test_1.cc: New file.
12781         * testsuite/copy_test_2.cc: New file.
12782         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12783         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12784         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12785         (copy_test_1_pic.o, copy_test_1.so): New targets.
12786         (copy_test_2_pic.o, copy_test_2.so): New targets.
12787         * testsuite/Makefile.in: Rebuild.
12788
12789         * script-sections.cc (Script_sections::place_orphan): Initialize
12790         local variable exact.
12791
12792 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12793
12794         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12795
12796 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12797             David S. Miller  <davem@davemloft.net>
12798
12799         * powerpc.cc: New file.
12800         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12801         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12802         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12803         * Makefile.in: Rebuild.
12804
12805 2008-06-09  Ian Lance Taylor  <iant@google.com>
12806
12807         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12808         <exception>.
12809         (throwing, orig_terminate): New static variables.
12810         (terminate_handler): New static function.
12811         (t2): Set terminate handler.
12812
12813 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12814
12815         PR 6584
12816         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12817         alignment.
12818
12819 2008-05-30  Cary Coutant  <ccoutant@google.com>
12820
12821         * archive.cc (Archive::include_all_members) Correct to step
12822         over symbol table and extended name table in thin archives.
12823
12824 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12825
12826         PR 6407
12827         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12828         calculation.
12829
12830 2008-05-28  Caleb Howe  <cshowe@google.com>
12831
12832         * reduced_debug_output.cc: New file.
12833         * reduced_debug_output.h: New file.
12834         * options.h (class General_options): Add --strip-debug-non-line.
12835         * options.cc (General_options::finalize): Add strip_debug_non_line
12836         to the strip heirarchy.
12837         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12838         fields.
12839         * layout.cc: Include "reduced_debug_output.h".
12840         (Layout::Layout): Initialize new fields.
12841         (line_only_debug_sections): New static array.
12842         (is_lines_only_debug_sections): New static inline function.
12843         (Layout::include_section): Handle --strip-debug-non-line.
12844         (Layout::make_output_section): If --strip-debug-non-line, build
12845         new output sections for .debug_abbrev and .debug_info.
12846         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12847         gold.  Warn about possible overflow.
12848         (read_signed_LEB_128): Likewise.
12849         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12850         (read_signed_LEB_128): Declare.
12851         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12852         (HFILES): Add reduced_debug_output.h.
12853         * Makefile.in: Rebuild.
12854
12855 2008-05-21  Ian Lance Taylor  <iant@google.com>
12856
12857         * mapfile.cc: New file.
12858         * mapfile.h: New file.
12859         * options.h (class General_options): Add -M/--print-map and -Map.
12860         * options.cc (General_options::finalize): Make -M equivalent to
12861         -Map -.
12862         * main.cc: Include <cstdio> and "mapfile.h".
12863         (main): Open mapfile if requested.
12864         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12865         constructor.  Change caller.
12866         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12867         (queue_middle_tasks): Likewise.
12868         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12869         declarations.
12870         * archive.cc: Include "mapfile.h".
12871         (Archive::add_symbols): Add mapfile parameter.  Change all
12872         callers.  Pass mapfile, symbol, and reason to include_member.
12873         (Archive::include_all_members): Add mapfile parameter.  Change all
12874         callers.
12875         (Archive::include_member): Add mapfile, sym, and why parameters.
12876         Change all callers.  Report inclusion to map file.
12877         * archive.h: Include "fileread.h".
12878         (class Archive): Update declarations.
12879         (Archive::file): New const method.
12880         (class Add_archive_symbols): Add mapfile_ field.  Update
12881         constructor.  Change all callers.
12882         * readsyms.h (class Read_symbols): Likewise.
12883         (class Finish_group): Likewise.
12884         (class Read_script): Likewise.
12885         * common.cc: Include "mapfile.h".
12886         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12887         all callers.
12888         (Symbol_table::do_allocate_commons): Likewise.
12889         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12890         symbol allocation to mapfile.
12891         * common.h (class Allocate_commons_task): Add mapfile_ field.
12892         Update constructor.  Change all callers.
12893         * symtab.h (class Symbol_table): Update declarations.
12894         * layout.cc: Include "mapfile.h".
12895         (Layout_task_runner::run): Print information to mapfile.
12896         (Layout::create_gold_note): Change Output_data_fixed_space to
12897         Output_data_zero_fill.
12898         (Layout::create_build_id): Likewise.
12899         (Layout::print_to_mapfile): New function.
12900         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12901         constructor.  Change caller.
12902         (class Layout): Declare print_to_mapfile.
12903         * output.cc (Output_section::Input_section::print_to_mapfile): New
12904         function.
12905         (Output_section::add_input_section): If producing a map, always
12906         add to input_sections_ list.
12907         (Output_section::do_print_to_mapfile): New function.
12908         (Output_segment::print_sections_to_mapfile): New function.
12909         (Output_segment::print_section_list_to_mapfile): New function.
12910         * output.h: Include "mapfile.h".
12911         (Output_data::print_to_mapfile): New function.
12912         (Output_data::do_print_to_mapfile): New virtual function.
12913         (Output_segment_headers::do_print_to_mapfile): New function.
12914         (Output_file_header::do_print_to_mapfile): New function.
12915         (Output_data_const::do_print_to_mapfile): New function.
12916         (class Output_data_const_buffer): Add map_name_ field.  Update
12917         constructor.  Change all callers.  Add do_print_to_mapfile
12918         function.
12919         (class Output_data_fixed_space): Likewise.
12920         (class Output_data_space): Likewise.
12921         (class Output_data_zero_fill): New class.
12922         (Output_data_strtab::do_print_to_mapfile): New function.
12923         (Output_data_reloc_base::do_print_to_mapfile): New function.
12924         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12925         (Output_data_group::do_print_to_mapfile): New function.
12926         (Output_data_got::do_print_to_mapfile): New function.
12927         (Output_data_dynamic::do_print_to_mapfile): New function.
12928         (Output_symtab_xindex::do_print_to_mapfile): New function.
12929         (class Output_section): Declare do_print_to_mapflie.  Declare
12930         print_to_mapfile in Input_section.
12931         (class Output_segment): Declare new functions.
12932         * object.h (Sized_relobj::symbol_count): New function.
12933         * script-sections.cc
12934         (Output_section_element_dot_assignment::set_section_addresses):
12935         Change Output_data_fixed_space to Output_data_zero_fill.
12936         (Output_data_expression::do_print_to_mapfile): New function.
12937         * script.cc (read_input_script): Add mapfile parameter.  Change
12938         all callers.
12939         * script.h (read_input_script): Update declaration.
12940         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12941         (Eh_frame::do_print_to_mapfile): New function.
12942         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12943         (Output_merge_string::do_print_to_mapfile): New function.
12944         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12945         function.
12946         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12947         function.
12948         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12949         function.
12950         * Makefile.am (CCFILES): Add mapfile.cc.
12951         (HFILES): Add mapfile.h.
12952         * Makefile.in: Rebuild.
12953
12954 2008-05-19  Ian Lance Taylor  <iant@google.com>
12955
12956         * options.h (class General_options): Add -z relro.
12957         * layout.cc (Layout::Layout): Initialize relro_segment_.
12958         (Layout::add_output_section_data): Return the output section.
12959         (Layout::make_output_section): Rcognize relro sections and mark
12960         them appropriately.
12961         (Layout::attach_allocated_section_to_segment): Put relro sections
12962         in a PT_GNU_RELRO segment.
12963         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12964         section as relro.
12965         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12966         PT_TLS segments.
12967         (Layout::linkonce_mapping): Map d.rel.ro.local to
12968         .data.rel.ro.local.
12969         (Layout::output_section_name): Us .data.rel.ro.local for any
12970         section which begins with that.
12971         * layout.h (class Layout): Update add_output_section_data
12972         declaration.  Add relro_segment_ field.
12973         * output.cc (Output_section::Output_section): Initialize is_relro_
12974         and is_relro_local_ fields.
12975         (Output_segment::add_output_section): Group relro sections.
12976         (Output_segment::is_first_section_relro): New function.
12977         (Output_segment::maximum_alignment): If there is a relro section,
12978         align the segment to the common page size.
12979         (Output_segment::set_section_addresses): Track whether we are
12980         looking at relro sections.  If the last section is a relro
12981         section, align to the common page size.
12982         (Output_segment::set_section_list_addresses): Add in_relro
12983         parameter.  Change all callers.  Align to the page size when
12984         moving from relro to non-relro section.
12985         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12986         segment.
12987         * output.h (class Output_section): Add is_relro_ and
12988         is_relro_local_ fields.
12989         (Output_section::is_relro): New function.
12990         (Output_section::set_is_relro): New function.
12991         (Output_section::is_relro_local): New function.
12992         (Output_section::set_is_relro_local): New function.
12993         (class Output_segment): Update declarations.
12994         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12995         * sparc.cc (Target_sparc::got_section): Likewise.
12996         * x86_64.cc (Target_x86_64::got_section): Likewise.
12997         * testsuite/relro_test_main.cc: New file.
12998         * testsuite/relro_test.cc: New file.
12999         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13000         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13001         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13002         (relro_test.so, relro_test_pic.o): New targets.
13003         * testsuite/Makefile.in: Rebuild.
13004
13005 2008-05-16  Ian Lance Taylor  <iant@google.com>
13006
13007         * output.cc (Output_segment::add_output_section): Remove front
13008         parameter.
13009         * output.h (class Output_segment): Remove
13010         add_initial_output_section and overloaded add_output_section.
13011         Update declaration of remaining add_output_section.
13012         * layout.cc (Layout::create_interp): Call add_output_section
13013         rather than add_initial_output_section.
13014         (Layout::finish_dynamic_section): Likewise.
13015
13016         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13017         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13018         know the dynamic type.
13019         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13020         field.  Initialize it in constructor.
13021         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13022         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13023         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13024         reloc.
13025
13026         * output.cc (Output_reloc::get_address): Change return type to
13027         Elf_Addr.
13028         * output.h (class Output_reloc): Update get_address declaration.
13029         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13030         for section addresses.
13031
13032 2008-05-09  Ian Lance Taylor  <iant@google.com>
13033
13034         PR 6493
13035         * gold.cc (gold_nomem): Use return value of write.
13036
13037 2008-05-08  Ian Lance Taylor  <iant@google.com>
13038
13039         * symtab.c (Symbol::init_base_output_data): Add version
13040         parameter.  Change all callers.
13041         (Symbol::init_base_output_segment): Likewise.
13042         (Symbol::init_base_constant): Likewise.
13043         (Symbol::init_base_undefined): Likewise.
13044         (Sized_symbol::init_output_data): Likewise.
13045         (Sized_symbol::init_output_segment): Likewise.
13046         (Sized_symbol::init_constant): Likewise.
13047         (Sized_symbol::init_undefined): Likewise.
13048         (Symbol_table::do_define_in_output_data): If the new symbol has a
13049         version, mark it as the default.
13050         (Symbol_table::do_define_in_output_segment): Likewise.
13051         (Symbol_table::do_define_as_constant): Likewise.
13052         * symtab.h (class Symbol): Update declarations.
13053         (class Sized_symbol): Likewise.
13054         * resolve.cc (Symbol::override_version): New function.
13055         (Symbol::override_base): Call override_version.
13056         (Symbol::override_base_with_special): Likewise.
13057         * testsuite/ver_script_8.script: New file.
13058         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13059         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13060         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13061         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13062
13063 2008-05-06  Ian Lance Taylor  <iant@google.com>
13064
13065         PR 6049
13066         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13067         functions.
13068         (class General_options): Remove existing --undefined, and add
13069         --no-undefined instead.  Add new --undefined as synonym for -u.
13070         * archive.cc (Archive::add_symbols): Check whether symbol was
13071         named with -u.
13072         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13073         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13074         all uses.  Add IS_UNDEFINED.  Update declarations to split
13075         different versions of init_base.  Declare init_base_undefined.
13076         (Symbol::is_defined): Handle IS_UNDEFINED.
13077         (Symbol::is_undefined): Likewise.
13078         (Symbol::is_weak_undefined): Call is_undefined.
13079         (Symbol::is_absolute): Handle IS_CONSTANT.
13080         (class Sized_symbol): Update declarations to split different
13081         versions of init.  Declare init_undefined.
13082         (class Symbol_table): Declare new functions.
13083         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13084         Change all callers.
13085         (Symbol::init_base_output_data): Likewise.
13086         (Symbol::init_base_output_segment): Likewise.
13087         (Symbol::init_base_constant): Likewise.
13088         (Symbol::init_base_undefined): New function.
13089         (Sized_symbol::init_object): Rename from init.  Change all
13090         callers.
13091         (Sized_symbol::init_output_data): Likewise.
13092         (Sized_symbol::init_output_segment): Likewise.
13093         (Sized_symbol::init_constant): Likewise.
13094         (Sized_symbol::init_undefined): New function.
13095         (Symbol_table::add_undefined_symbols_from_command_line): New
13096         function.
13097         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13098         function.
13099         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13100         (Symbol::output_section): Likewise.
13101         (Symbol::set_output_section): Likewise.
13102         (Symbol_table::sized_finalize_symbol): Likewise.
13103         (Symbol_table::sized_write_globals): Likewise.
13104         * resolve.cc (Symbol_table::should_override): Likewise.
13105         (Symbol::override_base_with_special): Likewise.
13106
13107         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13108         symbol, change it to have default visibility.
13109         * testsuite/protected_1.cc: New file.
13110         * testsuite/protected_2.cc: New file.
13111         * testsuite/protected_3.cc: New file.
13112         * testsuite/protected_main_1.cc: New file.
13113         * testsuite/protected_main_2.cc: New file.
13114         * testsuite/protected_main_3.cc: New file.
13115         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13116         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13117         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13118         (protected_1.so): New target.
13119         (protected_1_pic.o, protected_2_pic.o): New targets.
13120         (protected_3_pic.o): New target.
13121         (check_PROGRAMS): Add protected_2.
13122         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13123         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13124         * testsuite/Makefile.in: Rebuild.
13125
13126         * options.h (DEFINE_var): Add set_user_set_##varname__.
13127         (DEFINE_bool_alias): New macro.
13128         (class General_options): Define -Bstatic using DEFINE_bool_alias
13129         rather than DEFINE_special.  Add --undefined as an alias for -z
13130         defs.
13131         * options.cc (General_options::parse_Bstatic): Remove.
13132
13133         * options.h (class General_options): Add --fatal-warnings.
13134         * main.cc (main): Implement --fatal-warnings.
13135         * errors.h (Errors::warning_count): New function.
13136
13137         * options.h (class General_options): Add -Bsymbolic-functions.
13138         * symtab.h (Symbol::is_preemptible): Check for
13139         -Bsymbolic-functions.
13140
13141 2008-05-05  Ian Lance Taylor  <iant@google.com>
13142
13143         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13144         as noVARNAME rather than no-VARNAME.
13145         (class General_options): Add option -z combreloc.
13146         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13147         get_address.
13148         (Output_reloc::sort_before) [SHT_REL]: New function.
13149         (Output_reloc::sort_before) [SHT_RELA]: New function.
13150         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13151         Sort_relocs_comparison.
13152         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13153         parameter.  Change all callers.
13154         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13155         sort_relocs parameter.  Change all callers.
13156         * output.cc (Output_reloc::get_address): New function, broken out
13157         of write_rel.
13158         (Output_reloc::write_rel): Call it.
13159         (Output_reloc::compare): New function.
13160         (Output_data_reloc_base::do_write): Optionally sort relocs.
13161
13162         * configure.ac: If targ_extra_obj is set, link it in.
13163         * configure.tgt: Initialize all variables.
13164         (x86_64*): Set targ_extra_obj and targ_extra_size.
13165         * configure: Rebuild.
13166
13167         * object.cc (Sized_relobj::include_section_group): Adjust section
13168         indexes read from group data.  Build vector to pass to
13169         layout_group.
13170         * layout.cc (Layout::layout_group): Add flags and shndxes
13171         parameters.  Remove contents parameter.  Change caller.  Update
13172         explicit instantiations.
13173         * layout.h (class Layout): Update layout_group declaration.
13174         * output.cc (Output_data_group::Output_data_group): Add flags and
13175         input_shndxes parameters.  Remove contents parameter.  Change
13176         caller.
13177         (Output_data_group::do_write): Change input_sections_ to
13178         input_shndxes_.
13179         * output.h (class Output_data_group): Update constructor
13180         declaration.  Rename input_sections_ to input_shndxes_.
13181         * testsuite/many_sections_test.cc: Add template.
13182
13183 2008-04-30  Cary Coutant  <ccoutant@google.com>
13184
13185         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13186
13187         * layout.cc (Layout::include_section): Refactored check for debug
13188         info section.
13189         (Layout::add_comdat): Add new parameters.  Change type
13190         of signature parameter.  Add object and shndx to signatures table.
13191         (Layout::find_kept_object): New function.
13192         * layout.h: Include <cstring>.
13193         (Layout::is_debug_info_section): New function.
13194         (Layout::add_comdat): Add new parameters.
13195         (Layout::find_kept_object): New function.
13196         (Layout::Kept_section): New struct.
13197         (Layout::Signatures): Change type of map range.
13198         * object.cc (Relobj::output_section_address): New function.
13199         (Sized_relobj::include_section_group): Add new parameters.  Change
13200         calls to Layout::add_comdat.  Change to build table of kept comdat
13201         groups and table mapping discarded sections to kept sections.
13202         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13203         (Sized_relobj::do_layout): Change calls to include_section_group and
13204         include_linkonce_section.
13205         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13206         value to zero when section is discarded.
13207         (Sized_relobj::map_to_kept_section): New function.
13208         * object.h (Relobj::output_section_address): New function.
13209         (Relobj::Comdat_group): New type.
13210         (Relobj::find_comdat_group): New function.
13211         (Relobj::Comdat_group_table): New type.
13212         (Relobj::Kept_comdat_section): New type.
13213         (Relobj::Kept_comdat_section_table): New type.
13214         (Relobj::add_comdat_group): New function.
13215         (Relobj::set_kept_comdat_section): New function.
13216         (Relobj::get_kept_comdat_section): New function.
13217         (Relobj::comdat_groups_): New field.
13218         (Relobj::kept_comdat_sections_): New field.
13219         (Symbol_value::input_value): Update comment.
13220         (Sized_relobj::map_to_kept_section) New function.
13221         (Sized_relobj::include_linkonce_section): Add new parameter.
13222         * target-reloc.h (Comdat_behavior): New type.
13223         (get_comdat_behavior): New function.
13224         (relocate_section): Add code to map a discarded section to the
13225         corresponding kept section when applying a relocation.
13226
13227 2008-04-30  Craig Silverstein  <csilvers@google.com>
13228
13229         * dwarf_reader.cc (next_generation_count): New static var.
13230         (Addr2line_cache_entry): New struct.
13231         (addr2line_cache): New static var.
13232         (Dwarf_line_info::one_addr2line): Added caching.
13233         (Dwarf_line_info::clear_addr2line_cache): New function.
13234         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13235         cache-size parameter.
13236         (Dwarf_line_info::one_addr2line_cache): New function.
13237         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13238         new cache-size argument to one_addr2line(), and clear cache.
13239
13240 2008-04-28  Cary Coutant  <ccoutant@google.com>
13241
13242         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13243         R_386_PC8 relocations.
13244
13245 2008-04-23  Ian Lance Taylor  <iant@google.com>
13246
13247         * object.cc (Sized_relobj::include_section_group): Check for
13248         invalid section group.
13249
13250         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13251         header size.
13252
13253         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13254         than read for file header.
13255         * archive.cc (Archive::include_member): Likewise.
13256
13257 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13258
13259         * aclocal.m4: Regenerate.
13260         * configure: Regenerate.
13261
13262 2008-04-19  Ian Lance Taylor  <iant@google.com>
13263
13264         * version.cc (version_string): Bump to 1.6.
13265
13266         * testsuite/Makefile.am (many_sections_r_test): New target.
13267         (many_sections_r_test_SOURCES): Remove.
13268         (many_sections_r_test_DEPENDENCIES): Remove.
13269         (many_sections_r_test_LDFLAGS): Remove.
13270         (many_sections_r_test_LDADD): Remove.
13271
13272         * object.cc (Sized_relobj::do_add_symbols): Always pass
13273         local_symbol_count_ to add_from_relobj.
13274
13275         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13276         every thousand variables.
13277         * testsuite/Makefile.in: Rebuild.
13278
13279         * object.cc (Xindex::initialize_symtab_xindex): New function.
13280         (Xindex::read_symtab_xindex): New function.
13281         (Xindex::sym_xindex_to_shndx): New function.
13282         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13283         available.
13284         (Sized_relobj::do_initialize_xindex): New function.
13285         (Sized_relobj::do_read_symbols): Adjust section links.
13286         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13287         parameter.  Change all callers.
13288         (Sized_relobj::include_section_group): Adjust section links and
13289         symbol section indexes.
13290         (Sized_relobj::do_layout): Adjust section links.
13291         (Sized_relobj::do_count_local_symbols): Adjust section links and
13292         symbol section indexes.
13293         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13294         ordinary and special symbols.
13295         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13296         dynsym_xindex parameters.  Change all callers.  Adjust section
13297         links.  Use SHN_XINDEX when needed.
13298         (Sized_relobj::get_symbol_location_info): Adjust section links.
13299         Don't get fooled by special symbols.
13300         * object.h (class Xindex): Define.
13301         (class Object): Add xindex_ parameter.  Declare virtual functoin
13302         do_initialize_xindex.
13303         (Object::adjust_sym_shndx): New function.
13304         (Object::set_xindex): New protected function.
13305         (class Symbol_value): Add is_ordinary_shndx_ field.
13306         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13307         (Symbol_value::value): Assert ordinary section.
13308         (Symbol_value::initialize_input_to_output_map): Likewise.
13309         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13310         Change all callers.
13311         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13312         all callers.
13313         (class Sized_relobj): Update declarations.
13314         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13315         parameter.  Change all callers.
13316         (Sized_relobj::adjust_shndx): New function.
13317         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13318         field.
13319         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13320         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13321         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13322         (Sized_dynobj::read_dynsym_section): Adjust section links.
13323         (Sized_dynobj::read_dynamic): Likewise.
13324         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13325         section links.
13326         (Sized_dynobj::do_initialize_xindex): New function.
13327         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13328         do_initialize_xindex.
13329         (Sized_dynobj::adjust_shndx): New function.
13330         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13331         dynsym_xindex_ fields.
13332         (Layout::finalize): Add a call to set_section_indexes before
13333         creating the symtab sections.
13334         (Layout::set_section_indexes): Don't do anything if the section
13335         already has a section index.
13336         (Layout::create_symtab_sections): Add shnum parameter.  Change
13337         caller.  Create .symtab_shndx section if needed.
13338         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13339         caller.
13340         (Layout::allocated_output_section_count): New function.
13341         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13342         needed.
13343         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13344         fields.  Update declarations.
13345         (Layout::symtab_xindex): New function.
13346         (Layout::dynsym_xindex): New function.
13347         (class Write_symbols_task): Add layout_ field.
13348         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13349         Change caller.
13350         * output.cc (Output_section_headers::Output_section_headers): Add
13351         shstrtab_section parameter.  Change all callers.
13352         (Output_section_headers::do_sized_write): Store overflow values
13353         for section count and section string table section index in
13354         section header zero.
13355         (Output_file_header::do_sized_write): Check for overflow of
13356         section count and section string table section index.
13357         (Output_symtab_xindex::do_write): New function.
13358         (Output_symtab_xindex::endian_do_write): New function.
13359         * output.h (class Output_section_headers): Add shstrtab_section_.
13360         Update declarations.
13361         (class Output_symtab_xindex): Define.
13362         (Output_section::has_out_shndx): New function.
13363         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13364         field.
13365         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13366         Change all callers.
13367         (Sized_symbol::init): Likewise.
13368         (Symbol::output_section): Check for ordinary symbol.
13369         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13370         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13371         callers.
13372         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13373         Change all callers.  Simplify handling of symbols from sections
13374         not included in the link.
13375         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13376         distinction.
13377         (Weak_alias_sorter::operator()): Assert that symbols are
13378         ordinary.
13379         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13380         distinction.
13381         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13382         parameters.  Change all callers.
13383         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13384         symbol distinction.  Use SHN_XINDEX when needed.
13385         (Symbol_table::write_section_symbol): Add symtab_xindex
13386         parameter.  Change all callers.
13387         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13388         SHN_XINDEX when needed.
13389         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13390         declarations.
13391         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13392         (Symbol::is_defined): Check is_ordinary.
13393         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13394         (Symbol::is_absolute, Symbol::is_common): Likewise.
13395         (class Sized_symbol): Update declarations.
13396         (class Symbol_table): Update declarations.
13397         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13398         parameters.  Change all callers.
13399         (Sized_symbol::override): Likewise.
13400         (Symbol_table::override): Likewise.
13401         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13402         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13403         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13404         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13405         to be in an ordinary section.
13406         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13407         object and is_ordinary parameters.  Change all callers.
13408         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13409         Change all callers.  Don't add undefined or non-ordinary symbols
13410         to reloc_map_.
13411         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13412         Change all callers.
13413         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13414         declarations.
13415         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13416         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13417         (Sized_relobj::relocate_sections): Likewise.
13418         * target-reloc.h (scan_relocs): Adjust section symbol index.
13419         (scan_relocatable_relocs): Likewise.
13420         * i386.cc (Scan::local): Check for ordinary symbols.
13421         * sparc.cc (Scan::local): Likewise.
13422         * x86_64.cc (Scan::local): Likewise.
13423         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13424         to symbol_section_and_value.
13425         * testsuite/many_sections_test.cc: New file.
13426         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13427         (check_PROGRAMS): Add many_sections_test.
13428         (many_sections_test_SOURCES): Define.
13429         (many_sections_test_DEPENDENCIES): Define.
13430         (many_sections_test_LDFLAGS): Define.
13431         (BUILT_SOURCES): Add many_sections_define.h.
13432         (many_sections_define.h): New target.
13433         (BUILT_SOURCES): Add many_sections_check.h.
13434         (many_sections_check.h): New target.
13435         (check_PROGRAMS): Add many_sections_r_test.
13436         (many_sections_r_test_SOURCES): Define.
13437         (many_sections_r_test_DEPENDENCIES): Define.
13438         (many_sections_r_test_LDFLAGS): Define.
13439         (many_sections_r_test_LDADD): Define.
13440         (many_sections_r_test.o): New target.
13441         * testsuite/Makefile.in: Rebuild.
13442
13443 2008-04-17  Cary Coutant  <ccoutant@google.com>
13444
13445         * errors.cc (Errors::info): New function.
13446         (gold_info): New function.
13447         * errors.h (Errors::info): New function.
13448         * gold.h (gold_info): New function.
13449         * object.cc (Input_objects::add_object): Print trace output.
13450         * options.cc (options::parse_set): New function.
13451         (General_options::parse_wrap): Deleted.
13452         (General_options::General_options): Deleted initializer.
13453         * options.h (options::String_set): New typedef.
13454         (options::parse_set): New function.
13455         (DEFINE_set): New macro.
13456         (General_options::wrap): Changed to use DEFINE_set. Changed
13457         callers of any_wrap_symbols and is_wrap_symbol.
13458         (General_options::trace, General_options::trace_symbol):
13459         New options.
13460         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13461         (General_options::wrap_symbols_): Deleted.
13462         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13463
13464 2008-04-17  David S. Miller  <davem@davemloft.net>
13465
13466         * options.cc (General_options::parse_V): New function.
13467         * options.h: Add entries for -V and -Qy.
13468
13469 2008-04-17  Ian Lance Taylor  <iant@google.com>
13470
13471         * common.cc (Symbol_table::allocate_commons): Remove options
13472         parameter.  Change caller.
13473         (Symbol_table::do_allocate_commons): Remove options parameter.
13474         Change caller.  Just call do_allocate_commons_list twice.
13475         (Symbol_table::do_allocate_commons_list): New function, broken out
13476         of do_allocate_commons.
13477         * common.h (class Allocate_commons_task): Remove options_ field.
13478         Update constructor.
13479         * symtab.cc (Symbol_table::Symbol_table): Initialize
13480         tls_commons_.
13481         (Symbol_table::add_from_object): Put TLS common symbols on
13482         tls_commons_ list.
13483         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13484         which are IN_OUTPUT_DATA.
13485         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13486         allocate_commons and do_allocate_commons declarations.  Declare
13487         do_allocate_commons_list.
13488         * gold.cc (queue_middle_tasks): Update creation of
13489         Allocate_commons_task to not pass options.
13490         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13491         (TLS_TEST_C_FLAGS): New variable.
13492         (tls_test_c_pic.o): New target.
13493         (tls_test_shared.so): Link in tls_test_c_pic.o.
13494         (tls_test_c_pic_ie.o): New target.
13495         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13496         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13497         (tls_test_c.o): New target.
13498         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13499         (tls_pic_test_LDADD): Likewise.
13500         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13501         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13502         (tls_test_c_gnu2.o): New target.
13503         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13504         tls_test_c_gnu2.o.
13505         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13506         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13507         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13508         * testsuite/tls_test.cc: Include "config.h".
13509         (t_last): Call t11_last.
13510         * testsuite/tls_test.h (t11, t11_last): Declare.
13511         * testsuite/tls_test_c.c: New file.
13512         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13513         * configure.ac: Check for OpenMP support.
13514         * configure, config.in, Makefile.in: Rebuild.
13515         * testsuite/Makefile.in: Rebuild.
13516
13517 2008-04-16  Cary Coutant  <ccoutant@google.com>
13518
13519         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13520         (Target_i386::tls_base_symbol_defined_): New field.
13521         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13522         (Target_i386::Scan::global): Likewise.
13523         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13524         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13525         (Target_x86_64::tls_base_symbol_defined_): New field.
13526         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13527         (Target_x86_64::Scan::global): Likewise.
13528
13529 2008-04-16  Cary Coutant  <ccoutant@google.com>
13530
13531         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13532         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13533         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13534         building shared libraries.
13535         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13536         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13537         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13538         * testsuite/Makefile.in: Rebuild.
13539         * testsuite/weak_undef.h: New file.
13540         * testsuite/weak_undef_file1.cc: Add extra test cases.
13541         * testsuite/weak_undef_file2.cc: Likewise.
13542         * testsuite/weak_undef_test.cc: Likewise.
13543
13544 2008-04-16  David S. Miller  <davem@davemloft.net>
13545
13546         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13547         Add issued_non_pic_error_ field.  Declare check_non_pic.
13548         (Target_sparc::Scan::check_non_pic): New function.
13549         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13550         (Target_sparc::Scan::global): Likewise.
13551
13552         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13553         * configure: Rebuild.
13554
13555         * options.h (DEFINE_enable): New macro.
13556         (new_dtags): New enable option.
13557         (initfirst, interpose, loadfltr, nodefaultlib,
13558         nodelete, nodlopen, nodump): New -z options.
13559         * layout.cc (Layout:finish_dynamic_section): If new
13560         dtags enabled, emit DT_RUNPATH.  Also, emit a
13561         DT_FLAGS_1 containing any specified -z flags.
13562
13563 2008-04-16  Ian Lance Taylor  <iant@google.com>
13564
13565         * copy-relocs.cc: New file.
13566         * copy-relocs.h: New file.
13567         * reloc.cc: Remove Copy_relocs code.
13568         * reloc.h: Likewise.
13569         * reloc-types.h (struct Reloc_types) [both versions]: Add
13570         get_reloc_addend_noerror.
13571         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13572         variants of add_global which take an addend which must be zero.
13573         * i386.cc: Include "copy-relocs.h".
13574         (class Target_i386): Change type of copy_relocs_ to variable,
13575         update initializer.
13576         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13577         Change all callers.
13578         (Target_i386::do_finalize_sections): Change handling of
13579         copy_relocs_.
13580         * sparc.cc: Include "copy-relocs.h".
13581         (class Target_sparc): Change type of copy_relocs_ to variable,
13582         update initializer.
13583         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13584         Change all callers.
13585         (Target_sparc::do_finalize_sections): Change handling of
13586         copy_relocs_.
13587         * x86_64.cc: Include "copy-relocs.h".
13588         (class Target_x86_64): Change type of copy_relocs_ to variable,
13589         update initializer.
13590         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13591         class.  Change all callers.
13592         (Target_x86_64::do_finalize_sections): Change handling of
13593         copy_relocs_.
13594         * Makefile.am (CCFILES): Add copy-relocs.cc.
13595         (HFILES): Add copy-relocs.h.
13596
13597         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13598
13599         * testsuite/script_test_4.sh: Permit leading zeroes.
13600
13601 2008-04-15  Ian Lance Taylor  <iant@google.com>
13602
13603         * script-sections.cc (Script_sections::create_segments): Use
13604         header_size_adjustment even when there is enough room for the
13605         headers.
13606         * testsuite/script_test_4.sh: New file.
13607         * testsuite/script_test_4.t: New file.
13608         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13609         (check_DATA): Add script_test_4.stdout.
13610         (MOSTLYCLEANFILES): Likewise.
13611         (script_test_4): New target.
13612         (script_test_4.stdout): New target.
13613         * testsuite/Makefile.in: Rebuild.
13614
13615         * sparc.cc: Add definitions for Output_data_plt_sparc class
13616         constants.
13617
13618 2008-04-14  David S. Miller  <davem@davemloft.net>
13619
13620         * sparc.cc: New file.
13621         * Makefile.am (TARGETSOURCES): Add sparc.cc
13622         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13623         * configure.tgt: Document targ_extra_size and
13624         targ_extra_big_endian.  Add entries for sparc-* and
13625         sparc64-*.
13626         * configure.ac: Handle targ_extra_size and
13627         targ_extra_big_endian.
13628         * Makefile.in: Rebuild.
13629         * configure: Likewise.
13630         * po/POTFILES.in: Likewise.
13631         * po/gold.pot: Likewise.
13632
13633 2008-04-14  Ian Lance Taylor  <iant@google.com>
13634
13635         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13636         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13637         in the name/type/flags to section mapping.  Don't call
13638         allocate_output_section.
13639         (Layout::choose_output_section): Change parameter from adjust_name
13640         to is_input_section.  Don't permit input sections after sections
13641         are attached to segments.  Don't call allocate_output_section.
13642         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13643         not write_enable_output_section.
13644         (Layout::make_output_section): Don't push to
13645         unattached_section_list_ nor call attach_to_segment.  Call
13646         attach_section_to_segment if sections are attached.
13647         (Layout::attach_sections_to_segments): New function.
13648         (Layout::attach_section_to_segment): New function.
13649         (Layout::attach_allocated_section_to_segment): Rename from
13650         attach_to_segment.  Remove flags parameter.
13651         (Layout::allocate_output_section): Remove function.
13652         (Layout::write_enable_output_section): Remove function.
13653         * layout.h (class Layout): Update for above changes.  Add new
13654         field sections_are_attached_.
13655         * output.h (Output_section::update_flags_for_input_section): New
13656         function.
13657         * output.cc (Output_section::add_input_section): Call
13658         update_flags_for_input_section.
13659         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13660
13661 2008-04-11  Cary Coutant  <ccoutant@google.com>
13662
13663         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13664         thought unnecessary.
13665         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13666
13667 2008-04-11  Ian Lance Taylor  <iant@google.com>
13668
13669         * output.h (class Output_section_data): Remove inline definition
13670         of set_addralign.
13671         * output.cc (Output_section_data::set_addralign): New function.
13672
13673 2008-04-11  Cary Coutant  <ccoutant@google.com>
13674
13675         Add support for TLS descriptors for i386 and x86_64.
13676         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13677         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13678         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13679         GOT_TYPE_TLS_DESC.
13680         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13681         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13682         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13683         relocations.
13684         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13685         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13686         Fix problem with initial-exec relocations.
13687         (Target_i386::Relocate::relocate_tls): Likewise.
13688         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13689         relaxation.
13690         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13691         support for section-plus-offset dynamic table entries.
13692         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13693         (Output_data_dynamic::Dynamic_entry): Add support for
13694         section-plus-offset dynamic table entries.
13695         (Output_data_dynamic::Classification): Likewise.
13696         (Output_data_dynamic::classification_): Renamed offset_.
13697         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13698         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13699         (Target_x86_64::make_plt_section): New function.
13700         (Target_x86_64::reserve_tlsdesc_entries): New function.
13701         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13702         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13703         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13704         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13705         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13706         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13707         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13708         add extra PLT entry for TLS descriptors.
13709         (Output_data_plt_x86_64::got_): New field.
13710         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13711         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13712         fields.
13713         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13714         descriptors.
13715         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13716         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13717         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13718         R_386_TLS_DESC_CALL relocations.
13719         (Target_x86_64::Scan::global): Likewise.
13720         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13721         for TLS descriptors.
13722         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13723         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13724         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13725         GD-to-IE relaxation.
13726         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13727         and TLS_DESCRIPTORS.
13728         * Makefile.in: Rebuild.
13729         * configure: Rebuild.
13730         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13731         (tls_test_shared2.so): New target.
13732         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13733         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13734         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13735         (tls_shared_gd_to_ie_test_LDADD): New variable.
13736         (tls_shared_gnu2_gd_to_ie_test): New target.
13737         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13738         New targets.
13739         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13740         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13741         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13742         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13743         (tls_shared_gnu2_test): New target.
13744         (tls_test_gnu2_shared.so): New target.
13745         (tls_shared_gnu2_test_SOURCES): New variable.
13746         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13747         (tls_shared_gnu2_test_LDFLAGS): New variable.
13748         (tls_shared_gnu2_test_LDADD): New variable.
13749         * testsuite/Makefile.in: Rebuild.
13750         * testsuite/Makefile.
13751
13752 2008-04-11  Ian Lance Taylor  <iant@google.com>
13753
13754         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13755         justsyms.t.
13756         * testsuite/Makefile.in: Rebuild.
13757
13758         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13759         long.
13760         * testsuite/script_test_2.cc (main): Adjust test.
13761
13762 2008-04-11  David S. Miller  <davem@davemloft.net>
13763             Ian Lance Taylor  <iant@google.com>
13764
13765         * options.h (General_options): Add entries for '-Y' and
13766         '-relax'.
13767         * options.cc (General_options:finalize): If -Y was used, add those
13768         entries to the library path instead of the default "/lib" and
13769         "/usr/lib".
13770
13771 2008-04-11  David S. Miller  <davem@davemloft.net>
13772
13773         * testsuite/justsyms.t: Start at 0x100.
13774         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13775         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13776         long.
13777         * testsuite/script_test_2.cc: Adjust string and section length
13778         checks.
13779
13780 2008-04-09  Ian Lance Taylor  <iant@google.com>
13781
13782         PR gold/5996
13783         * script-sections.cc (Sections_element::allocate_to_segment): Add
13784         orphan parameter.
13785         (Output_section_definition::allocate_to_segment): Likewise.
13786         (Orphan_output_section::allocate_to_segment): Likewise.
13787         (Script_sections::attach_sections_using_phdrs_clause): Don't
13788         propagate non-PT_LOAD segments to orphan sections.
13789         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13790         readelf rather than objdump.
13791         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13792         .interp section and PT_INTERP segment are the same size.
13793         * testsuite/Makefile.in: Rebuild.
13794
13795         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13796         aliases for symbols defined in the same object.
13797         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13798         (weak_alias_test_SOURCES): New variable.
13799         (weak_alias_test_DEPENDENCIES): New variable.
13800         (weak_alias_test_LDFLAGS): New variable.
13801         (weak_alias_test_LDADD): New variable.
13802         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13803         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13804         (weak_alias_test_3.o): New target.
13805         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13806         * testsuite/weak_alias_test_main.cc: New file.
13807         * testsuite/weak_alias_test_1.cc: New file.
13808         * testsuite/weak_alias_test_2.cc: New file.
13809         * testsuite/weak_alias_test_3.cc: New file.
13810
13811 2008-04-08  Ian Lance Taylor  <iant@google.com>
13812
13813         * options.h (class General_options): Add --noinhibit-exec option.
13814         * main.cc (main): Check --noinhibit-exec.
13815
13816         * options.h (class General_options): Define --wrap as a special
13817         option.  Add wrap_symbols_ field.
13818         (General_options::any_wrap_symbols): New function.
13819         (General_options::is_wrap_symbol): New function.
13820         * options.cc (General_options::parse_wrap): New function.
13821         (General_options::General_options): Initialize wrap_symbols_.
13822         * symtab.cc (Symbol_table::wrap_symbol): New function.
13823         (Symbol_table::add_from_object): Handle --wrap.
13824         * symtab.h (class Symbol_table): Declare wrap_symbol.
13825         * target.h (Target::wrap_char): New function.
13826         (Target::Target_info): Add wrap_char field.
13827         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13828         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13829         * testsuite/testfile.cc (Target_test::test_target_info):
13830         Likewise.
13831
13832         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13833         there is one.
13834
13835         * layout.h (class Layout): Add added_eh_frame_data_ field.
13836         * layout.cc (Layout::Layout): Initialize new field.
13837         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13838         output section until we find a section we merged successfully.
13839         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13840         that the size be non-zero.
13841
13842         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13843         qualifier.
13844
13845 2008-04-08  Craig Silverstein  <csilvers@google.com>
13846
13847         * configure.ac: Export new conditional variable HAVE_ZLIB.
13848         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13849         on HAVE_ZLIB.
13850         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13851         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13852
13853 2008-04-07  Ian Lance Taylor  <iant@google.com>
13854
13855         * version.cc (version_string): Set to "1.5".
13856
13857         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13858         Add issued_non_pic_error_ field.  Declare check_non_pic.
13859         (Target_x86_64::Scan::check_non_pic): New function.
13860         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13861         (Target_x86_64::Scan::global): Likewise.
13862
13863         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13864         addend parameter.  Change caller.  Handle merge sections.
13865         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13866         Address to Addend.  Don't add in the result of
13867         local_section_offset, pass down the addend and use the returned
13868         value.
13869         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13870         Update declarations of local_section_offset and symbol_value.
13871         * testsuite/two_file_test_1.cc (t18): New function.
13872         * testsuite/two_file_test_2.cc (f18): New function.
13873         * testsuite/two_file_test_main.cc (main): Call t18.
13874         * testsuite/two_file_test.h (t18, f18): Declare.
13875
13876         * configure.ac: Don't test for objdump, c++filt, or readelf.
13877         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13878         conditionals.
13879         (TEST_READELF): New variable.
13880         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13881         (check_PROGRAMS): Add two_file_strip_test.
13882         (two_file_strip_test): New target.
13883         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13884         (two_file_same_shared_strip_test_SOURCES): New variable.
13885         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13886         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13887         (two_file_same_shared_strip_test_LDADD): New variable.
13888         (two_file_shared_strip.so): New target.
13889         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13890         (ver_test_5.syms, ver_test_7.syms): Likewise.
13891         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13892         (strip_test_3.stdout): Use TEST_OBJDUMP.
13893         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13894
13895 2008-04-04  Cary Coutant  <ccoutant@google.com>
13896
13897         * symtab.h (Symbol::is_weak_undefined): New function.
13898         (Symbol::is_strong_undefined): New function.
13899         (Symbol::is_absolute): New function.
13900         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13901         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13902         absolute symbols.
13903         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13904         (weak_undef_test): New target.
13905         * testsuite/Makefile.in: Rebuild.
13906         * testsuite/weak_undef_file1.cc: New file.
13907         * testsuite/weak_undef_file2.cc: New file.
13908         * testsuite/weak_undef_test.cc: New file.
13909
13910 2008-04-03  Craig Silverstein  <csilvers@google.com>
13911
13912         * compressed_output.h (class Output_compressed_section): Use
13913         unsigned buffer.
13914         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13915         add zlib header.
13916         (zlib_compressed_suffix): Removed.
13917         (Output_compressed_section::set_final_data_size): Use unsigned
13918         buffers.
13919         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13920         Fix linker invocation.
13921         (flagstest_o_specialfile_and_compress_debug_sections):
13922         Likewise.
13923         * testsuite/Makefile.in: Regenerated.
13924
13925 2008-04-02  David S. Miller  <davem@davemloft.net>
13926
13927         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13928         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13929
13930 2008-04-02  Craig Silverstein  <csilvers@google.com>
13931
13932         * TODO: New file.
13933
13934 2008-04-02  Ian Lance Taylor  <iant@google.com>
13935
13936         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13937         parameters.  Update for new key type to views_.  Change all
13938         callers.
13939         (File_read::read): Adjust for byteshift in returned view.
13940         (File_read::add_view): New function, broken out of
13941         find_and_make_view.
13942         (File_read::make_view): New function, broken out of
13943         find_and_make_view.
13944         (File_read::find_or_make_view): Add offset and aligned
13945         parameters.  Rewrite accordingly.  Change all callers.
13946         (File_read::get_view): Add offset and aligned parameters.  Adjust
13947         for byteshift in return value.
13948         (File_read::get_lasting_view): Likewise.
13949         * fileread.h (class File_read): Update declarations.
13950         (class File_read::View): Add byteshift_ field.  Add byteshift to
13951         constructor.  Add byteshift method.
13952         * archive.h (Archive::clear_uncached_views): New function.
13953         (Archive::get_view): Add aligned parameter.  Change all callers.
13954         * object.h (Object::get_view): Add aligned parameter.  Change all
13955         callers.
13956         (Object::get_lasting_view): Likewise.
13957
13958         * fileread.cc (File_read::release): Don't call clear_views if
13959         there are multiple objects.
13960         * fileread.h (File_read::clear_uncached_views): New function.
13961         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13962         on the archive.
13963
13964 2008-03-31  Cary Coutant  <ccoutant@google.com>
13965
13966         Add thin archive support.
13967         * archive.cc (Archive::armagt): New const.
13968         (Archive::setup): Remove task parameter and calls to unlock.
13969         (Archive::unlock_nested_archives): New function.
13970         (Archive::read_header): Add nested_off parameter. Change
13971         all callers.
13972         (Archive::interpret_header): Likewise.
13973         (Archive::include_all_members): Change to handle thin
13974         archives.
13975         (Archive::include_member): Likewise.
13976         * archive.h (Archive::Archive): Add new parameters and
13977         initializers.
13978         (Archive::armagt): New const.
13979         (Archive::setup): Remove task parameter.
13980         (Archive::unlock_nested_archives): New function.
13981         (Archive::read_header): Add nested_off parameter.
13982         (Archive::interpret_header): Likewise.
13983         (Archive::Nested_archive_table): New typedef.
13984         (Archive::is_thin_archive_): New field.
13985         (Archive::nested_archives_): New field.
13986         (Archive::options_): New field.
13987         (Archive::dirpath_): New field.
13988         (Archive::task_): New field.
13989         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13990         for thin archives.  Pass additional parameters to
13991         Archive::Archive.  Unlock the archive file after calling
13992         Archive::setup.
13993
13994 2008-03-29  Ian Lance Taylor  <iant@google.com>
13995
13996         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13997         version symbol to be local.
13998         * testsuite/ver_test_4.sh: New file.
13999         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14000         (check_DATA): Add ver_test_4.syms.
14001         (ver_test_4.syms): New target.
14002         * testsuite/Makefile.in: Rebuild.
14003
14004         * output.cc
14005         (Output_section::Input_section_sort_entry::has_priority): New
14006         function.
14007         (Output_section::Input_section_sort_entry::match_file_name): New
14008         function.
14009         (Output_section::Input_section_sort_entry::match_section_name):
14010         Remove.
14011         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14012         Remove.
14013         (Output_section::Input_section_sort_entry::match_section_file):
14014         Remove.
14015         (Output_section::Input_section_sort_compare::operator()): Rewrite
14016         using new Input_section_sort_entry functions.  Sort crtbegin and
14017         crtend first.  Sort sections with no priority before sections with
14018         a priority.
14019         * testsuite/initpri1.c (d3): Check j != 4.
14020         (cd5): New constructor/destructor function.
14021         (main): Check j != 2.
14022
14023         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14024         new symbol when resolving, don't call set_is_default.
14025         * testsuite/ver_test_7.cc: New file.
14026         * testsuite/ver_test_7.sh: New file.
14027         * testsuite/Makefile.am (ver_test_7.so): New target.
14028         (ver_test_7.o): New target.
14029         (check_SCRIPTS): Add ver_test_7.sh.
14030         (check_DATA): Add ver_test_7.syms.
14031         (ver_test_7.syms): New target.
14032
14033 2008-03-28  Ian Lance Taylor  <iant@google.com>
14034
14035         * layout.cc (Layout::layout): If we see an input section with a
14036         name that needs sorting, set the must_sort flag for the output
14037         section.
14038         (Layout::make_output_section): If the name of the output section
14039         indicates that it might require sorting, set the may_sort flag.
14040         * output.h (Output_section::may_sort_attached_input_sections): New
14041         function.
14042         (Output_section::set_may_sort_attached_input_sections): New
14043         function.
14044         (Output_section::must_sort_attached_input_sections): New
14045         function.
14046         (Output_section::set_must_sort_attached_input_sections): New
14047         function.
14048         (class Output_section): Declare Input_section_sort_entry.  Define
14049         Input_section_sort_compare.  Declare
14050         sort_attached_input_sections.  Add new fields:
14051         may_sort_attached_input_sections_,
14052         must_sort_attached_input_sections_,
14053         attached_input_sections_are_sorted_.
14054         * output.cc (Output_section::Output_section): Initialize new
14055         fields.
14056         (Output_section::add_input_section): Add an entry to
14057         input_sections_ if may_sort or must_sort are true.
14058         (Output_section::set_final_data_size): Call
14059         sort_attached_input_sections if necessary.
14060         (Output_section::Input_section_sort_entry): Define new class.
14061         (Output_section::Input_section_sort_compare::operator()): New
14062         function.
14063         (Output_section::sort_attached_input_sections): New function.
14064         * configure.ac: Check whether the compiler supports constructor
14065         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14066         * testsuite/initpri1.c: New file.
14067         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14068         CONSTRUCTOR_PRIORITY.
14069         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14070         (initpri1_LDFLAGS): New variable.
14071         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14072
14073 2008-03-27  Ian Lance Taylor  <iant@google.com>
14074
14075         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14076         * testsuite/common_test_1.c: New file.
14077         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14078         (common_test_1_SOURCES): New variable.
14079         (common_test_1_DEPENDENCIES): New variable.
14080         (common_test_1_LDFLAGS): New variable.
14081
14082         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14083         and commons_ correctly when NAME/VERSION does not override
14084         NAME/NULL.
14085         * testsuite/ver_test_6.c: New file.
14086         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14087         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14088         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14089
14090 2008-03-26  Ian Lance Taylor  <iant@google.com>
14091
14092         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14093         of an undefined symbol from a version script.
14094         * testsuite/Makefile.am (ver_test_5.so): New target.
14095         (ver_test_5.o): New target.
14096         (check_SCRIPTS): Add ver_test_5.sh.
14097         (check_DATA): Add ver_test_5.syms.
14098         (ver_test_5.syms): New target.
14099         * testsuite/ver_test_5.cc: New file.
14100         * testsuite/ver_test_5.script: New file.
14101         * testsuite/ver_test_5.sh: New file.
14102         * Makefile.in, testsuite/Makefile.in: Rebuild.
14103
14104         PR gold/5986
14105         Fix problems building gold with gcc 4.3.0.
14106         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14107         (gold_error_at_location, gold_warning_at_location): Use it.
14108         * configure.ac: Check whether we can compile and use a template
14109         function with a printf attribute.
14110         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14111         when jumping over bytes.
14112         * object.cc: Instantiate Object::read_section_data.
14113         * debug.h: Include <cstring>
14114         * dwarf_reader.cc: Include <algorithm>
14115         * main.cc: Include <cstring>.
14116         * options.cc: Include <cstring>.
14117         * output.cc: Include <cstring>.
14118         * script.cc: Include <cstring>.
14119         * script.h: Include <string>.
14120         * symtab.cc: Include <cstring> and <algorithm>.
14121         * target-select.cc: Include <cstring>.
14122         * version.cc: Include <string>.
14123         * testsuite/testmain.cc: Include <cstdlib>.
14124         * configure, config.in: Rebuild.
14125
14126 2008-03-25  Ian Lance Taylor  <iant@google.com>
14127
14128         * options.cc: Include "../bfd/bfdver.h".
14129         (options::help): Print bug reporting address.
14130
14131         * version.cc (print_version): Adjust output for current value of
14132         BFD_VERSION_STRING.
14133
14134         * NEWS: New file.
14135
14136         * options.cc (options::help): Print list of supported targets.
14137         * target-select.h: Include <vector>.
14138         (class Target_selector): Make machine_, size_, and is_big_endian_
14139         fields const.  Add bfd_name_ and instantiated_target_ fields.
14140         (Target_selector::Target_selector): Add bfd_name parameter.
14141         (Target_selector::recognize): Make non-virtual, call
14142         do_recognize.
14143         (Target_selector::recognize_by_name): Make non-virtual, call
14144         do_recognize_by_name.
14145         (Target_selector::supported_names): New function.
14146         (Target_selector::bfd_name): New function.
14147         (Target_selector::do_instantiate_target): New pure virtual
14148         function.
14149         (Target_selector::do_recognize): New virtual function.
14150         (Target_selector::do_recognize_by_name): New virtual function.
14151         (Target_selector::instantiate_target): New private function.
14152         (supported_target_names): Declare.
14153         * target-select.cc (Target_selector::Target_selector): Update for
14154         new parameter and fields.
14155         (select_target_by_name): Check that the name matches before
14156         calling recognize_by_name.
14157         (supported_target_names): New function.
14158         * i386.cc (class Target_selector_i386): Update Target_selector
14159         constructor call.  Remove recognize and recognize_by_name.  Add
14160         do_instantiate_target.
14161         * x86_64.cc (class Target_selector_x86_64): Likewise.
14162         * testsuite/testfile.cc (class Target_selector_test): Update for
14163         changes to Target_selector.
14164
14165         * README: Rewrite, with some notes on unsupported features.
14166
14167 2008-03-24  Cary Coutant  <ccoutant@google.com>
14168
14169         * i386.cc (Target_i386::Got_type): New enum declaration.
14170         (Target_i386::Scan::local): Updated callers of Output_data_got
14171         member functions.
14172         (Target_i386::Scan::global): Likewise.
14173         (Target_i386::Relocate::relocate): Likewise.
14174         (Target_i386::Relocate::relocate_tls): Likewise.
14175         * object.h (Got_offset_list): New class.
14176         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14177         (Sized_relobj::local_got_offset): Likewise.
14178         (Sized_relobj::set_local_got_offset): Likewise.
14179         (Sized_relobj::local_has_tls_got_offset): Removed.
14180         (Sized_relobj::local_tls_got_offset): Removed.
14181         (Sized_relobj::set_local_tls_got_offset): Removed.
14182         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14183         * output.cc (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         * output.h (Output_data_got::add_global): Added got_type parameter.
14200         (Output_data_got::add_global_with_rel): Likewise.
14201         (Output_data_got::add_global_with_rela): Likewise.
14202         (Output_data_got::add_global_pair_with_rel): New function.
14203         (Output_data_got::add_global_pair_with_rela): New function.
14204         (Output_data_got::add_local): Added got_type parameter.
14205         (Output_data_got::add_local_with_rel): Likewise.
14206         (Output_data_got::add_local_with_rela): Likewise.
14207         (Output_data_got::add_local_pair_with_rel): New function.
14208         (Output_data_got::add_local_pair_with_rela): New function.
14209         (Output_data_got::add_global_tls): Removed.
14210         (Output_data_got::add_global_tls_with_rel): Removed.
14211         (Output_data_got::add_global_tls_with_rela): Removed.
14212         (Output_data_got::add_local_tls): Removed.
14213         (Output_data_got::add_local_tls_with_rel): Removed.
14214         (Output_data_got::add_local_tls_with_rela): Removed.
14215         * resolve.cc (Symbol::override_base_with_special): Removed
14216         reference to has_got_offset_ field.
14217         * symtab.cc (Symbol::init_fields): Replaced initialization
14218         of got_offset_ with got_offsets_.  Removed initialization
14219         of has_got_offset_
14220         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14221         (Symbol::got_offset): Likewise.
14222         (Symbol::set_got_offset): Likewise.
14223         (Symbol::has_tls_got_offset): Removed.
14224         (Symbol::tls_got_offset): Removed.
14225         (Symbol::set_tls_got_offset): Removed.
14226         (Symbol::got_offset_): Removed.
14227         (Symbol::tls_mod_got_offset_): Removed.
14228         (Symbol::tls_pair_got_offset_): Removed.
14229         (Symbol::got_offsets_): New field.
14230         (Symbol::has_got_offset): Removed.
14231         (Symbol::has_tls_mod_got_offset): Removed.
14232         (Symbol::has_tls_pair_got_offset): Removed.
14233         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14234         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14235         member functions.
14236         (Target_x86_64::Scan::global): Likewise.
14237         (Target_x86_64::Relocate::relocate): Likewise.
14238         (Target_x86_64::Relocate::relocate_tls): Likewise.
14239
14240 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14241
14242         * yyscript.y: Fix spelling error in comment.
14243
14244 2008-03-24  Ian Lance Taylor  <iant@google.com>
14245
14246         * options.h (class General_options): Define build_id option.
14247         * layout.h (class Layout): Declare write_build_id, create_note,
14248         create_build_id.  Add build_id_note_ member.
14249         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14250         "libiberty.h", "md5.h", "sha1.h".
14251         (Layout::Layout): Initialize eh_frame_data_,
14252         eh_frame_hdr_section_, and build_id_note_.
14253         (Layout::finalize): Call create_build_id.
14254         (Layout::create_note): New function, broken out of
14255         Layout::create_gold_note.
14256         (Layout::create_gold_note): Call create_note.
14257         (Layout::create_build_id): New function.
14258         (Layout::write_build_id): New function.
14259         (Close_task_runner::run): Call write_build_id.
14260
14261         * x86_64.cc: Correct license to GPLv3.
14262
14263 2008-03-23  Ian Lance Taylor  <iant@google.com>
14264
14265         * options.cc: Include "demangle.h".
14266         (parse_optional_string): New function.
14267         (parse_long_option): Handle takes_optional_argument.
14268         (parse_short_option): Update dash_z initializer.  Handle
14269         takes_optional_argument.
14270         (General_options::General_options): Initialize do_demangle_.
14271         (General_options::finalize): Set do_demangle_.  Handle demangling
14272         style.
14273         * options.h (parse_optional_string): Declare.
14274         (struct One_option): Add optional_arg field.  Update constructor.
14275         Update call constructor calls.  Add takes_optional_argument
14276         function.
14277         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14278         (DEFINE_optional_string): Define.
14279         (General_options::demangle): Change from DEFINE_bool to
14280         DEFINE_optional_string.
14281         (General_options::no_demangle): New function.
14282         (General_options::do_demangle): New function.
14283         (General_options::set_do_demangle): New function.
14284         (General_options::execstack_status_): Move definition to end of
14285         class definition.
14286         (General_options::static_): Likewise.
14287         (General_options::do_demangle_): New field.
14288         * object.cc (big_endian>::get_symbol_location_info): Call
14289         Options::do_demangle, not Options::demangle.
14290         * symtab.cc (demangle): Likewise.
14291
14292 2008-03-22  Ian Lance Taylor  <iant@google.com>
14293
14294         * gold.h: Include <cstddef> and <sys/types.h>
14295         * options.h: Include <cstring>.
14296
14297 2008-03-21  Ian Lance Taylor  <iant@google.com>
14298
14299         * Added source code to GNU binutils.
14300 \f
14301 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14302
14303 Copying and distribution of this file, with or without modification,
14304 are permitted in any medium without royalty provided the copyright
14305 notice and this notice are preserved.
14306
14307 Local Variables:
14308 mode: change-log
14309 left-margin: 8
14310 fill-column: 74
14311 version-control: never
14312 End: