* layout.h (Layout::get_executable_sections): Declare.
[external/binutils.git] / gold / ChangeLog
1 i2012-12-03  Alan Modra  <amodra@gmail.com>
2
3         * layout.h (Layout::get_executable_sections): Declare.
4         * layout.cc (Layout::get_executable_sections): New function.
5         * arm.cc (Target_arm::group_sections): Use it.
6         (Arm_output_section::group_sections): Delete now redundant test.
7         * output.cc (Output_reloc::Output_reloc): Add is_relative.
8         param to handle relative relocs.
9         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
10         (Output_data_reloc::add_absolute): Adjust.
11         (Output_data_reloc::add_relative): New function.
12         (Output_data::reset_data_size): New function.
13         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
14         (Output_section::set_addralign): New function.
15         (Output_section::checkpoint_set_addralign): New function.
16         (Output_section::clear_section_offsets_need_adjustment): New function.
17         (Output_section::input_sections): Make public.
18         * powerpc.cc (class Output_data_brlt_powerpc): New.
19         (class Stub_table, class Stub_control): New.
20         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
21         stub_table_, set_stub_table, stub_table): New vectors and accessor
22         functions.
23         (Target_powerpc::do_may_relax, do_relax, push_branch,
24         new_stub_table, stub_tables, brlt_section, group_sections,
25         add_branch_lookup_table, find_branch_lookup_table,
26         write_branch_lookup_table, make_brlt_section): New functions.
27         (Target_powerpc::struct Sort_sections, class Branch_info): New.
28         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
29         branch_info_): New vars.
30         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
31         make call stubs here.
32         (Output_data_glink): Remove all call stub handling from this class.
33         (Target_powerpc::Scan::local, global): Save interesting branch
34         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
35         (Target_powerpc::do_finalize_sections): Only make reg save/restore
36         functions on final link.
37         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
38         Handle long branch destinations too.
39         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
40         do_plt_address_for_local): Adjust lookup of plt call stubs.
41
42 2012-11-30  Alan Modra  <amodra@gmail.com>
43
44         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
45         relocs against protected symbols when building 32-bit shared libs.
46
47 2012-11-30  Alan Modra  <amodra@gmail.com>
48
49         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
50         param.  Call got_section() to make .got.  Update all callers
51         and their callers and so on.
52
53 2012-11-30  Alan Modra  <amodra@gmail.com>
54
55         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
56         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
57         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
58         value if it already exists.
59
60 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
61
62         PR gold/14858
63         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
64
65 2012-11-14  Roland McGrath  <mcgrathr@google.com>
66
67         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
68         than bfc instruction for data sandboxing.
69
70 2012-11-08  Alan Modra  <amodra@gmail.com>
71
72         * po/POTFILES.in: Regenerate.
73
74 2012-11-05  Alan Modra  <amodra@gmail.com>
75
76         * configure.ac: Apply 2012-09-10 change to config.in here.
77         * configure: Regenerate.
78
79 2012-11-05  Alan Modra  <amodra@gmail.com>
80
81         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
82         (struct Opd_ent): Use "Address" rather than "Offset".
83         (Output_data_got_powerpc::got_base_offset): Return Valtype.
84         (Target_powerpc::got_section): Make public.
85         (Target_powerpc::scan_relocs): Move code setting symbols..
86         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
87         Create _SDA_BASE_ only when referenced.
88
89 2012-11-02  Roland McGrath  <mcgrathr@google.com>
90
91         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
92         from last change.
93
94 2012-11-01  Roland McGrath  <mcgrathr@google.com>
95
96         * target.h (Sized_target::relocate_relocs): Use Elf_Off
97         for offset_in_output_section parameter.
98         (Sized_target::relocate_special_relocatable): Likewise.
99         * arm.cc (Target_arm::relocate_relocs): Likewise.
100         (Target_arm::relocate_special_relocatable): Likewise.
101         * i386.cc (Target_i386::relocate_relocs): Likewise.
102         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
103         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
104         * target-reloc.h (relocate_relocs): Likewise.
105         * testsuite/testfile.cc (Target_test): Likewise.
106         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
107         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
108
109         * system.h: Move inclusion of <clocale> to after <libintl.h> in
110         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
111
112         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
113         parameter, which is unused in the [!F_SETFD] case.
114
115         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
116         SYMNDX to off_t before comparing it to this->data_size().
117         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
118         * incremental.cc (Output_section_incremental_inputs::do_write):
119         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
120
121         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
122
123 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
124
125         * gold.cc (Target_arm::do_adjust_elf_header): Add the
126         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
127         in EABI_VER5.
128
129 2012-10-29  Cary Coutant  <ccoutant@google.com>
130
131         * dwp.cc (usage): Add file and exit status parameters;
132         add --help and --version options.
133         (print_version): New function.
134         (main): Add --help and --version options.
135
136 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
137
138         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
139         final_layout_sequence.txt.
140         * testsuite/Makefile.in: Regenerated.
141
142 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
143
144         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
145         COMPILE generated by automake.
146         (LINK1): Likewise.
147         (CXXCOMPILE1): Likewise.
148         (CXXLINK1): Likewise.
149         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
150         (LINK): Likewise.
151         (CXXCOMPILE): Likewise.
152         (CXXLINK): Likewise.
153         * testsuite/Makefile.in: Regenerated.
154
155 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
156
157         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
158         on bad fwrite return.
159
160 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
161
162         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
163         on val.
164
165 2012-10-23  Cary Coutant  <ccoutant@google.com>
166
167         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
168         * testsuite/Makefile.in: Regenerate.
169         * testsuite/dwp_test.h: New source file.
170         * testsuite/dwp_test_1.cc: New source file.
171         * testsuite/dwp_test_1.s: New source file.
172         * testsuite/dwp_test_1.sh: New source file.
173         * testsuite/dwp_test_1b.cc: New source file.
174         * testsuite/dwp_test_1b.s: New source file.
175         * testsuite/dwp_test_2.cc: New source file.
176         * testsuite/dwp_test_2.s: New source file.
177         * testsuite/dwp_test_2.sh: New source file.
178         * testsuite/dwp_test_main.cc: New source file.
179         * testsuite/dwp_test_main.s: New source file.
180
181 2012-10-23  Cary Coutant  <ccoutant@google.com>
182
183         * dwp.h: New header file.
184         * dwp.cc: New source file.
185         * gold.h: Move shared declarations to system.h.
186         * system.h: New header file.
187         * Makefile.am: Add dwp.
188         * Makefile.in: Regenerate.
189
190 2012-10-23  Cary Coutant  <ccoutant@google.com>
191
192         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
193         Dwarf_info_reader::read_from_pointer.
194         (Dwarf_pubnames_table::read_header): Likewise.
195         (Dwarf_pubnames_table::next_name): Likewise.
196         (Dwarf_die::read_attributes): Likewise.
197         (Dwarf_die::skip_attributes): Likewise.
198         (Dwarf_info_reader::read_from_pointer): New function template.
199         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
200         (Dwarf_pubnames_table): Likewise.
201         (Dwarf_info_reader::read_from_pointer): New function template.
202         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
203         Dwarf_pubnames_table ctor.
204
205 2012-10-23  Cary Coutant  <ccoutant@google.com>
206
207         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
208         abbrev_shndx.
209         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
210         abbrev_shndx_.
211         (Dwarf_info_reader::set_abbrev_shndx): New method.
212         (Dwarf_info_reader::abbrev_shndx_): New data member.
213
214 2012-10-23  Cary Coutant  <ccoutant@google.com>
215
216         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
217         from object, not parameters.
218         (Dwarf_info_reader::parse): Likewise.
219         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
220         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
221         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
222         methods.
223
224 2012-10-23  Cary Coutant  <ccoutant@google.com>
225
226         * fileread.cc (Input_file::Input_file): New constructor.
227         * fileread.h (class Input_file): Add new constructor.
228
229 2012-10-18  Alan Modra  <amodra@gmail.com>
230
231         PR gold/14727
232         * object.cc (Relobj::is_section_name_included): Also match
233         .sdata personality section.
234
235 2012-10-18  Alan Modra  <amodra@gmail.com>
236
237         * target-reloc.h (class Default_comdat_behavior): New, package up..
238         (get_comdat_behaviour): ..this.
239         (relocate_section): Add Relocate_comdat_behavior template arg,
240         adjust code to suit.
241         * arm.cc (Target_arm::relocate_section): Adjust to suit.
242         (Target_arm::scan_reloc_section): Likewise.
243         * i386.cc (Target_i386::relocate_section): Likewise.
244         * sparc.cc (Target_sparc::relocate_section): Likewise.
245         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
246         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
247         * powerpc.cc (class Relocate_comdat_behavior): New.
248         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
249         gold::relocate_section with new template arg.
250
251 2012-10-18  Alan Modra  <amodra@gmail.com>
252
253         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
254         dynamic relocs for GOT_TPREL got entries, without symbol if
255         resolving locally.
256         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
257         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
258         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
259
260 2012-10-17  Alan Modra  <amodra@gmail.com>
261
262         PR gold/14726
263         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
264
265 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
266
267         * layout.cc (Layout::include_section): Keep sections marked
268         SHF_EXCLUDE when doing relocatable links.
269
270 2012-10-16  Alan Modra  <amodra@gmail.com>
271
272         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
273         (Target_powerpc::do_finalize_sections): Call it.
274         (Output_data_save_res): New class and supporting functions.
275         (Target_powerpc::symval_for_branch): Only look up .opd entry for
276         normal symbols defined in object files.
277
278 2012-10-12  Alan Modra  <amodra@gmail.com>
279
280         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
281         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
282         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
283         section if scan_opd_relocs not yet called.
284         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
285
286 2012-10-12  Alan Modra  <amodra@gmail.com>
287
288         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
289         add_local_ifunc_entry): Revert last change.
290         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
291
292 2012-10-05  Alan Modra  <amodra@gmail.com>
293
294         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
295         do_plt_address_for_global): New functions.
296         (Output_data_got_powerpc::do_write): Don't segfault when linking
297         statically.
298         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
299         add_local_ifunc_entry): Return true on adding entry..
300         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
301         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
302         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
303         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
304         set up symbols here.
305         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
306         syms here.  Do so even when no .iplt.  Don't segfault when linking
307         statically.
308         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
309         new variants without reloc param.
310         (Glink_sym_ent::Glink_sym_ent): Likewise.
311         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
312         reloc when refs will resolve to plt call stub.
313         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
314         R_PPC_PLTREL24 to resolve locally.
315         (Target_powerpc::Scan::global): Correct ifunc handling.
316         (Target_powerpc::Relocate::relocate): Correct local sym glink
317         lookup.  Don't destroy "value" when we have a plt call stub,
318         and when checking plt call validity.
319         (Target_powerpc::do_dynsym_value): Simplify.
320
321 2012-10-05  Alan Modra  <amodra@gmail.com>
322
323         * i386.cc (Output_data_plt_i386::address_for_global,
324         address_for_local): Add plt offset to returned value.  Adjust uses.
325         * sparc.cc (Output_data_plt_sparc::address_for_global,
326         address_for_local): Likewise.
327         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
328         address_for_local): Likewise.
329         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
330         address_for_local): Likewise.
331         * target.h (Target::plt_address_for_global, plt_address_for_local):
332         Update comment.
333         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
334         (Output_data_got::Got_entry::write): Nor here.
335         * output.h: Comment fix.
336
337 2012-10-02  Jiong Wang  <jiwang@tilera.com>
338
339         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
340         global_offset_table_ value for larget got.
341         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
342
343 2012-09-29  Alan Modra  <amodra@gmail.com>
344
345         * powerpc.cc (Target_powerpc::iplt_): New output section.
346         (Target_powerpc::iplt_section, make_iplt_section,
347         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
348         (Target_powerpc::make_plt_entry): Handle ifunc syms.
349         Target_powerpc::plt_entry_count): Count iplt entries too.
350         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
351         reloc section in constructor.  New params.
352         (Target_powerpc::make_plt_section): Create reloc section here instead.
353         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
354         functions.
355         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
356         (Output_data_glink::add_entry, find_entry): New functions to
357         deal with local syms.
358         (Glink_sym_ent): Add support for local syms.
359         (Output_data_glink::do_write): Handle ifunc plt entries.
360         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
361         (Target_powerpc::Scan::local, global): Handle ifunc syms.
362         (Target_powerpc::Relocate::relocate): Likewise.
363         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
364
365 2012-09-25  Alan Modra  <amodra@gmail.com>
366
367         * object.h (Sized_relobj_file::adjust_local_symbol,
368         do_adjust_local_symbol): New functions.
369         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
370         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
371         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
372         and irregular opd entry spacing.
373         (Powerpc_relobj::do_read_relocs): Add opd size checks.
374         (Global_symbol_visitor_opd): New functor.
375         (Target_powerpc::do_finalize_sections): Omit global symbols defined
376         on deleted opd entries.
377
378 2012-09-15  Jiong Wang  <jiwang@tilera.com>
379
380         * tilegx.cc: New file.
381         * Makefile.am (TARGETSOURCES): Add tilegx.cc
382         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
383         * configure.tgt: Add entries for tilegx*.
384         * configure.ac: Likewise.
385         * Makefile.in: Rebuild.
386         * configure: Likewise.
387         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
388         tilegx.
389
390 2012-09-13  Alan Modra  <amodra@gmail.com>
391
392         * target-reloc.h (scan_relocs): Call scan.local for relocs
393         against symbols in discarded sections.  Pass is_discarded
394         param.
395         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
396         Add is_discarded param.
397         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
398         is_discarded to flag opd entry as discarded.  Don't emit dyn
399         relocs on such entries.
400         (Target_powerpc::Scan::global): Similarly detect and handle
401         such opd entries.
402         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
403         opd_ent_.  Update all uses.
404         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
405         (Target_powerpc::relocate_section): Zero out discarded opd
406         entry relocs.
407
408 2012-09-12  Ian Lance Taylor  <iant@google.com>
409
410         PR gold/14570
411         * output.cc: Rename Output_data_got template parameter from size
412         to got_size for all functions.  Compile all variants of
413         Output_data_got.
414         (Output_data_got::Got_entry::write): Correct use of size for
415         symbol value.  Use local_is_tls rather than casting to
416         Sized_relobj_file.
417         * object.h (class Object): Add local_is_tls and do_local_is_tls.
418         (class Sized_relobj_file): Add do_local_is_tls.
419         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
420
421 2012-09-11  Alan Modra  <amodra@gmail.com>
422
423         PR gold/14566
424         * layout.cc (Layout::set_segment_offsets): When using
425         common-page-size alignment, ensure we are on a new max-page-size
426         page.
427         * output.cc (Output_segment::set_section_addresses): Use
428         abi_pagesize, not common_pagesize for relro boundary.
429         (Output_segment::set_offset): Likewise.
430
431 2012-09-11  Alan Modra  <amodra@gmail.com>
432
433         * output.h (Output_data_got::add_global_tls, add_local_tls,
434         add_local_tls_pair): New functions.
435         (Output_data_got::add_local_pair_with_rel): Remove second
436         reloc param.  Expand comment.
437         (Output_data_got::Got_entry): Rename use_plt_offset_ to
438         use_plt_or_tls_offset_, similarly for constructor param.
439         (Output_data_got::Got_entry::write): Add got_index param.
440         * output.cc (Output_data_got::add_global_tls, add_local_tls,
441         add_local_tls_pair): New functions.
442         (Output_data_got::Got_entry::write): Handle tls symbols
443         with use_plt_or_tls_offset_ set specially.
444         (Output_data_got::add_local_pair_with_rel): Only one reloc.
445         (Output_data_got::do_write): Replace iterator with index, pass
446         index to entry write function.
447         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
448         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
449         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
450         call.
451         * i386.cc (Target_i386::Scan::local): Likewise.
452         * sparc.cc (Target_sparc::Scan::local): Likewise.
453         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
454         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
455         do_tls_offset_for_global): New functions.
456         (Target_powerpc::Scan::local): Correct TLS relocations and got
457         entry values.
458         (Target_powerpc::Scan::global): Don't emit unnecessary
459         dynamic relocations on TLS GOT entries.
460
461 2012-09-10  Matthias Klose  <doko@ubuntu.com>
462
463         * config.in: Disable sanity check for kfreebsd.
464
465 2012-09-10  Sterling Augustine  <saugustine@google.com>
466
467         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
468         (Gdb_index::pubtypes_read): New parameter.
469         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
470         to calls.
471         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
472         pubtypes_object_.
473
474 2012-09-09  Alan Modra  <amodra@gmail.com>
475
476         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
477         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
478         * gc.h (gc_process_relocs): Call target gc_add_reference.
479         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
480         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
481         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
482         unnecessary cast.
483         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
484         to cater for when we don't need code offset.  Update use.
485         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
486         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
487         set_opd_valid): New functions.
488         (Target_powerpc::do_gc_add_reference): New function.
489         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
490         stashed refs.
491         (Target_powerpc::do_gc_mark_symbol): New function.
492
493 2012-09-06  Cary Coutant  <ccoutant@google.com>
494
495         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
496         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
497         (Dwarf_die::skip_attributes): Likewise.
498         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
499         * testsuite/gdb_index_test.cc (inline_func_1): New function.
500         (main): Call it.
501         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
502
503 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
504
505         * testsuite/script_test_3.t: Add .got.plt output section
506         statement.
507         * testsuite/script_test_4.t: Likewise.
508
509 2012-09-05  Alan Modra  <amodra@gmail.com>
510
511         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
512         update all uses and lose "enum" when using type.
513
514 2012-09-05  Alan Modra  <amodra@gmail.com>
515
516         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
517         * configure: Regenerate.
518         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
519         (plugin_final_layout.stdout): Likewise.
520         (memory_test): Set page sizes to 0x1000.
521         * testsuite/Makefile.in: Regenerate.
522         * testsuite/discard_locals_test.sh: Add FIXME comment.
523         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
524         * testsuite/pr14265.t: Add .got output section statement.
525         * testsuite/script_test_2.t: Likewise.
526         * testsuite/script_test_3.t: Likewise.
527         * testsuite/script_test_4.t: Likewise.
528         * testsuite/script_test_5.t: Likewise.
529         * testsuite/script_test_6.t: Likewise.
530         * testsuite/script_test_7.t: Likewise.
531         * testsuite/script_test_9.t: Likewise.
532
533 2012-09-05  Alan Modra  <amodra@gmail.com>
534
535         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
536         (Powerpc_relocate_functions::Status): New typedef.
537         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
538         (Target_powerpc::Scan::local): Handle REL64.
539         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
540         for REL32 and REL64.
541         (Target_powerpc::symval_for_branch): New function, extracted from..
542         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
543         checks.  Report overflow errors.
544
545 2012-09-05  Alan Modra  <amodra@gmail.com>
546
547         * object.h (Sized_relobj_file::emit_relocs): Delete.
548         (Sized_relobj_file::emit_relocs_reltype): Delete.
549         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
550         relocate_relocs for --emit-relocs.
551         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
552         * output.h: Update comment.
553         (Output_segment::first_section): New function.
554         (Output_segment::first_section_load_address): Use first_section.
555         * output.cc (Output_segment::first_section): New function extracted..
556         (Output_segment::first_section_load_address): ..from here.  Delete.
557         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
558         * target.h (Sized_target::relocate_for_relocatable): Likewise.
559         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
560         adjust call to target.h function.
561         * i386.cc (Target_i386): Likewise.
562         * sparc.cc (Target_sparc): Likewise.
563         * x86_64.cc (Target_x86_64): Likewise.
564         * powerpc.cc (Target_powerpc): Likewise.
565         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
566         first tls section has section symbol for optimised local dynamic
567         output relocs.
568         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
569         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
570         optimised tls code.
571         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
572         Rename to relocate_relocs.  Update error message.
573
574 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
575
576         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
577         --just-symbols.
578
579 2012-08-31  Alan Modra  <amodra@gmail.com>
580
581         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
582         (Powerpc_relobj::toc_base_offset): New stub function.
583         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
584         got_mod_index_offset to tlsld_got_offset.  Update all refs.
585         (Target_powerpc::Relocate::enum skip_tls): New.
586         (Target_powerpc::call_tls_get_addr_): New var.
587         (Target_powerpc::is_branch_reloc): Move to file scope.
588         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
589         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
590         New functions.
591         (Target_powerpc::enum Got_type): Delete old values, add new ones.
592         (powerpc_info): Correct common_pagesize for ppc64.
593         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
594         (Powerpc_relocate_functions): Add overflow check enums and functions.
595         Add non-shift version of rela, rela_ua.  Delete all rel public
596         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
597         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
598         addr16_ha3, addr14 functions.
599         (Output_data_got_powerpc::add_constant_pair): New function.
600         (Output_data_got_powerpc::got_base_offset): Likewise.
601         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
602         (instruction constants): Sort, add some more.
603         (Output_data_glink::do_write): Add and use Address typedef.  Use
604         object->toc_base_offset() stub for 64-bit.
605         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
606         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
607         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
608         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
609         Always treat .opd relocs as against locally defined symbol.
610         Correct condition for RELATIVE relocs.
611         (Target_powerpc::do_finalize_sections): Test for NULL sections.
612         (Target_powerpc::Relocate::relocate): Use plt call stub as value
613         for 32-bit syms with a plt entry.  Correct ppc64 toc base
614         calculations.  Handle TLS relocs, and more.  Add overflow
615         checking and adjust for Powerpc_relocate_functions changes.
616         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
617         Reinstate --emit-relocs code with FIXME.
618
619 2012-08-30  Alan Modra  <amodra@gmail.com>
620
621         * layout.cc (Layout::set_segment_offsets): Set p_align to
622         abi_pagesize, not common_pagesize.
623         (Layout::relaxation_loop_body): Similarly use abi_pagesize
624         to determine whether file header can go in segment.
625
626 2012-08-30  Alan Modra  <amodra@gmail.com>
627
628         * output.h (Output_reloc::Output_reloc <output section>): Add
629         is_relative param.  Adjust calls.
630         (Output_reloc::add_output_section_relative): New functions.
631         * output.cc (Output_reloc::Output_reloc <output section>): Handle
632         is_relative.
633         (Output_reloc::symbol_value): Handle SECTION_CODE.
634
635 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
636
637         * gold.cc (queue_middle_tasks): Call layout again when unique
638         segments for sections is desired.
639         * layout.cc (Layout::Layout): Initialize new members.
640         (Layout::get_output_section_flags): New function.
641         (Layout::choose_output_section): Call get_output_section_flags.
642         (Layout::layout): Make output section for mapping to a unique segment.
643         (Layout::insert_section_segment_map): New function.
644         (Layout::attach_allocated_section_to_segment): Make unique segment for
645         output sections marked so.
646         (Layout::segment_precedes): Check for unique segments when sorting.
647         * layout.h (Layout::Unique_segment_info): New struct.
648         (Layout::Section_segment_map): New typedef.
649         (Layout::insert_section_segment_map): New function.
650         (Layout::get_output_section_flags): New function.
651         (Layout::is_unique_segment_for_sections_specified): New function.
652         (Layout::set_unique_segment_for_sections_specified): New function.
653         (Layout::unique_segment_for_sections_specified_): New member.
654         (Layout::section_segment_map_): New member.
655         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
656         Rename is_gc_pass_one to is_pass_one.
657         Rename is_gc_pass_two to is_pass_two.
658         Rename is_gc_or_icf to is_two_pass.
659         Check for which pass based on whether symbols data is present.
660         Make it two pass when unique segments for sections is desired.
661         * output.cc (Output_section::Output_section): Initialize new
662         members.
663         * output.h (Output_section::is_unique_segment): New function.
664         (Output_section::set_is_unique_segment): New function.
665         (Output_section::is_unique_segment_): New member.
666         (Output_section::extra_segment_flags): New function.
667         (Output_section::set_extra_segment_flags): New function.
668         (Output_section::extra_segment_flags_): New member.
669         (Output_section::segment_alignment): New function.
670         (Output_section::set_segment_alignment): New function.
671         (Output_section::segment_alignment_): New member.
672         (Output_segment::Output_segment): Initialize is_unique_segment_.
673         (Output_segment::is_unique_segment): New function.
674         (Output_segment::set_is_unique_segment): New function.
675         (Output_segment::is_unique_segment_): New member.
676         * plugin.cc (allow_unique_segment_for_sections): New function.
677         (unique_segment_for_sections): New function.
678         (Plugin::load): Add new functions to transfer vector.
679         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
680         * Makefile.in: Regenerate.
681         * testsuite/plugin_final_layout.sh: Check if unique segment
682         functionality works.
683         * testsuite/plugin_section_order.c (onload): Check if new interfaces
684         are available.
685         (allow_unique_segment_for_sections): New global.
686         (unique_segment_for_sections): New global.
687         (claim_file_hook): Call allow_unique_segment_for_sections.
688         (all_symbols_read_hook): Call unique_segment_for_sections.
689
690 2012-08-22  Cary Coutant  <ccoutant@google.com>
691
692         * layout.cc (Layout::include_section): Don't assert on GROUP
693         sections with --emit-relocs.
694
695 2012-08-21  Cary Coutant  <ccoutant@google.com>
696
697         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
698         if --export-dynamic-symbol names an undef symbol.
699
700 2012-08-18  Alan Modra  <amodra@gmail.com>
701
702         * powerpc.cc: Formatting and white space.
703         (Powerpc_relobj): Rename got2_section_ to special_.
704         Add opd_ent_shndx_ and opd_ent_off_ vectors.
705         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
706         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
707         (Target_powerpc): Add Address typedef and invalid_address.  Use
708         throughout.
709         (Target_powerpc::is_branch_reloc): New function.
710         (Powerpc_relocate_functions): Add Address typedef, use throughout.
711         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
712         for dst_mask, value and addend.
713         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
714         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
715         (Output_data_glink::do_write): Correct toc base.  Don't try to use
716         uint16_t for 24-bit offset.  Use get_output_section_offset and
717         check return.
718         (Target_powerpc::Scan::local): Handle more relocs.
719         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
720         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
721         Plug in toc restoring insn after plt calls.  Translate branches
722         to function descriptor symbols to corresponding entry point.
723         (Target_powerpc::relocate_for_relocatable): Check return from
724         get_output_section_offset.
725         * symtab.h: Comment typo.
726
727 2012-08-14  Ian Lance Taylor  <iant@google.com>
728
729         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
730         unsupported_relocal_local to call unsupported_reloc_global.
731
732 2012-08-14  Nick Clifton  <nickc@redhat.com>
733
734         PR ld/14265
735         * script-sections.cc (Sections_element::output_section_name): Add
736         keep return parameter.
737         (Output_section_element::match_name): Add keep return parameter.
738         Return the value of the keep_ member.
739         * script-sections.h (class Output_section): Update
740         output_section_name prototype.
741         * layout.cc (Layout::keep_input_section): New public member
742         function.
743         (Layout::choose_output_section): Pass keep parameter to
744         output_section_name.
745         * layout.h (class Layout): Add keep_input_section.
746         * object.cc (Sized_relobj_file::do_layout): Check for kept input
747         sections.
748         * testsuite/Makefile.am: Add a test.
749         * testsuite/Makefile.in: Regenerate.
750         * testsuite/pr14265.c: Source file for the test.
751         * testsuite/pr14265.t: Linker script for the test.
752         * testsuite/pr14265.sh: Shell script for the test.
753
754 2012-08-14  Alan Modra  <amodra@gmail.com>
755
756         * target.h (Target::output_section_name): New function.
757         (Target::do_output_section_name): New function.
758         * layout.cc (Layout::choose_output_section): Call the above.
759         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
760
761 2012-08-14  Alan Modra  <amodra@gmail.com>
762
763         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
764         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
765         for replace_constant call.
766         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
767         (Output_data_glink::do_print_to_mapfile): New function.
768         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
769         (Target_powerpc::Relocate::relocate): Likewise.
770
771 2012-08-14  Alan Modra  <amodra@gmail.com>
772
773         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
774         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
775         (Output_data_glink::add_entry,find_entry): Remove shndx param.
776         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
777         all references to shndx_.  Handle special case for R_PPC_PLTREL24
778         here.
779         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
780         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
781         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
782         here.
783         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
784         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
785
786 2012-08-12  Alan Modra  <amodra@gmail.com>
787
788         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
789         (glink insn constants): Use uint32_t.
790         (Output_data_glink::add_entry): Use insert, not [] operator.
791
792 2012-08-11  Alan Modra  <amodra@gmail.com>
793
794         * object.h (Sized_relobj_file::find_shdr): New function.
795         (Sized_relobj_file::find_special_sections): New function.
796         * object.cc (Sized_relobj_file::find_shdr): New function.
797         (Sized_relobj_file::find_eh_frame): Use find_shdr.
798         (Sized_relobj_file::find_special_sections): New function, split out..
799         (Sized_relobj_file::do_read_symbols): ..from here.
800         * output.h (Output_data_got::replace_constant): New function.
801         (Output_data_got::num_entries): New function.
802         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
803         (Output_data_got::got_offset): Protected rather than private.
804         (Output_data_got::replace_got_entry): New function.
805         * output.cc (Output_data_got::replace_got_entry): New function.
806         * powerpc.cc (class Powerpc_relobj): New.
807         (class Powerpc_relocate_functions): Delete all psymval variants or
808         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
809         Implement _ha functions using corresponding _hi function.
810         (Powerpc_relobj::find_special_sections): New function.
811         (Target_powerpc::do_make_elf_object): New function.
812         (class Output_data_got_powerpc): New.
813         (class Output_data_glink): New.
814         (class Powerpc_scan_relocatable_reloc): New.
815         Many more changes througout file.
816
817 2012-08-09  Nick Clifton  <nickc@redhat.com>
818
819         * po/vi.po: Updated Vietnamese translation.
820
821 2012-08-07  Ian Lance Taylor  <iant@google.com>
822
823         * layout.cc (Layout::add_target_dynamic_tags): If
824         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
825         plt_rel.
826
827 2012-07-30  Nick Clifton  <nickc@redhat.com>
828
829         * po/gold.pot: Updated template.
830         * po/es.po: Updated Spanish translation.
831
832 2012-07-18  Cary Coutant  <ccoutant@google.com>
833
834         PR gold/14344
835         * configure.ac: Add check for -gpubnames support.
836         * configure: Regenerate.
837         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
838         support; force -gno-pubnames.
839         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
840         support.
841         (gdb_index_test_4): New test.
842         * testsuite/Makefile.in: Regenerate.
843         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
844         * testsuite/gdb_index_test_2.sh: Likewise.
845         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
846         * testsuite/gdb_index_test_4.sh: New script.
847         * testsuite/gdb_index_test_comm.sh: New script with common code;
848         don't look for space after colon.
849
850 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
851
852         * gold.cc (queue_middle_tasks): Update function order only after
853         deferred objects due to plugins are processed.
854
855 2012-07-11  Ian Lance Taylor  <iant@google.com>
856
857         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
858         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
859         (Target_arm::scan_reloc_for_stub): Likewise.
860         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
861         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
862         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
863         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
864         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
865
866 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
867             Ian Lance Taylor  <iant@google.com>
868
869         PR gold/14309
870         * configure.ac: Test whether std::tr1::hash<off_t> works.
871         * gold.h: Add a specialization for std::tr1::hash<off_t> if
872         needed.
873         * output.h (class Output_fill): Add virtual destructor.
874         * configure, config.in: Rebuild.
875
876 2012-06-22  Roland McGrath  <mcgrathr@google.com>
877
878         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
879
880 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
881
882         * plugin.cc (Plugin::load): Handle position independent executables.
883
884 2012-06-06  Cary Coutant  <ccoutant@google.com>
885
886         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
887         add .debug_macro.
888         (lines_only_debug_sections): Likewise.
889         (gdb_fast_lookup_sections): New static array.
890         (is_gdb_debug_section): Rename formal parameter.
891         (is_lines_only_debug_section): Likewise.
892         (is_gdb_fast_lookup_section): New function.
893         (Layout::include_section): Check for ".zdebug_" prefix; pass
894         section name suffix to is_gdb_debug_section, et al.; check for
895         fast-lookup sections when building .gdb_index.
896         * options.h (--strip-debug-gdb): Update GDB version number.
897
898 2012-06-06  Cary Coutant  <ccoutant@google.com>
899
900         * configure.ac: Add check for fallocate.
901         * configure: Regenerate.
902         * config.in: Regenerate.
903
904         * options.h (class General_options): Add --mmap-output-file and
905         --posix-fallocate options.
906         * output.cc: (posix_fallocate): Remove; replace with...
907         (gold_fallocate): New function.
908         (Output_file::map_no_anonymous): Call gold_fallocate.
909         (Output_file::map): Check --mmap-output-file option.
910
911 2012-06-05  Jing Yu  <jingyu@google.com>
912
913         * gold.h (textdomain): Add do {} to empty while(0).
914         (bindtextdomain): Likewise.
915
916 2012-06-04  Cary Coutant  <ccoutant@google.com>
917
918         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
919         has_dynsym_index.
920
921 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
922
923         * symtab.cc (Symbol_table::define_special_symbol):
924         Initialize *poldsym to prevent uninitialized variable errors.
925
926 2012-05-23  Cary Coutant  <ccoutant@google.com>
927
928         * layout.cc (Layout::section_name_mapping): Add rules to handle
929         exact match on .data.rel.ro.local or .data.rel.ro.
930         (Layout::output_section_name): Check for exact matches.
931
932 2012-05-23  Cary Coutant  <ccoutant@google.com>
933
934         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
935         more carefully.
936
937 2012-05-22  Cary Coutant  <ccoutant@google.com>
938
939         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
940         object before exporting symbol.
941
942 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
943
944         * testsuite/tls_test.cc: Include "config.h" first.
945         * testsuite/tls_test_c.c: Likewise.
946
947 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
948             Nick Clifton  <nickc@redhat.com>
949
950         PR 14072
951         * configure.in: Add check that sysdep.h has been included before
952         any system header files.
953         * configure: Regenerate.
954         * config.in: Regenerate.
955
956 2012-05-14  Cary Coutant  <ccoutant@google.com>
957
958         * layout.cc (Layout::make_output_section): Mark .tdata section
959         as RELRO.
960         * testsuite/relro_test.cc: Add a TLS variable.
961
962 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
963
964         PR gold/14091
965         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
966         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
967         R_X86_64_64.
968
969 2012-05-08  Cary Coutant  <ccoutant@google.com>
970
971         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
972         (lines_only_debug_sections): Likewise.
973
974 2012-05-02  Roland McGrath  <mcgrathr@google.com>
975
976         * nacl.cc: New file.
977         * nacl.h: New file.
978         * Makefile.am (CCFILES, HFILES): Add them.
979         * Makefile.in: Regenerate.
980         * i386.cc (Output_data_plt_i386_nacl): New class.
981         (Output_data_plt_i386_nacl_exec): New class.
982         (Output_data_plt_i386_nacl_dyn): New class.
983         (Target_i386_nacl): New class.
984         (Target_selector_i386_nacl): New class.
985         (target_selector_i386): Use it instead of Target_selector_i386.
986         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
987         (Target_x86_64_nacl): New class.
988         (Target_selector_x86_64_nacl): New class.
989         (target_selector_x86_64, target_selector_x32): Use it instead of
990         Target_selector_x86_64.
991         * arm.cc (Output_data_plt_arm_nacl): New class.
992         (Target_arm_nacl): New class.
993         (Target_selector_arm_nacl): New class.
994         (target_selector_arm, target_selector_armbe): Use it instead of
995         Target_selector_arm.
996
997         * target-select.cc (select_target): Take new Input_file* and off_t
998         arguments, pass them on to recognize method of selector.
999         * object.cc (make_elf_sized_object): Update caller.
1000         * parameters.cc (parameters_force_valid_target): Likewise.
1001         * incremental.cc (make_sized_incremental_binary): Likewise.
1002         * target-select.h: Update decl.
1003         (Target_selector::recognize): Take new Input_file* argument,
1004         pass it on to do_recognize.
1005         (Target_selector::do_recognize): Take new Input_file* argument.
1006         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1007         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1008         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1009         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1010
1011         * target.h (Target::Target_info): New members isolate_execinstr
1012         and rosegment_gap.
1013         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1014         * arm.cc (Target_arm::arm_info): Update initializer.
1015         * i386.cc (Target_i386::i386_info): Likewise.
1016         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1017         * sparc.cc (Target_sparc::sparc_info): Likewise.
1018         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1019         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1020         * layout.cc (Layout::attach_allocated_section_to_segment):
1021         Take new const Target* argument.  If target->isolate_execinstr(), act
1022         like --rosegment.
1023         (Layout::find_first_load_seg): Take new const Target* argument;
1024         if target->isolate_execinstr(), reject PF_X segments.
1025         (Layout::relaxation_loop_body): Update caller.
1026         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1027         reset file offset to zero when we hit LOAD_SEG, and then do a second
1028         loop over the segments before LOAD_SEG to reassign offsets after
1029         addresses have been determined.  Handle target->rosegment_gap().
1030         (Layout::attach_section_to_segment): Take new const Target* argument;
1031         pass it to attach_allocated_section_to_segment.
1032         (Layout::make_output_section): Update caller.
1033         (Layout::attach_sections_to_segments): Take new const Target* argument;
1034         pass it to attach_section_to_segment.
1035         * gold.cc (queue_middle_tasks): Update caller.
1036         * layout.h (Layout): Update method decls with new arguments.
1037
1038         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1039         Target_info pointer to use.
1040         (Target_arm::do_make_data_plt): New virtual method.
1041         (Target_arm::make_data_plt): New method that calls it.
1042         (Target_arm::make_plt_entry): Use it.
1043         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1044         for the section alignment.
1045         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1046         method.
1047         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1048         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1049         method.
1050         (Output_data_plt_arm::get_plt_entry_size): Call it.
1051         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1052         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1053         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1054         method.
1055         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1056         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1057         method instead of sizeof(plt_entry).
1058         (Output_data_plt_arm::add_entry): Likewise.
1059         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1060         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1061         than static method.
1062         (Target_arm::plt_entry_size): Likewise.
1063         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1064         Move to ...
1065         (Output_data_plt_arm_standard): ... here, new class.
1066         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1067         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1068         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1069
1070         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1071         Take additional argument for the PLT entry size.
1072         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1073         Use get_plt_entry_size method rather than plt_entry_size variable.
1074         (Output_data_plt_x86_64::reserve_slot): Likewise.
1075         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1076         (Output_data_plt_x86_64::add_entry): Likewise.
1077         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1078         (Output_data_plt_x86_64::address_for_global): Likewise.
1079         (Output_data_plt_x86_64::address_for_local): Likewise.
1080         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1081         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1082         Make method non-static.
1083         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1084         method.
1085         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1086         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1087         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1088         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1089         virtual method.
1090         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1091         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1092         virtual method.
1093         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1094         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1095         virtual method.
1096         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1097         (Output_data_plt_x86_64::plt_entry_size)
1098         (Output_data_plt_x86_64::first_plt_entry)
1099         (Output_data_plt_x86_64::plt_entry)
1100         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1101         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1102         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1103         (Output_data_plt_x86_64_standard): ... here, new class.
1104         (Target_x86_64::Target_x86_64): Take optional argument for the
1105         Target_info pointer to use.
1106         (Target_x86_64::do_make_data_plt): New virtual method.
1107         (Target_x86_64::make_data_plt): New method to call it.
1108         (Target_x86_64::init_got_plt_for_update): Use that.
1109         Call this->plt_->add_eh_frame method here.
1110         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1111         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1112         rather than static method.
1113         (Target_x86_64::plt_entry_size): Likewise.
1114         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1115         rather than plt_entry_size variable.  Move guts of PLT filling to...
1116         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1117         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1118         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1119
1120         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1121         additional argument for the section alignment.
1122         Don't do add_eh_frame_for_plt here.
1123         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1124         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1125         variable.
1126         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1127         method.
1128         (Output_data_plt_i386::get_plt_entry_size): Call it.
1129         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1130         (Output_data_plt_i386::add_eh_frame): New method to call it.
1131         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1132         method.
1133         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1134         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1135         method.
1136         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1137         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1138         method instead of plt_entry_size.
1139         (Output_data_plt_i386::plt_entry_size)
1140         (Output_data_plt_i386::plt_eh_frame_fde_size)
1141         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1142         (Output_data_plt_i386_standard): ... here, new class.
1143         (Output_data_plt_i386_exec): New class.
1144         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1145         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1146         (Output_data_plt_i386::exec_plt_entry): Move to ...
1147         (Output_data_plt_i386_exec::plt_entry): ... here.
1148         (Output_data_plt_i386_dyn): New class.
1149         (Output_data_plt_i386::first_plt_entry): Move to ...
1150         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1151         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1152         (Output_data_plt_i386_dyn::plt_entry): ... here.
1153         (Target_i386::Target_i386): Take optional argument for the Target_info
1154         pointer to use.
1155         (Target_i386::do_make_data_plt): New virtual method.
1156         (Target_i386::make_data_plt): New method to call it.
1157         (Target_i386::make_plt_section): Use that.
1158         Call this->plt_->add_eh_frame method here.
1159         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1160         rather than plt_entry_size variable.
1161         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1162         (Output_data_plt_i386::address_for_local): Likewise.
1163         (Output_data_plt_i386::do_write): Likewise.
1164         Move guts of PLT filling to...
1165         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1166         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1167         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1168         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1169
1170 2012-05-01  Cary Coutant  <ccoutant@google.com>
1171
1172         * dwarf_reader.cc (Dwarf_die::read_attributes)
1173         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1174         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1175         * reduced_debug_output.cc
1176         (Output_reduced_debug_info_section::get_die_end): Remove
1177         DW_FORM_GNU_ref_index.  Add default case.
1178
1179 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1180
1181         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1182         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1183         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1184         DW_AT_high_pc as offset from DW_AT_low_pc.
1185
1186         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1187         * testsuite/Makefile.in: Regenerate.
1188         * testsuite/gdb_index_test_3.c: New test source file.
1189         * testsuite/gdb_index_test_3.sh: New test source file.
1190
1191 2012-04-25  Ian Lance Taylor  <iant@google.com>
1192
1193         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1194         pointer.
1195         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1196         as a class, not a struct.
1197         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1198         (Target_arm::apply_cortex_a8_workaround): Likewise.
1199         * gc.h: Declare Reloc_types as a struct, not a class.
1200         * object.h: Declare Symbols_data as a struct.
1201         * reloc.h: Declare Read_relocs_data as a struct.
1202         * target.h: Declare Relocate_info as a struct.
1203
1204 2012-04-24  David S. Miller  <davem@davemloft.net>
1205
1206         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1207         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1208         and R_SPARC_WPLT30.
1209
1210 2012-04-24  Cary Coutant  <ccoutant@google.com>
1211
1212         * incremental-dump.cc (find_input_containing_global): Replace
1213         magic number with symbolic constant.
1214         (dump_incremental_inputs): Update version number.
1215         * incremental.cc (Output_section_incremental_inputs): Update version
1216         number; import symbolic constants from Incremental_inputs_reader.
1217         (Incremental_inputs::create_data_sections): Align relocations
1218         section correctly for 64-bit targets.
1219         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1220         constants; add padding.
1221         (Output_section_incremental_inputs::write_header): Add assert for
1222         header_size.
1223         (Output_section_incremental_inputs::write_input_files): Add assert
1224         for input_entry_size.
1225         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1226         add assert for object_info_size, input_section_entry_size,
1227         global_sym_entry_size.
1228         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1229         for data structure sizes; use them.
1230         (Incremental_input_entry_reader): Import symbolic constants from
1231         Incremental_inputs_reader; use them.
1232
1233 2012-04-23  David S. Miller  <davem@davemloft.net>
1234
1235         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1236         and elf_flags_set_.
1237         (Target_sparc::Target_sparc): Initialize new fields.
1238         (Target_sparc::do_make_elf_object): New function.
1239         (Target_sparc::do_adjust_elf_header): New function.
1240
1241 2012-04-23  Cary Coutant  <ccoutant@google.com>
1242
1243         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1244         CU range table of gdb index.
1245
1246 2012-04-20  David S. Miller  <davem@davemloft.net>
1247
1248         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1249         instead of false.
1250
1251 2012-04-16  David S. Miller  <davem@davemloft.net>
1252
1253         * sparc.cc (Target_sparc::got_address): New function.
1254         (Sparc_relocate_functions::gdop_hix22): New function.
1255         (Sparc_relocate_functions::gdop_lox10): New function.
1256         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1257         relocs.
1258         (Target_sparc::Scan::local): Likewise if the global symbol is not
1259         preemptible and is not IFUNC.
1260         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1261         transformations for local and non-preemptible non-IFUNC global
1262         symbols.
1263
1264         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1265         writing out 64-bit part of ranges.
1266
1267         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1268         -fpic and -fpie respectively.
1269         * Makefile.in: Regenerate.
1270
1271         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1272         (Target_sparc::Target_sparc): Initialize new field.
1273         (Target_sparc::do_plt_section_for_global): New function.
1274         (Target_sparc::do_plt_section_for_local): New function.
1275         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1276         (Target_sparc::make_plt_section): New function, broken out of
1277         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1278         (Target_sparc::make_plt_entry): Call make_plt_section.
1279         (Target_sparc::make_local_ifunc_plt_entry): New function.
1280         (Target_sparc::rela_ifunc_section): New function.
1281         (Target_sparc::plt_section): Remove const.
1282         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1283         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1284         and ifunc_count_ fields.
1285         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1286         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1287         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1288         (Output_data_plt_sparc::rela_ifunc): New function.
1289         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1290         (Output_data_plt_sparc::has_ifunc_section): New function.
1291         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1292         (Output_data_plt_sparc::address_for_global): New function.
1293         (Output_data_plt_sparc::address_for_local): New function.
1294         (Output_data_plt_sparc::plt_index_to_offset): New function.
1295         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1296         and entry_count.
1297         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1298         entry_count.
1299         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1300         R_SPARC_JMP_IREL to switch.
1301         (Target_sparc::Scan::check_non_pic): Likewise.
1302         (Target_sparc::Scan::local): Handle IFUNC symbols.
1303         (Target_sparc::Scan::local): Likewise.
1304         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1305         and plt_address_for_local.
1306         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1307         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1308
1309         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1310         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1311         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1312         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1313         global relocs too.
1314         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1315         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1316         calls.
1317         * sparc.cc (Target_sparc::Scan::global): Likewise.
1318         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1319
1320 2012-04-16  Cary Coutant  <ccoutant@google.com>
1321
1322         * archive.cc (Library_base::should_include_member): Check for
1323         --export-dynamic-symbol.
1324         * options.h (class General_options): Add --export-dynamic-symbol.
1325         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1326         --export-dynamic-symbol.
1327         (Symbol_table::gc_mark_undef_symbols): Likewise.
1328         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1329
1330 2012-04-12  David S. Miller  <davem@davemloft.net>
1331
1332         * sparc.cc (Reloc::wdisp10): New relocation method.
1333         (Reloc::h34): Likewise.
1334         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1335         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1336         R_SPARC_WDISP10.
1337         (Target_sparc::Scan::local): Likewise.
1338         (Target_sparc::Scan::global): Likewise.
1339         (Target_sparc::Relocate::relocate): Likewise.
1340
1341 2012-04-09  Cary Coutant  <ccoutant@google.com>
1342
1343         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1344         low_pc == 0.
1345
1346 2012-04-06  Ian Lance Taylor  <iant@google.com>
1347
1348         * timer.cc: #include <unistd.h>.
1349
1350 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1351
1352         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1353         * config.in: Regenerate.
1354         * configure: Regenerate.
1355
1356 2012-04-05  Nick Clifton  <nickc@redhat.com>
1357
1358         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1359         (AM_LC_MESSAGES): Add.
1360         * aclocal.m4: Regenerate.
1361         * config.in: Regenerate.
1362         * configure: Regenerate.
1363
1364 2012-03-21  Cary Coutant  <ccoutant@google.com>
1365
1366         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1367         * Makefile.in: Regenerate.
1368         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1369         (Sized_elf_reloc_mapper::symbol_section): New function.
1370         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1371         (make_elf_reloc_mapper): New function.
1372         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1373         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1374         (Dwarf_abbrev_table::do_get_abbrev): New function.
1375         (Dwarf_ranges_table::read_ranges_table): New function.
1376         (Dwarf_ranges_table::read_range_list): New function.
1377         (Dwarf_pubnames_table::read_section): New function.
1378         (Dwarf_pubnames_table::read_header): New function.
1379         (Dwarf_pubnames_table::next_name): New function.
1380         (Dwarf_die::Dwarf_die): New function.
1381         (Dwarf_die::read_attributes): New function.
1382         (Dwarf_die::skip_attributes): New function.
1383         (Dwarf_die::set_name): New function.
1384         (Dwarf_die::set_linkage_name): New function.
1385         (Dwarf_die::attribute): New function.
1386         (Dwarf_die::string_attribute): New function.
1387         (Dwarf_die::int_attribute): New function.
1388         (Dwarf_die::uint_attribute): New function.
1389         (Dwarf_die::ref_attribute): New function.
1390         (Dwarf_die::child_offset): New function.
1391         (Dwarf_die::sibling_offset): New function.
1392         (Dwarf_info_reader::check_buffer): New function.
1393         (Dwarf_info_reader::parse): New function.
1394         (Dwarf_info_reader::do_parse): New function.
1395         (Dwarf_info_reader::do_read_string_table): New function.
1396         (Dwarf_info_reader::lookup_reloc): New function.
1397         (Dwarf_info_reader::get_string): New function.
1398         (Dwarf_info_reader::visit_compilation_unit): New function.
1399         (Dwarf_info_reader::visit_type_unit): New function.
1400         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1401         Sized_elf_reloc_mapper.
1402         (Sized_dwarf_line_info::symbol_section): Remove function.
1403         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1404         (Sized_dwarf_line_info::read_line_mappings): Remove object
1405         parameter, adjust callers.
1406         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1407         * dwarf_reader.h: Include <sys/types.h>.
1408         (class Track_relocs): Remove forward declaration.
1409         (class Elf_reloc_mapper): New class.
1410         (class Sized_elf_reloc_mapper): New class.
1411         (class Dwarf_abbrev_table): New class.
1412         (class Dwarf_range_list): New class.
1413         (class Dwarf_ranges_table): New class.
1414         (class Dwarf_pubnames_table): New class.
1415         (class Dwarf_die): New class.
1416         (class Dwarf_info_reader): New class.
1417         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1418         (Sized_dwarf_line_info::symbol_section): Remove member function.
1419         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1420         base class.
1421         * gdb-index.cc: New source file.
1422         * gdb-index.h: New source file.
1423         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1424         and .debug_types sections, call Layout::add_to_gdb_index.
1425         (Sized_relobj_incr::do_section_name): Implement.
1426         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1427         return type; Implement.
1428         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1429         return type.
1430         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1431         parameter list and return type.
1432         (Sized_incr_dynobj::do_section_contents): Likewise.
1433         * layout.cc: Include gdb-index.h.
1434         (Layout::Layout): Initialize gdb_index_data_.
1435         (Layout::init_fixed_output_section): Check for .gdb_index section.
1436         (Layout::add_to_gdb_index): New function. Instantiate.
1437         * layout.h: Add forward declaration for class Gdb_index.
1438         (Layout::add_to_gdb_index): New member function.
1439         (Layout::gdb_index_data_): New data member.
1440         * main.cc: Include gdb-index.h.
1441         (main): Print statistics for gdb index.
1442         * object.cc (Object::section_contents): Move code into
1443         do_section_contents.
1444         (need_decompressed_section): Check for sections needed when building
1445         gdb index.
1446         (build_compressed_section_map): Likewise.
1447         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1448         gdb index.
1449         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1450         sections; call Layout::add_to_gdb_index.
1451         (Sized_relobj_file::do_decompressed_section_contents): Call
1452         do_section_contents directly.
1453         * object.h (Object::do_section_contents): Adjust parameter list and
1454         return type.
1455         (Object::do_decompressed_section_contents): Call do_section_contents
1456         directly.
1457         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1458         return type.
1459         * options.h (class General_options): Add --gdb-index option.
1460         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1461         list and return type.
1462         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1463         * reloc.h (Track_relocs::checkpoint): New function.
1464         (Track_relocs::reset): New function.
1465
1466         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1467         New test cases.
1468         * testsuite/Makefile.in: Regenerate.
1469         * testsuite/gdb_index_test.cc: New test source file.
1470         * testsuite/gdb_index_test_1.sh: New test source file.
1471         * testsuite/gdb_index_test_2.sh: New test source file.
1472
1473 2012-03-19  Doug Kwan  <dougkwan@google.com>
1474
1475         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1476         (Target_arm::do_finalize_sections): Remove code which defines
1477         __exidx_start and __exidx_end.  Make symbol table parameter
1478         anonymous as it is not used.
1479         * gold.cc (queue_middle_tasks): Call target hook to define any
1480         target-specific symbols.
1481         * target.h (Target::define_standard_symbols): New method.
1482         (Target::do_define_standard_symbols): Same.
1483         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1484         * testsuite/Makefile.in: Regenerate.
1485         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1486         and __exidx_end.
1487         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1488         relocations are generated for __exidx_start and __exidx_end.
1489
1490 2012-03-16  Doug Kwan  <dougkwan@google.com>
1491
1492         * testsuite/Makefile.am: Disable test initpri3b.
1493         * testsuite/Makefile.in: Regenerate.
1494
1495 2012-03-15  Doug Kwan  <dougkwan@google.com>
1496
1497         * arm.cc (Target_arm::got_section): Make .got section read-only
1498         if -z now is given.
1499
1500 2012-03-15  Ian Lance Taylor  <iant@google.com>
1501
1502         PR gold/13850
1503         * layout.cc (Layout::make_output_section): Correctly mark
1504         SHT_INIT_ARRAY, et. al., as relro.
1505
1506 2012-03-14  Doug Kwan  <dougkwan@google.com>
1507
1508         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1509         dynamic relocations for protected symbols in shared objects.
1510
1511 2012-03-13  Ian Lance Taylor  <iant@google.com>
1512
1513         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1514         keep the larger alignment.
1515
1516 2012-03-12  Cary Coutant  <ccoutant@google.com>
1517
1518         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1519         handling of DW_LNE_define_file.
1520
1521 2012-03-12  Cary Coutant  <ccoutant@google.com>
1522
1523         * reduced_debug_output.cc
1524         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1525         codes to switch.
1526
1527 2012-02-29  Cary Coutant  <ccoutant@google.com>
1528
1529         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1530
1531 2012-02-29  Cary Coutant  <ccoutant@google.com>
1532
1533         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1534         Call Object::decompressed_section_contents.
1535         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1536         New dtor.
1537         (Sized_dwarf_line_info::buffer_start_): New data member.
1538         * merge.cc (Output_merge_data::do_add_input_section): Call
1539         Object::decompressed_section_contents.
1540         (Output_merge_string::do_add_input_section): Likewise.
1541         * object.cc (need_decompressed_section): New function.
1542         (build_compressed_section_map): Decompress sections needed later.
1543         (Sized_relobj_file::do_decompressed_section_contents): New function.
1544         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1545         * object.h (Object::decompressed_section_contents): New function.
1546         (Object::discard_decompressed_sections): New function.
1547         (Object::do_decompressed_section_contents): New function.
1548         (Object::do_discard_decompressed_sections): New function.
1549         (Compressed_section_info): New type.
1550         (Compressed_section_map): Include decompressed section contents.
1551         (Sized_relobj_file::do_decompressed_section_contents): New function.
1552         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1553
1554 2012-02-16  Cary Coutant  <ccoutant@google.com>
1555
1556         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1557         * testsuite/Makefile.in: Regenerate.
1558
1559 2012-02-14  Cary Coutant  <ccoutant@google.com>
1560
1561         * options.cc (General_options::finalize): Disallow -pie and -static.
1562
1563 2012-02-03  Doug Kwan  <dougkwan@google.com>
1564
1565         * arm.cc (Arm_relocate_functions::abs8,
1566         Arm_relocate_functions::abs16): Use
1567         Bits::has_signed_unsigned_overflow32.
1568         (Arm_relocate_functions::thm_abs8): Correct range of
1569         overflow check.
1570         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1571         in assertions.
1572
1573 2012-02-02  Doug Kwan  <dougkwan@google.com>
1574
1575         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1576         position independent outputs, not just shared objects.
1577
1578 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1579
1580         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1581         * configure: Regenerated.
1582
1583 2012-01-27  Ian Lance Taylor  <iant@google.com>
1584
1585         * reloc.h (Bits): New class with static functions, copied from
1586         namespace utils in arm.cc.
1587         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1588         instead.
1589
1590 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1591
1592         * incremental.cc (write_info_blocks): Correct relocation offset.
1593
1594 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1595
1596         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1597         (Relocate::tls_gd_to_le): Likewise.
1598
1599 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1600
1601         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1602
1603 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1604
1605         * configure.ac: Check if -mcmodel=medium works.
1606         * configure: Regenerated.
1607
1608 2012-01-24  Cary Coutant  <ccoutant@google.com>
1609
1610         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1611         definition and ...
1612         (read_unsigned_LEB_128_x): ... this new function.
1613         (read_signed_LEB_128): Replaced with inline definition and ...
1614         (read_signed_LEB_128_x): ... this new function.
1615         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1616         (read_unsigned_LEB_128): Add inline definition.
1617         (read_signed_LEB_128_x): New function.
1618         (read_signed_LEB_128): Add inline definition.
1619         * testsuite/Makefile.am (leb128_unittest): New unit test.
1620         * testsuite/Makefile.in: Regenerate.
1621         * testsuite/leb128_unittest.cc: New unit test.
1622
1623 2012-01-23  Ian Lance Taylor  <iant@google.com>
1624
1625         PR gold/13617
1626         * i386.cc (Target_i386::do_code_fill): When using a jmp
1627         instruction, pad with nop instructions.
1628         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1629
1630 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1631
1632         * x86_64.cc (gc_process_relocs): Add typename on types used in
1633         template.
1634         (scan_relocs): Likewise.
1635         (relocate_section): Likewise.
1636         (apply_relocation): Likewise.
1637
1638 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1639
1640         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1641         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1642         under x32.
1643
1644 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1645
1646         * x86_64.cc: Initial support for x32.
1647
1648 2012-01-03  Cary Coutant  <ccoutant@google.com>
1649
1650         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1651         Use abstract base class for GOT.
1652         * gold/output.h (class Output_data_got_base): New abstract base class.
1653         (class Output_data_got): Derive from new base class, adjust ctors.
1654         (Output_data_got::reserve_slot): Make virtual; rename to
1655         do_reserve_slot; Adjust callers.
1656         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1657         pointer to abstract base class.
1658         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1659
1660 2011-12-18  Ian Lance Taylor  <iant@google.com>
1661
1662         * object.h (Relobj::local_symbol_value): New function.
1663         (Relobj::local_plt_offset): New function.
1664         (Relobj::local_has_got_offset): New function.
1665         (Relobj::local_got_offset): New function.
1666         (Relobj::set_local_got_offset): New function.
1667         (Relobj::do_local_symbol_value): New pure virtual function.
1668         (Relobj::do_local_plt_offset): Likewise.
1669         (Relobj::do_local_has_got_offset): Likewise.
1670         (Relobj::do_local_got_offset): Likewise.
1671         (Relobj::do_set_local_got_offset): Likewise.
1672         (Sized_relobj::do_local_has_got_offset): Rename from
1673         local_has_got_offset.
1674         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1675         (Sized_relobj::do_set_local_got_offset): Rename from
1676         set_local_got_offset.
1677         (Sized_relobj_file::do_local_plt_offset): Rename from
1678         local_plt_offset.
1679         (Sized_relobj_file::do_local_symbol_value): New function.
1680         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1681         local_plt_offset.
1682         * output.cc (Output_data_got::Got_entry::write): Change object to
1683         Relobj.  Use local_symbol_value.
1684         (Output_data_got::add_global_with_rel): Change rel_dyn to
1685         Output_data_reloc_generic*.  Use add_global_generic.
1686         (Output_data_got::add_global_with_rela): Remove.  Change all
1687         callers to use add_global_with_rel.
1688         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1689         Output_data_reloc_generic*.  Use add_global_generic.
1690         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1691         callers to use add_global_pair_with_rel.
1692         (Output_data_got::add_local): Change object to Relobj*.
1693         (Output_data_got::add_local_plt): Likewise.
1694         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1695         change rel_dyn to Output_data_reloc_generic*.  Use
1696         add_local_generic.
1697         (Output_data_got::add_local_with_rela): Remove.  Change all
1698         callers to use all_local_with_rel.
1699         (Output_data_got::add_local_pair_with_rel): Change object to
1700         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1701         add_output_section_generic.
1702         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1703         callers to use add_local_pair_with_rel.
1704         (Output_data_got::reserve_local): Change object to Relobj*.
1705         * output.h: (class Output_data_reloc_generic): Add pure virtual
1706         declarations for add_global_generic, add_local_generic,
1707         add_output_section_generic.
1708         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1709         functions for Output_data_reloc_generic.  Update declarations for
1710         changes listed in output.cc.
1711         (class Output_data_got): Change template parameter to got_size.
1712         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1713         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1714         function.
1715         (Sized_relobj_incr::do_local_plt_offset): New function.
1716         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1717         add_global_generic.
1718
1719 2011-12-17  Cary Coutant  <ccoutant@google.com>
1720
1721         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1722         * resolve.cc (Symbol_table::resolve): Likewise.
1723         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1724         arrays.
1725         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1726
1727 2011-12-16  Ian Lance Taylor  <iant@google.com>
1728
1729         * output.h (Output_data_reloc_generic::add): Only call
1730         add_dynamic_reloc if this is a dynamic reloc section.
1731
1732 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1733
1734         PR gold/13505
1735         * target-reloc.h (apply_relocation): Replace <64, false> with
1736         <size, big_endian>.
1737
1738 2011-11-25  Nick Clifton  <nickc@redhat.com>
1739
1740         * po/it.po: New Italian translation.
1741
1742 2011-11-17  Sterling Augustine  <saugustine@google.com>
1743
1744         * script.cc (script_include_directive): Implement.
1745         (read_script_file): New local variables name and search_path. Update
1746         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1747         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1748         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1749
1750 2011-11-11  Sterling Augustine  <saugustine@google.com>
1751
1752         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1753         (file_or_sections_cmd): Likewise.
1754
1755 2011-11-11  Doug Kwan  <dougkwan@google.com>
1756
1757         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1758         if --just-symbols is given.
1759
1760 2011-11-10  Doug Kwan  <dougkwan@google.com>
1761
1762         PR gold/13362
1763         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1764         when processing data relocs.
1765         * reloc.h (Relocate_functions::rel_unaligned): New method.
1766         (Relocate_functions::pcrel_unaligned): Ditto.
1767         (Relocate_functions::rel32_unaligned): Ditto.
1768         (Relocate_functions::pcrel32_unaligned): Ditto.
1769
1770 2011-11-09  Doug Kwan  <dougkwan@google.com>
1771
1772         PR gold/13362
1773         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1774         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1775         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1776         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1777         (Relocate_functions::rel_unaligned): New.
1778         (Relocate_functions::rel32_unaligned): New.
1779         * target-reloc.h (relocate_for_relocatable): Add code to handle
1780         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1781         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1782         arm_unaligned_reloc_r): New targets.
1783         * testsuite/Makefile.in: Regenerate.
1784         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1785         linking.
1786
1787 2011-11-02  Ian Lance Taylor  <iant@google.com>
1788
1789         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1790         NATIVE_LINKER.
1791         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1792         * options.cc (General_options::finalize): Use library search path
1793         from configure script if specified.  If not native and no sysroot,
1794         only search TOOLLIBDIR.
1795         * options.h (Search_directory::Search_directory): Change name to
1796         const std::string&.
1797         (General_options::add_to_library_path_with_sysroot): Change arg to
1798         const std::string&.
1799         * configure, Makefile.in, config.in: Rebuild.
1800
1801 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1802
1803         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1804         we are working around the ARM1176 Erratum.
1805         * options.h (General_options::fix_arm1176): Add option.
1806         * testsuite/Makefile.am: Add testcases, and keep current ones
1807         working.
1808         * testsuite/Makefile.in: Regenerate.
1809         * testsuite/arm_fix_1176.s: New file.
1810         * testsuite/arm_fix_1176.sh: Likewise.
1811
1812 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1813
1814         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1815         may_use_blx_.
1816         (Target_arm::may_use_blx): Remove method.
1817         (Target_arm::set_may_use_blx): Likewise.
1818         (Target_arm::may_use_v4t_interworking): New method.
1819         (Target_arm::may_use_v5t_interworking): Likewise.
1820         (Target_arm::may_use_blx_): Remove member variable.
1821         (Arm_relocate_functions::arm_branch_common): Check for v5T
1822         interworking.
1823         (Arm_relocate_functions::thumb_branch_common): Likewise.
1824         (Reloc_stub::stub_type_for_reloc): Likewise.
1825         (Target_arm::do_finalize_sections): Correct interworking checks.
1826         * testsuite/Makefile.am: Add new tests.
1827         * testsuite/Makefile.in: Regenerate.
1828         * testsuite/arm_farcall_arm_arm.s: New test.
1829         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1830         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1831         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1832         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1833         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1834         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1835         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1836
1837 2011-10-31  Cary Coutant  <ccoutant@google.com>
1838
1839         PR gold/13023
1840         * expression.cc (Expression::eval_with_dot): Add
1841         is_section_dot_assignment parameter.
1842         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1843         absolute and assigning to dot within a section.
1844         * script-sections.cc
1845         (Output_section_element_assignment::set_section_addresses): Pass
1846         dot_section to set_if_absolute.
1847         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1848         as is_section_dot_assignment flag to eval_with_dot.
1849         (Output_section_element_dot_assignment::set_section_addresses):
1850         Likewise.
1851         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1852         parameter.  Also set value if relative to dot_section; set the
1853         symbol's output_section.
1854         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1855         parameter.  Adjust all callers.
1856         (Expression::eval_maybe_dot): Likewise.
1857         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1858         Adjust all callers.
1859         * testsuite/script_test_2.t: Test assignment of an absolute value
1860         to dot within an output section element.
1861
1862 2011-10-31  Cary Coutant  <ccoutant@google.com>
1863
1864         * options.h (class General_options): Add --[no-]gnu-unique options.
1865         * symtab.cc (Symbol_table::sized_write_globals): Convert
1866         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1867
1868 2011-10-31  Cary Coutant  <ccoutant@google.com>
1869
1870         PR gold/13359
1871         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1872         unnecessary assertion.
1873         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1874
1875 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1876
1877         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1878         gc_mark_symbol.
1879         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1880         gc_mark_symbol.
1881         Change to just keep the section associated with symbol.
1882         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1883         they are externally visible and --export-dynamic is turned on.
1884         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1885
1886 2011-10-19  Ian Lance Taylor  <iant@google.com>
1887
1888         PR gold/13163
1889         * script-sections.cc
1890         (Output_section_element_dot_assignment::needs_output_section): New
1891         function.
1892
1893 2011-10-19  Ian Lance Taylor  <iant@google.com>
1894
1895         PR gold/13204
1896         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1897         --section-start option was seen.
1898         * options.h (General_options::any_section_start): New function.
1899
1900 2011-10-18  David S. Miller  <davem@davemloft.net>
1901
1902         PR binutils/13301
1903         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1904         member to track relocation locations that have moved during TLS
1905         reloc optimizations.
1906         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1907         (Target_sparc::Relocate::relocate): Adjust view down by 4
1908         bytes if it matches reloc_adjust_addr_.
1909         (Target_sparc::Relocate::relocate_tls): Always move the
1910         __tls_get_addr call delay slot instruction forward 4 bytes when
1911         performing relaxation.
1912
1913 2011-10-18  Cary Coutant  <ccoutant@google.com>
1914
1915         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1916         (Output_file::map_no_anonymous): Check for non-zero
1917         return code from posix_fallocate.
1918
1919 2011-10-17  Cary Coutant  <ccoutant@google.com>
1920
1921         PR gold/13245
1922         * plugin.cc (is_visible_from_outside): Check for symbols
1923         referenced from dynamic objects.
1924         * resolve.cc (Symbol_table::resolve): Don't count references
1925         from dynamic objects as references from real ELF files.
1926         * testsuite/plugin_test_2.sh: Adjust expected result.
1927
1928 2011-10-17  Cary Coutant  <ccoutant@google.com>
1929
1930         * gold.cc: Include timer.h.
1931         (queue_middle_tasks): Stamp time.
1932         (queue_final_tasks): Likewise.
1933         * main.cc (main): Store timer in parameters.  Print timers
1934         for each pass.
1935         * parameters.cc (Parameters::Parameters): Initialize timer_.
1936         (Parameters::set_timer): New function.
1937         (set_parameters_timer): New function.
1938         * parameters.h (Parameters::set_timer): New function.
1939         (Parameters::timer): New function.
1940         (Parameters::timer_): New data member.
1941         (set_parameters_timer): New function.
1942         * timer.cc (Timer::stamp): New function.
1943         (Timer::get_pass_time): New function.
1944         * timer.h (Timer::stamp): New function.
1945         (Timer::get_pass_time): New function.
1946         (Timer::pass_times_): New data member.
1947
1948 2011-10-17  Cary Coutant  <ccoutant@google.com>
1949
1950         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1951         task for members of lib groups.
1952
1953 2011-10-17  Cary Coutant  <ccoutant@google.com>
1954
1955         PR gold/13288
1956         * fileread.cc (File_read::find_view): Add assert.
1957         (File_read::make_view): Move bounds check (replace with assert)...
1958         (File_read::find_or_make_view): ... to here.
1959
1960 2011-10-12  Cary Coutant  <ccoutant@google.com>
1961
1962         * output.cc (Output_file::open_base_file): Handle case where
1963         ::read returns less than requested size.
1964
1965 2011-10-10  Cary Coutant  <ccoutant@google.com>
1966
1967         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1968         Initialize defined_count_.
1969         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1970         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1971         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1972         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1973         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1974         * incremental.h (Sized_relobj_incr::defined_count_): New data
1975         member.
1976         (Sized_incr_dynobj::defined_count_): New data member.
1977         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1978         Return zeroes instead of internal error.
1979
1980 2011-10-10  Cary Coutant  <ccoutant@google.com>
1981
1982         PR gold/13249
1983         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1984         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1985         * output.h (class Output_reloc): Add use_plt_offset flag.
1986         (Output_reloc::type_): Adjust size of bit field.
1987         (Output_reloc::use_plt_offset_): New bit field.
1988         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1989         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1990         flag.  Adjust all callers.
1991         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1992         creating RELATIVE relocations.
1993
1994 2011-10-10  Nick Clifton  <nickc@redhat.com>
1995
1996         * po/es.po: Updated Spanish translation.
1997         * po/fi.po: Updated Finnish translation.
1998
1999 2011-10-03   Diego Novillo  <dnovillo@google.com>
2000
2001         * options.cc (parse_uint): Fix dereference of RETVAL.
2002
2003 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2004
2005         * layout.h (section_order_map_): New member.
2006         (get_section_order_map): New member function.
2007         * output.cc (Output_section::add_input_section): Check for patterns
2008         only when --section-ordering-file is specified.
2009         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2010         output_sections have been formed.
2011         * layout.cc (Layout_Layout): Initialize section_order_map_.
2012         * plugin.cc (update_section_order): Store order in order_map. Do not
2013         update the order.
2014         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2015         * testsuite/Makefile.in: Regenerate.
2016         * testsuite/plugin_section_order.c: New file.
2017         * testsuite/plugin_final_layout.cc: New file.
2018         * testsuite/plugin_final_layout.sh: New file.
2019
2020 2011-09-29  Cary Coutant  <ccoutant@google.com>
2021
2022         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2023         Check for NULL.
2024         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2025         symbols during incremental update.
2026         (Symbol_table::add_from_dynobj): Likewise.
2027
2028 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2029             Ian Lance Taylor  <iant@google.com>
2030
2031         * symtab.cc (Symbol_table::define_special_symbol): Always
2032         canonicalize version string.
2033
2034 2011-09-26  Cary Coutant  <ccoutant@google.com>
2035
2036         * gold.cc (queue_initial_tasks): Move option checks ...
2037         * options.cc (General_options::finalize): ... to here. Disable
2038         some options; make others fatal.
2039
2040 2011-09-26  Cary Coutant  <ccoutant@google.com>
2041
2042         gcc PR lto/47247
2043         * plugin.cc (get_symbols_v2): New function.
2044         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2045         (is_referenced_from_outside): New function.
2046         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2047         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2048         (get_symbols): Pass version parameter.
2049         (get_symbols_v2): New function.
2050         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2051         parameter.
2052         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2053         (onload): Add LDPT_GET_SYMBOLS_V2.
2054         (all_symbols_read_hook): Use get_symbols_v2; check for
2055         LDPR_PREVAILING_DEF_IRONLY_EXP.
2056         * testsuite/plugin_test_3.sh: Update expected results.
2057
2058 2011-09-23  Simon Baldwin  <simonb@google.com>
2059
2060         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2061         configuration options.
2062         * configure: Regenerate.
2063         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2064         * Makefile.in: Regenerate.
2065         * testsuite/Makefile.in: Regenerate.
2066
2067 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2068
2069         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2070
2071 2011-09-19  Cary Coutant  <ccoutant@google.com>
2072
2073         * incremental.cc (can_incremental_update): Fix typo in comment.
2074         * incremental.h (can_incremental_update): Likewise.
2075
2076 2011-09-18  Cary Coutant  <ccoutant@google.com>
2077
2078         * incremental.cc (can_incremental_update): New function.
2079         * incremental.h (can_incremental_update): New function.
2080         * layout.cc (Layout::init_fixed_output_section): Call it.
2081         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2082         * object.cc (Sized_relobj_file::do_layout): Call
2083         can_incremental_update.
2084
2085 2011-09-13  Cary Coutant  <ccoutant@google.com>
2086
2087         * configure.ac: Check for glibc support for gnu_indirect_function
2088         support with static linking, setting automake conditional
2089         IFUNC_STATIC.
2090         * Makefile.in: Regenerate.
2091         * configure: Regenerate.
2092
2093         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2094         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2095         for IFUNC_STATIC.
2096         * testsuite/Makefile.in: Regenerate.
2097
2098 2011-09-13  Cary Coutant  <ccoutant@google.com>
2099
2100         * incremental.cc (Sized_relobj_incr::do_layout): Call
2101         report_comdat_group for kept comdat sections.
2102         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2103         * testsuite/Makefile.in: Regenerate.
2104         * testsuite/incr_comdat_test_1.cc: New source file.
2105         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2106         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2107         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2108
2109 2011-09-13  Ian Lance Taylor  <iant@google.com>
2110
2111         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2112         variable external_symbols_offset.
2113
2114 2011-09-12  Ian Lance Taylor  <iant@google.com>
2115
2116         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2117         triggered if object has no symbols.
2118
2119 2011-09-09  David S. Miller  <davem@davemloft.net>
2120
2121         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2122         (Output_fill_debug_line::do_write): Likewise.
2123
2124 2011-08-29  Cary Coutant  <ccoutant@google.com>
2125
2126         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2127         casts to match formatting specs.
2128         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2129
2130 2011-08-26  Cary Coutant  <ccoutant@google.com>
2131
2132         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2133         remaining hole size when allocating.
2134         (Layout::make_output_section): Set fill methods for debug sections.
2135         * layout.h (Free_list::Free_list_node): Move from private to
2136         public.
2137         (Free_list::set_min_hole_size): New function.
2138         (Free_list::begin, Free_list::end): New functions.
2139         (Free_list::min_hole_): New data member.
2140         * output.cc: Include dwarf.h.
2141         (Output_fill_debug_info::do_minimum_hole_size): New function.
2142         (Output_fill_debug_info::do_write): New function.
2143         (Output_fill_debug_line::do_minimum_hole_size): New function.
2144         (Output_fill_debug_line::do_write): New function.
2145         (Output_section::Output_section): Initialize new data member.
2146         (Output_section::set_final_data_size): Ensure patch space is larger
2147         than minimum hole size.
2148         (Output_section::do_write): Fill holes in debug sections.
2149         * output.h (Output_fill): New class.
2150         (Output_fill_debug_info): New class.
2151         (Output_fill_debug_line): New class.
2152         (Output_section::set_free_space_fill): New function.
2153         (Output_section::free_space_fill_): New data member.
2154         * testsuite/Makefile.am (incremental_test_3): Add
2155         --incremental-patch option.
2156         (incremental_test_4): Likewise.
2157         (incremental_test_5): Likewise.
2158         (incremental_test_6): Likewise.
2159         (incremental_copy_test): Likewise.
2160         (incremental_common_test_1): Likewise.
2161         * testsuite/Makefile.in: Regenerate.
2162
2163 2011-08-26  Nick Clifton  <nickc@redhat.com>
2164
2165         * po/es.po: Updated Spanish translation.
2166
2167 2011-08-01  Cary Coutant  <ccoutant@google.com>
2168
2169         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2170         * gold/testsuite/Makefile.in: Regenerate.
2171         * gold/testsuite/justsyms_exec.c: New source file.
2172         * gold/testsuite/justsyms_lib.c: New source file.
2173
2174 2011-08-01  Cary Coutant  <ccoutant@google.com>
2175
2176         * layout.cc (Layout::set_segment_offsets): Don't realign text
2177         segment if -Ttext was specified.
2178         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2179         file type.
2180         * object.h (Sized_relobj_file::e_type): New function.
2181         (Sized_relobj_file::e_type_): New data member.
2182         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2183         base address for ET_EXEC files.
2184         * target.cc (Target::do_make_elf_object_implementation): Allow
2185         ET_EXEC files with --just-symbols option.
2186
2187 2011-07-28  Cary Coutant  <ccoutant@google.com>
2188
2189         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2190         Add thread_number parameter.
2191         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2192         * workqueue-threads.cc
2193         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2194         current thread if its thread number is greater than desired thread
2195         count.
2196         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2197         Add thread_number parameter.
2198         (Workqueue::should_cancel_thread): Likewise.
2199         (Workqueue::find_runnable_or_wait): Pass thread_number to
2200         should_cancel_thread.
2201         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2202         parameter.
2203
2204 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2205
2206         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2207         only after checking if it cannot be forced local.
2208         * symtab.h (is_externally_visible): Check if the symbol is not forced
2209         local.
2210
2211 2011-07-15  Ian Lance Taylor  <iant@google.com>
2212
2213         * options.h (class General_options): Add --print-output-format.
2214         Move -EL next to -EB, for  better --help output.
2215         * target-select.cc: Include <cstdio>, "options.h", and
2216         "parameters.h".
2217         (Target_selector::do_target_bfd_name): New function.
2218         (print_output_format): New function.
2219         * target-select.h (class Target_selector): Update declarations.
2220         (Target_selector::target_bfd_name): New function.
2221         (print_output_format): Declare.
2222         * main.cc: Include "target-select.h".
2223         (main): Handle --print-output-format.
2224         * gold.cc: Include "target-select.h".
2225         (queue_initial_tasks): Handle --print-output-format when there are
2226         no input files.
2227         * parameters.cc (parameters_force_valid_target): Give a better
2228         error message if -EB/-EL does not match target.
2229         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2230         function.
2231
2232 2011-07-15  Ian Lance Taylor  <iant@google.com>
2233
2234         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2235         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2236         (Output_data_plt_i386::do_write): Write address of .dynamic
2237         section to first entry in .got.plt section.
2238         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2239         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2240         Initialize layout_.
2241         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2242         section to first entry in .got.plt section.
2243         * layout.h (Layout::dynamic_section): New function.
2244
2245 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2246
2247         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2248         to claim_file call.
2249         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2250         input_section_position_, and input_section_glob_.
2251         (read_layout_from_file): Call function section_ordering_specified.
2252         * layout.h (is_section_ordering_specified): New function.
2253         (section_ordering_specified): New function.
2254         (section_ordering_specified_): New boolean member.
2255         * main.cc(main): Call load_plugins after layout object is defined.
2256         * output.cc (Output_section::add_input_section): Use
2257         function section_ordering_specified to check if section ordering is
2258         needed.
2259         * output.cc (Output_section::add_relaxed_input_section): Use
2260         function section_ordering_specified to check if section ordering is
2261         needed.
2262         (Output_section::update_section_layout): New function.
2263         (Output_section::sort_attached_input_sections): Check if input section
2264         must be reordered.
2265         * output.h (Output_section::update_section_layout): New function.
2266         * plugin.cc (get_section_count): New function.
2267         (get_section_type): New function.
2268         (get_section_name): New function.
2269         (get_section_contents): New function.
2270         (update_section_order): New function.
2271         (allow_section_ordering): New function.
2272         (Plugin::load): Add the new interfaces to the transfer vector.
2273         (Plugin_manager::load_plugins): New parameter.
2274         (Plugin_manager::all_symbols_read): New parameter.
2275         (Plugin_manager::claim_file): New parameter. Save the elf object for
2276         unclaimed objects.
2277         (Plugin_manager::get_elf_object): New function.
2278         (Plugin_manager::get_view): Change to directly use the bool to check
2279         if get_view is called from claim_file_hook.
2280         * plugin.h (input_objects): New function
2281         (Plugin__manager::load_plugins): New parameter.
2282         (Plugin_manager::claim_file): New parameter.
2283         (Plugin_manager::get_elf_object): New function.
2284         (Plugin_manager::in_claim_file_handler): New function.
2285         (Plugin_manager::in_claim_file_handler_): New member.
2286         (layout): New function.
2287         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2288         handler with an extra parameter. Make the elf object before calling
2289         claim_file handler.
2290         * testsuite/plugin_test.c (get_section_count): New function pointer.
2291         (get_section_type): New function pointer.
2292         (get_section_name): New function pointer.
2293         (get_section_contents): New function pointer.
2294         (update_section_order): New function pointer.
2295         (allow_section_ordering): New function pointer.
2296         (onload): Check if the new interfaces exist.
2297
2298 2011-07-13  Ian Lance Taylor  <iant@google.com>
2299
2300         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2301         relro section.
2302         * x86_64.cc (Target_x86_64::got_section): Likewise.
2303         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2304         (relro_now_test_SOURCES): New variable.
2305         (relro_now_test_DEPENDENCIES): New variable.
2306         (relro_now_test_LDFLAGS): New variable.
2307         (relro_now_test_LDADD): New variable.
2308         (relro_now_test.so): New target.
2309         * testsuite/Makefile.in: Rebuild.
2310
2311 2011-07-12  Ian Lance Taylor  <iant@google.com>
2312
2313         PR gold/12980
2314         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2315         GLOB_DAT relocation rather than a RELATIVE relocation for a
2316         protected symbol when creating a shared library.
2317         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2318         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2319         * testsuite/protected_main_1.cc (main): Test that protected
2320         function has same address.
2321
2322 2011-07-11  Ian Lance Taylor  <iant@google.com>
2323
2324         PR gold/12979
2325         * options.h (class General_options): Add -Bgroup.
2326         * options.cc (General_options::finalize): If -Bgroup is set,
2327         default to --unresolved-symbols=report-all.
2328         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2329         * target-reloc.h (issue_undefined_symbol_error): Handle
2330         --unresolved-symbols=report-all.
2331
2332 2011-07-08  Ian Lance Taylor  <iant@google.com>
2333
2334         PR gold/11985
2335         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2336         if linker script discards key sections.
2337         (Layout::create_dynamic_symtab): Likewise.
2338         (Layout::assign_local_dynsym_offsets): Likewise.
2339         (Layout::sized_create_version_sections): Likewise.
2340         (Layout::create_interp): Likewise.
2341         (Layout::finish_dynamic_section): Likewise.
2342         (Layout::set_dynamic_symbol_size): Likewise.
2343
2344 2011-07-08  Ian Lance Taylor  <iant@google.com>
2345
2346         PR gold/12386
2347         * options.h (class General_options): Add --unresolved-symbols.
2348         * target-reloc.h (issue_undefined_symbol_error): Check
2349         --unresolved-symbols.  Add comments.
2350
2351 2011-07-08  Ian Lance Taylor  <iant@google.com>
2352
2353         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2354         expression more complex.
2355
2356 2011-07-08  Ian Lance Taylor  <iant@google.com>
2357
2358         PR gold/11317
2359         * target-reloc.h (issue_undefined_symbol_error): New inline
2360         function, broken out of relocate_section.
2361         (relocate_section): Call issue_undefined_symbol_error.
2362         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2363         there is no TLS segment if we are about to issue an undefined
2364         symbol error.
2365         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2366
2367 2011-07-08  Ian Lance Taylor  <iant@google.com>
2368
2369         PR gold/12279
2370         * resolve.cc (Symbol_table::should_override): Add fromtype
2371         parameter.  Change all callers.  Give error when linking together
2372         TLS and non-TLS symbol.
2373         (Symbol_table::should_override_with_special): Add fromtype
2374         parameter.  Change all callers.
2375         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2376         there is no TLS segment if we have reported some errors.
2377         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2378
2379 2011-07-08  Ian Lance Taylor  <iant@google.com>
2380
2381         PR gold/12372
2382         * target.h (Target::plt_address_for_global): New function.
2383         (Target::plt_address_for_local): New function.
2384         (Target::plt_section_for_global): Remove.
2385         (Target::plt_section_for_local): Remove.
2386         (Target::do_plt_address_for_global): New virtual function.
2387         (Target::do_plt_address_for_local): New virtual function.
2388         (Target::do_plt_section_for_global): Remove.
2389         (Target::do_plt_section_for_local): Remove.
2390         (Target::register_global_plt_entry): Add Symbol_table and Layout
2391         parameters.
2392         * output.cc (Output_data_got::Got_entry::write): Use
2393         plt_address_for_global and plt_address_for_local.
2394         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2395         address of output section.
2396         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2397         got_irelative_, and irelative_count_ fields.  Update
2398         declarations.
2399         (Output_data_plt_i386::has_irelative_section): New function.
2400         (Output_data_plt_i386::entry_count): Add irelative_count_.
2401         (Output_data_plt_i386::set_final_data_size): Likewise.
2402         (class Target_i386): Add got_irelative_ and rel_irelative_
2403         fields.  Update declarations.
2404         (Target_i386::Target_i386): Initialize new fields.
2405         (Target_i386::do_plt_address_for_global): New function replacing
2406         do_plt_section_for_global.
2407         (Target_i386::do_plt_address_for_local): New function replacing
2408         do_plt_section_for_local.
2409         (Target_i386::got_section): Create got_irelative_.
2410         (Target_i386::rel_irelative_section): New function.
2411         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2412         fields.  Don't define __rel_iplt_{start,end}.
2413         (Output_data_plt_i386::add_entry): Add symtab and layout
2414         parameters.  Change all callers.  Use different PLT and GOT for
2415         IFUNC symbols.
2416         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2417         layout parameters.  Change all callers.  Use different PLT and
2418         GOT.
2419         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2420         (Output_data_plt_i386::rel_irelative): New function.
2421         (Output_data_plt_i386::address_for_global): New function.
2422         (Output_data_plt_i386::address_for_local): New function.
2423         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2424         IRELATIVE GOT when changing IFUNC GOT entries.
2425         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2426         reloc.
2427         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2428         if we didn't create an IRELATIVE GOT.
2429         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2430         plt_address_for_local.
2431         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2432         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2433         got_irelative_, and irelative_count_ fields.  Update
2434         declarations.
2435         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2436         Initialize new fields.  Remove symtab parameter.  Change all
2437         callers.
2438         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2439         irelative_count_.
2440         (Output_data_plt_x86_64::has_irelative_section): New function.
2441         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2442         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2443         fields.  Update declarations.
2444         (Target_x86_64::Target_x86_64): Initialize new fields.
2445         (Target_x86_64::do_plt_address_for_global): New function replacing
2446         do_plt_section_for_global.
2447         (Target_x86_64::do_plt_address_for_local): New function replacing
2448         do_plt_section_for_local.
2449         (Target_x86_64::got_section): Create got_irelative_.
2450         (Target_x86_64::rela_irelative_section): New function.
2451         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2452         all callers.  Don't create __rel_iplt_{start,end}.
2453         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2454         parameters.  Change all callers.  Use different PLT and GOT for
2455         IFUNC symbols.
2456         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2457         layout parameters.  Change all callers.  Use different PLT and
2458         GOT.
2459         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2460         parameters.  Change all callers.  Use different PLT and GOT for
2461         IFUNC symbols.
2462         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2463         (Output_data_plt_x86_64::rela_irelative): New function.
2464         (Output_data_plt_x86_64::address_for_global): New function.
2465         (Output_data_plt_x86_64::address_for_local): New function.
2466         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2467         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2468         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2469         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2470         parameters.
2471         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2472         reloc.
2473         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2474         symbols if we didn't create an IRELATIVE GOT.
2475         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2476         plt_address_for_local.
2477         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2478         * testsuite/ifuncvar1.c: New test file.
2479         * testsuite/ifuncvar2.c: New test file.
2480         * testsuite/ifuncvar3.c: New test file.
2481         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2482         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2483         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2484         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2485         * testsuite/Makefile.in: Rebuild.
2486
2487 2011-07-07  Cary Coutant  <ccoutant@google.com>
2488
2489         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2490         (two_file_test_1_ndebug.o): Likewise.
2491         (two_file_test_1b_ndebug.o): Likewise.
2492         (two_file_test_2_ndebug.o): Likewise.
2493         (two_file_test_main_ndebug.o): Likewise.
2494         (incremental_test_2): Link with no-debug versions.
2495
2496 2011-07-06  Cary Coutant  <ccoutant@google.com>
2497
2498         * gold/incremental.cc
2499         (Output_section_incremental_inputs::write_info_blocks): Check for
2500         hidden and internal symbols.
2501
2502 2011-07-06  Cary Coutant  <ccoutant@google.com>
2503
2504         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2505         Check disposition for startup file.
2506         (Incremental_inputs::report_command_line): Ignore
2507         --incremental-startup-unchanged option.
2508         * options.cc (General_options::parse_incremental_startup_unchanged):
2509         New function.
2510         (General_options::General_options): Initialize new data member.
2511         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2512         (General_options): Add --incremental-startup-unchanged option.
2513         (General_options::incremental_startup_disposition): New function.
2514         (General_options::incremental_startup_disposition_): New data member.
2515
2516 2011-07-06  Cary Coutant  <ccoutant@google.com>
2517
2518         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2519         input file index to Script_info ctor.
2520         (Sized_incremental_binary::do_file_has_changed): Find the
2521         command-line argument for files named in scripts.
2522         * incremental.h (Script_info::Script_info): New ctor
2523         with input file index.
2524         (Script_info::input_file_index): New function.
2525         (Script_info::input_file_index_): New data member.
2526         (Incremental_binary::get_library): Add const.
2527         (Incremental_binary::get_script_info): Add const.
2528         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2529         * testsuite/Makefile.am (incremental_test_5): New test case.
2530         (incremental_test_6): New test case.
2531         * testsuite/Makefile.in: Regenerate.
2532
2533 2011-07-06  Cary Coutant  <ccoutant@google.com>
2534
2535         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2536         debug output when command lines differ.
2537
2538 2011-07-06  Cary Coutant  <ccoutant@google.com>
2539
2540         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2541         --incremental-patch option.
2542         * layout.cc (Free_list::allocate): Extend allocation beyond original
2543         end if enabled.
2544         (Layout::make_output_section): Mark sections that should get
2545         patch space.
2546         * options.cc (parse_percent): New function.
2547         * options.h (parse_percent): New function.
2548         (DEFINE_percent): New macro.
2549         (General_options): Add --incremental-patch option.
2550         * output.cc (Output_section::Output_section): Initialize new data
2551         members.
2552         (Output_section::add_input_section): Print section name when out
2553         of patch space.
2554         (Output_section::add_output_section_data): Likewise.
2555         (Output_section::set_final_data_size): Add patch space when
2556         doing --incremental-full.
2557         (Output_section::do_reset_address_and_file_offset): Remove patch
2558         space.
2559         (Output_segment::set_section_list_addresses): Print debug output
2560         only if --incremental-update.
2561         * output.h (Output_section::set_is_patch_space_allowed): New function.
2562         (Output_section::is_patch_space_allowed_): New data member.
2563         (Output_section::patch_space_): New data member.
2564         * parameters.cc (Parameters::incremental_full): New function.
2565         * parameters.h (Parameters::incremental_full): New function
2566         * testsuite/Makefile.am (incremental_test_2): Add test for
2567         --incremental-patch option.
2568         * testsuite/Makefile.in: Regenerate.
2569         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2570         (t18): Remove function body.
2571
2572 2011-07-05  Doug Kwan  <dougkwan@google.com>
2573
2574         PR gold/12771
2575         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2576         Arm_Address type for relocation result.
2577         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2578         overflow check.
2579         (Arm_relocate_functions::abs32): Use unaligned access.
2580         (Arm_relocate_functions::rel32): Ditto.
2581         (Arm_relocate_functions::prel31): Ditto.
2582         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2583         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2584         static data relocations.
2585         * testsuite/Makefile.in: Regnerate.
2586         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2587
2588 2011-07-05  Ian Lance Taylor  <iant@google.com>
2589
2590         PR gold/12392
2591         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2592         symbols if necessary.
2593         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2594
2595 2011-07-05  Ian Lance Taylor  <iant@google.com>
2596
2597         PR gold/12952
2598         * resolve.cc (Symbol::override_base_with_special): Simply override
2599         version with special symbol version, ignoring previous version.
2600
2601 2011-07-05  Ian Lance Taylor  <iant@google.com>
2602
2603         * object.cc (Sized_relobj_file::include_section_group): Add
2604         information to comment about signature location.
2605
2606 2011-07-02  Ian Lance Taylor  <iant@google.com>
2607
2608         PR gold/12957
2609         * options.h (class General_options): Add -f and -F.
2610         * options.cc (General_options::finalize): Fatal error if -f/-F
2611         are used without -shared.
2612         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2613
2614 2011-07-02  Ian Lance Taylor  <iant@google.com>
2615
2616         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2617
2618 2011-07-01  Ian Lance Taylor  <iant@google.com>
2619
2620         PR gold/12525
2621         PR gold/12952
2622         * resolve.cc (Symbol::override_base_with_special): Don't override
2623         the version if the overriding symbol has a different name.
2624         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2625         all callers.  If we give an error about an undefined version,
2626         define the base version if necessary.
2627         * dynobj.h (class Versions): Update declaration.
2628         * testsuite/weak_alias_test_5.cc: New file.
2629         * testsuite/weak_alias_test.script: New file.
2630         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2631         and versioned_alias have the right value, and call t2.
2632         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2633         weak_alias_test_5.so.
2634         (weak_alias_test_LDADD): Likewise.
2635         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2636         * testsuite/Makefile.in: Rebuild.
2637
2638 2011-07-01  Ian Lance Taylor  <iant@google.com>
2639
2640         PR gold/12525
2641         * options.h (class General_options): Support -z notext.
2642         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2643         -Wl,-z,notext.
2644         (two_file_shared_nonpic.so): Likewise.
2645         (two_file_shared_mixed.so): Likewise.
2646         (two_file_shared_mixed_1.so): Likewise.
2647         (weak_undef_lib_nonpic.so): Likewise.
2648         (alt/weak_undef_lib_nonpic.so): Likewise.
2649         (tls_test_shared_nonpic.so): Likewise.
2650         * testsuite/Makefile.in: Rebuild.
2651
2652 2011-07-01  Ian Lance Taylor  <iant@google.com>
2653
2654         PR gold/12525
2655         * configure.ac: Test whether static linking works, setting
2656         the automake conditional HAVE_STATIC.
2657         * testsuite/Makefile.am: Disable tests using -static if
2658         HAVE_STATIC is not true.
2659         * configure, testsuite/Makefile.in: Rebuild.
2660
2661 2011-07-01  Ian Lance Taylor  <iant@google.com>
2662
2663         PR gold/12525
2664         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2665         Assert if we see DW_EH_PE_indirect.
2666         * target.h (Target::ehframe_datarel_base): New function.
2667         (Target::do_ehframe_datarel_base): New target function.
2668         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2669         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2670         function.
2671
2672 2011-07-01  Ian Lance Taylor  <iant@google.com>
2673
2674         PR gold/12571
2675         * options.h (class General_options): Add
2676         --ld-generated-unwind-info.
2677         * ehframe.cc (Fde::write): Add address parameter.  Change all
2678         callers.  If associated with PLT, fill in address and size.
2679         (Cie::set_output_offset): Only add merge mapping if there is an
2680         object.
2681         (Cie::write): Add address parameter.  Change all callers.
2682         (Eh_frame::add_ehframe_for_plt): New function.
2683         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2684         input_offset_ fields into union u_, with new plt field.
2685         (Fde::Fde): Adjust for new union field.
2686         (Fde::Fde) [Output_data version]: New constructor.
2687         (Fde::add_mapping): Only add merge mapping if there is an object.
2688         (class Cie): Update declarations.
2689         (class Eh_frame): Declare add_ehframe_for_plt.
2690         * layout.cc (Layout::layout_eh_frame): Break out code into
2691         make_eh_frame_section, and call it.
2692         (Layout::make_eh_frame_section): New function.
2693         (Layout::add_eh_frame_for_plt): New function.
2694         * layout.h (class Layout): Update declarations.
2695         * merge.cc (Merge_map::add_mapping): Add assertion.
2696         * i386.cc: Include "dwarf.h".
2697         (class Output_data_plt_i386): Make first_plt_entry,
2698         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2699         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2700         and plt_eh_frame_fde.
2701         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2702         boundary.  Call add_eh_frame_for_plt if appropriate.
2703         * x86_64.cc: Include "dwarf.h".
2704         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2705         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2706         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2707         and plt_eh_frame_fde.
2708         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2709         appropriate.
2710
2711 2011-06-29  Ian Lance Taylor  <iant@google.com>
2712
2713         PR gold/12629
2714         * object.cc (Sized_relobj_file::layout_section): Change shdr
2715         parameter to be const.
2716         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2717         out of do_layout.
2718         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2719         appropriate.  Call layout_eh_frame_section.
2720         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2721         sections.
2722         * object.h (class Sized_relobj_file): Update declarations.
2723
2724 2011-06-29  Ian Lance Taylor  <iant@google.com>
2725
2726         PR gold/12652
2727         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2728         modifier.
2729         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2730
2731 2011-06-29  Ian Lance Taylor  <iant@google.com>
2732
2733         PR gold/12675
2734         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2735         SHT_X86_64_UNWIND.
2736         * layout.cc (Layout::layout_eh_frame): Likewise.
2737
2738 2011-06-29  Ian Lance Taylor  <iant@google.com>
2739
2740         PR gold/12695
2741         * layout.cc (Layout::symtab_section_shndx): New function.
2742         * layout.h (class Layout): Declare symtab_section_shndx.
2743         * output.cc (Output_section::write_header): Call it.
2744
2745 2011-06-29  Ian Lance Taylor  <iant@google.com>
2746
2747         PR gold/12818
2748         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2749         symbols which are not used in a relocation.
2750
2751 2011-06-28  Ian Lance Taylor  <iant@google.com>
2752
2753         PR gold/12898
2754         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2755         script create indistinguishable segments.
2756         (Layout::set_segment_offsets): Use stable_sort when sorting
2757         segments.  Pass this to Compare_segments constructor.
2758         * layout.h (class Layout): Make segment_precedes non-static.
2759         (class Compare_segments): Change from struct to class.  Add
2760         layout_ field.  Add constructor.
2761         * script-sections.cc
2762         (Script_sections::attach_sections_using_phdrs_clause): Rename
2763         local orphan to is_orphan.  Don't report failure to put empty
2764         section in segment.  On attachment failure, report name of
2765         section, and attach to first PT_LOAD segment.
2766
2767 2011-06-28  Ian Lance Taylor  <iant@google.com>
2768
2769         PR gold/12934
2770         * target-select.cc (Target_selector::Target_selector): Add
2771         emulation parameter.  Change all callers.
2772         (select_target_by_bfd_name): Rename from select_target_by_name.
2773         Change all callers.
2774         (select_target_by_emulation): New function.
2775         (supported_emulation_names): New function.
2776         * target-select.h (class Target_selector): Add emulation_ field.
2777         Update declarations.
2778         (Target_selector::recognize_by_bfd_name): Rename from
2779         recognize_by_name.  Change all callers.
2780         (Target_selector::supported_bfd_names): Rename from
2781         supported_names.  Change all callers.
2782         (Target_selector::recognize_by_emulation): New function.
2783         (Target_selector::supported_emulations): New function.
2784         (Target_selector::emulation): New function.
2785         (Target_selector::do_recognize_by_bfd_name): Rename from
2786         do_recognize_by_name.  Change all callers.
2787         (Target_selector::do_supported_bfd_names): Rename from
2788         do_supported_names.  Change all callers.
2789         (Target_selector::do_recognize_by_emulation): New function.
2790         (Target_selector::do_supported_emulations): New function.
2791         (select_target_by_bfd_name): Change name in declaration.
2792         (select_target_by_emulation): Declare.
2793         (supported_emulation_names): Declare.
2794         * parameters.cc (parameters_force_valid_target): Try to find
2795         target based on emulation from -m option.
2796         * options.h (class General_options): Change doc string for -m.
2797         * options.cc (help): Print emulations.
2798         (General_options::parse_V): Likewise.
2799         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2800         Add emulation parameter.  Change all callers.
2801
2802 2011-06-28  Ian Lance Taylor  <iant@google.com>
2803
2804         * target.h (class Target): Add osabi_ field.
2805         (Target::osabi): New function.
2806         (Target::set_osabi): New function.
2807         (Target::Target): Initialize osabi_.
2808         (Target::do_adjust_elf_header): Make pure virtual.
2809         (Sized_target::do_adjust_elf_header): Declare.
2810         * target.cc (Sized_target::do_adjust_elf_header): New function.
2811         (class Sized_target): Instantiate all versions.
2812         * freebsd.h (class Target_freebsd): Remove.
2813         (Target_selector_freebsd::do_recognize): Call set_osabi on
2814         Target.
2815         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2816         (Target_selector_freebsd::set_osabi): Remove.
2817         * i386.cc (class Target_i386): Inherit from Sized_target rather
2818         than Target_freebsd.
2819         * x86_64.cc (class Target_x86_64): Likewise.
2820
2821 2011-06-28  Ian Lance Taylor  <iant@google.com>
2822
2823         * target.h (Target::can_check_for_function_pointers): Rewrite.
2824         Make non-virtual.
2825         (Target::can_icf_inline_merge_sections): Likewise.
2826         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2827         (Target::Target_info): Add can_icf_inline_merge_sections field.
2828         (Target::do_can_check_for_function_pointers): New virtual
2829         function.
2830         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2831         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2832         from can_check_for_function_pointers, move in file.
2833         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2834         section_may_have_icf_unsafe_poineters, move in file.
2835         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2836         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2837         Rename from can_check_for_function_pointers, move in file.
2838         (Target_i386::can_icf_inline_merge_sections): Remove.
2839         (Target_i386::i386_info): Initialize
2840         can_icf_inline_merge_sections.
2841         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2842         Initialize can_icf_inline_merge_sections.
2843         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2844         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2845         Rename from can_check_for_function_pointers, move in file.
2846         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2847         (Target_x86_64::x86_64_info): Initialize
2848         can_icf_inline_merge_sections.
2849         * testsuite/testfile.cc (Target_test::test_target_info):
2850         Likewise.
2851         * icf.cc (get_section_contents): Correct formatting.
2852
2853 2011-06-27  Ian Lance Taylor  <iant@google.com>
2854
2855         * symtab.cc (Symbol::versioned_name): New function.
2856         (Symbol_table::add_to_final_symtab): Use versioned_name when
2857         appropriate.
2858         (Symbol_table::sized_write_symbol): Likewise.
2859         * symtab.h (class Symbol): Declare versioned_name.
2860         * stringpool.h (class Stringpool_template): Add variant of add
2861         which takes a std::basic_string.
2862         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2863         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2864         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2865         (ver_test_12.o): New target.
2866         * testsuite/Makefile.in: Rebuild.
2867
2868 2011-06-27  Doug Kwan  <dougkwan@google.com>
2869
2870         * arm.cc (Arm_relocate_functions::thm_jump8,
2871         Arm_relocate_functions::thm_jump11): Use a wider signed
2872         type to compute offset.
2873         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2874         arm_thm_jump8.
2875         * testsuite/Makefile.in: Regenerate.
2876         * testsuite/arm_branch_in_range.sh: Check test results of
2877         arm_thm_jump11 and arm_thm_jump8.
2878         * testsuite/arm_thm_jump11.s: New test source file.
2879         * testsuite/arm_thm_jump11.t: New linker script.
2880         * testsuite/arm_thm_jump8.s: New test source file.
2881         * testsuite/arm_thm_jump8.t: New linker script.
2882
2883 2011-06-24  Ian Lance Taylor  <iant@google.com>
2884
2885         * layout.cc: Include "object.h".
2886         (ctors_sections_in_init_array): New static variable.
2887         (Layout::is_ctors_in_init_array): New function.
2888         (Layout::layout): Add entry to ctors_sections_in_init_array if
2889         appropriate.
2890         * layout.h (class Layout): Declare is_ctors_in_init_array.
2891         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2892         is_ctors_reverse_view is set.
2893         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2894         all callers.  Set is_ctors_reverse_view field of View_size.
2895         (Sized_relobj_file::reverse_words): New function.
2896         * object.h (Sized_relobj_file::View_size): Add
2897         is_ctors_reverse_view field.
2898         (class Sized_relobj_file): Update declarations.
2899         * testsuite/initpri3.c: New test.
2900         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2901         initpri3b.
2902         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2903         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2904         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2905         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2906         * testsuite/Makefile.in: Rebuild.
2907
2908 2011-06-24  Cary Coutant  <ccoutant@google.com>
2909
2910         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2911         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2912         (debug_msg_cdebug.err): New targets.
2913         * testsuite/Makefile.in: Regenerate.
2914         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2915         Fix checks for link with shared library.
2916
2917 2011-06-24  Doug Kwan  <dougkwan@google.com>
2918
2919         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2920         skip empty text sections.
2921         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2922
2923 2011-06-22  Ian Lance Taylor  <iant@google.com>
2924
2925         PR gold/12910
2926         * options.h (class General_options): Add --ctors-in-init-array.
2927         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2928         friends as SHT_PROGBITS for merging sections.
2929         (Layout::layout): Remove special handling of .init_array and
2930         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2931         and .dtors if ctors_in_init_array.
2932         (Layout::make_output_section): Force correct section types for
2933         .init_array and friends.  Don't sort if doing relocatable link,
2934         Don't sort .ctors and .dtors if ctors_in_init_array.
2935         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2936         (Layout::output_section_name): Add relobj parameter.  Change all
2937         callers.  Handle .ctors. and .dtors. in code rather than table.
2938         Handle .ctors and .dtors if ctors_in_init_array.
2939         (Layout::match_file_name): New function, moved from output.cc.
2940         * layout.h (class Layout): Update declarations.
2941         * output.cc: Include "layout.h".
2942         (Input_section_sort_entry::get_priority): New function.
2943         (Input_section_sort_entry::match_file_name): Just call
2944         Layout::match_file_name.
2945         (Output_section::Input_section_sort_init_fini_compare::operator()):
2946         Handle .ctors and .dtors.  Sort by explicit priority rather than
2947         by name.
2948         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2949         * testsuite/initpri2.c: New test.
2950         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2951         (check_PROGRAMS): Add initpri2.
2952         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2953         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2954         * configure, testsuite/Makefile.in: Rebuild.
2955
2956 2011-06-19  Ian Lance Taylor  <iant@google.com>
2957
2958         PR gold/12880
2959         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2960         .interp section to a PT_INTERP segment even if we have seen a
2961         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2962         clause in a linker script.
2963         (Layout::finalize): Don't create a .interp section if we've
2964         already create a PT_INTERP segment.
2965         (Layout::create_interp): Always call choose_output_section (revert
2966         patch of 2011-06-17).  Don't create PT_INTERP segment.
2967         * script-sections.cc
2968         (Script_sections::create_note_and_tls_segments): Add a .interp
2969         section to a PT_INTERP segment even if we have seen a
2970         --dynamic-linker option.
2971
2972 2011-06-18  Ian Lance Taylor  <iant@google.com>
2973
2974         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2975         merely because a non-PT_LOAD segment has a dynamic reloc.
2976
2977 2011-06-18  Ian Lance Taylor  <iant@google.com>
2978
2979         * layout.cc (Layout::finish_dynamic_section): Don't create
2980         DT_FLAGS entry if not needed.
2981
2982 2011-06-18  Ian Lance Taylor  <iant@google.com>
2983
2984         PR gold/12745
2985         * layout.cc (Layout::layout_eh_frame): Correct handling of
2986         writable .eh_frame section.
2987
2988 2011-06-17  Ian Lance Taylor  <iant@google.com>
2989
2990         PR gold/12893
2991         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2992         symbol is redefined with the exact same object and value.
2993
2994 2011-06-17  Ian Lance Taylor  <iant@google.com>
2995
2996         PR gold/12880
2997         * layout.h (class Layout): Add interp_segment_ field.
2998         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2999         (Layout::attach_allocated_section_to_segment): If making shared
3000         library, put .interp section in PT_INTERP segment.
3001         (Layout::finalize): Also call create_interp if -dynamic-linker
3002         option was used.
3003         (Layout::create_interp): Assert that there is no PT_INTERP
3004         segment.  If not using a SECTIONS clause, use make_output_section.
3005         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3006         * script-sections.cc
3007         (Script_sections::create_note_and_tls_segments): If making shared
3008         library, put .interp section in PT_INTERP segment.
3009
3010 2011-06-17  Ian Lance Taylor  <iant@google.com>
3011
3012         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3013         when making a shared library.
3014
3015 2011-06-17  Ian Lance Taylor  <iant@google.com>
3016
3017         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3018         parameter.  Change all callers.  Don't issue warning about PC32
3019         against locally defined symbol.
3020
3021 2011-06-16  Ian Lance Taylor  <iant@google.com>
3022
3023         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3024         occurs in same object.
3025
3026 2011-06-14  Alan Modra  <amodra@gmail.com>
3027
3028         * po/POTFILES.in: Regenerate.
3029
3030 2011-06-09  Ian Lance Taylor  <iant@google.com>
3031
3032         * script-sections.cc
3033         (Orphan_output_section::set_section_addresses): For a relocatable
3034         link set address to 0.
3035
3036 2011-06-09  Cary Coutant  <ccoutant@google.com>
3037
3038         PR gold/12804
3039         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3040         used with --compress-debug-sections.
3041         * gold/object.cc (Sized_relobj_file::do_layout): Report
3042         uncompressed size of compressed input sections.
3043
3044 2011-06-08  Cary Coutant  <ccoutant@google.com>
3045
3046         PR gold/12804
3047         * testsuite/two_file_test_2_v1.cc: Change initialization of
3048         v2 to keep it in .data.
3049
3050 2011-06-07  Cary Coutant  <ccoutant@google.com>
3051
3052         * common.cc (Symbol_table::do_allocate_commons_list): Call
3053         gold_fallback.
3054         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3055         (Errors::fallback): New function.
3056         (gold_fallback): New function.
3057         * errors.h (Errors::fallback): New function.
3058         * gold.cc (gold_exit): Change status parameter to enum; adjust
3059         all callers.
3060         (queue_initial_tasks): Call gold_fallback.
3061         * gold.h: Include cstdlib.
3062         (Exit_status): New enum type.
3063         (gold_exit): Change status parameter to enum.
3064         (gold_fallback): New function.
3065         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3066         (Layout::create_symtab_sections): Likewise.
3067         (Layout::create_shdrs): Likewise.
3068         * main.cc (main): Adjust call to gold_exit.
3069         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3070         (Output_data_got::add_got_entry_pair): Likewise.
3071         (Output_section::add_input_section): Likewise.
3072         (Output_section::add_output_section_data): Likewise.
3073         (Output_segment::set_section_list_addresses): Likewise.
3074         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3075
3076 2011-06-07  Cary Coutant  <ccoutant@google.com>
3077
3078         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3079         for incremental links.
3080         * output.cc (Output_segment::set_section_list_addresses): Remove
3081         FIXME and test for TLS or BSS.
3082
3083 2011-06-07  Cary Coutant  <ccoutant@google.com>
3084
3085         * testsuite/Makefile.am: Add incremental_copy_test,
3086         incremental_common_test_1.
3087         * testsuite/Makefile.in: Regenerate.
3088         * testsuite/common_test_1_v1.c: New source file.
3089         * testsuite/common_test_1_v2.c: New source file.
3090         * testsuite/copy_test_v1.cc: New source file.
3091
3092 2011-06-07  Cary Coutant  <ccoutant@google.com>
3093
3094         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3095         update, allocate common from bss section's free list.
3096         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3097         linker-defined symbols.
3098         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3099         Skip GOT and PLT entries that are no longer referenced.
3100         (Output_section_incremental_inputs::write_info_blocks): Mark
3101         linker-defined symbols.
3102         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3103         * output.cc (Output_section::allocate): New function.
3104         * output.h (Output_section::allocate): New function.
3105         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3106         linker-defined symbols.
3107         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3108         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3109         (Symbol::init_base_output_data): Likewise.
3110         (Symbol::init_base_output_segment): Likewise.
3111         (Symbol::init_base_constant): Likewise.
3112         (Sized_symbol::init_output_data): Likewise.
3113         (Sized_symbol::init_output_segment): Likewise.
3114         (Sized_symbol::init_constant): Likewise.
3115         (Symbol_table::do_define_in_output_data): Likewise.
3116         (Symbol_table::do_define_in_output_segment): Likewise.
3117         (Symbol_table::do_define_as_constant): Likewise.
3118         * symtab.h (Symbol::is_predefined): New function.
3119         (Symbol::init_base_output_data): Add is_predefined parameter.
3120         (Symbol::init_base_output_segment): Likewise.
3121         (Symbol::init_base_constant): Likewise.
3122         (Symbol::is_predefined_): New data member.
3123         (Sized_symbol::init_output_data): Add is_predefined parameter.
3124         (Sized_symbol::init_output_segment): Likewise.
3125         (Sized_symbol::init_constant): Likewise.
3126         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3127
3128 2011-06-07  Cary Coutant  <ccoutant@google.com>
3129
3130         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3131         instead of emit_copy_reloc.
3132         (Copy_relocs::emit_copy_reloc): Refactor.
3133         (Copy_relocs::make_copy_reloc): New function.
3134         (Copy_relocs::add_copy_reloc): Remove.
3135         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3136         section.
3137         (Copy_relocs::make_copy_reloc): New function.
3138         (Copy_relocs::add_copy_reloc): Remove.
3139         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3140         unchanged input files.
3141         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3142         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3143         Reserve BSS space for COPY relocations.
3144         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3145         (Output_section_incremental_inputs::write_info_blocks): Record
3146         whether a symbol is copied from a shared object.
3147         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3148         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3149         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3150         (Incremental_input_entry_reader::get_output_symbol_index): Add
3151         is_copy parameter.
3152         (Incremental_binary::emit_copy_relocs): New function.
3153         (Incremental_binary::do_emit_copy_relocs): New function.
3154         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3155         new data member.
3156         (Sized_incremental_binary::add_copy_reloc): New function.
3157         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3158         (Sized_incremental_binary::Copy_reloc): New struct.
3159         (Sized_incremental_binary::Copy_relocs): New typedef.
3160         (Sized_incremental_binary::copy_relocs_): New data member.
3161         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3162         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3163         * target.h (Sized_target::emit_copy_reloc): New function.
3164         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3165
3166 2011-06-02  Cary Coutant  <ccoutant@google.com>
3167
3168         PR gold/12163
3169         * gold/archive.cc (Archive::Archive): Initialize new data member.
3170         (Archive::include_all_members): Return if archive has already been
3171         included.
3172         * gold/archive.h (Archive::include_all_members_): New data member.
3173
3174 2011-06-02  Nick Clifton  <nickc@redhat.com>
3175
3176         * dynobj.h: Fix spelling mistake in comment.
3177         * output.cc: Likewise.
3178
3179 2011-05-31  Doug Kwan  <dougkwan@google.com>
3180             Asier Llano
3181
3182         PR gold/12826
3183         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3184         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3185         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3186         redundant arm_exidx_test.so.
3187         * testsuite/Makefile.in: Regenerate.
3188         (check_SCRIPTS): Add pr12826.sh
3189         (check_DATA): Add pr12826.stdout
3190         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3191         * testsuite/pr12826.sh: New file.
3192         * testsuite/pr12826_1.s: Ditto.
3193         * testsuite/pr12826_1.s: Ditto.
3194
3195 2011-05-30  Ian Lance Taylor  <iant@google.com>
3196
3197         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3198         sections.
3199
3200 2011-05-29  Ian Lance Taylor  <iant@google.com>
3201
3202         PR gold/12804
3203         * testsuite/Makefile.am: Use different file name for two_file_test
3204         temporary file for each incremental test.
3205         * testsuite/Makefile.in: Rebuild.
3206
3207 2011-05-29  Ian Lance Taylor  <iant@google.com>
3208
3209         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3210         binary input file is empty.
3211
3212 2011-05-27  Ian Lance Taylor  <iant@google.com>
3213
3214         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3215         (ver_test_9.so): Likewise.
3216         * testsuite/Makefile.in: Rebuild.
3217
3218 2011-05-26 Cary Coutant  <ccoutant@google.com>
3219
3220         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3221         * incremental.cc (Incremental_inputs::report_input_section): Fix
3222         comment, indentation.
3223         (Incremental_inputs::report_comdat_group): New function.
3224         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3225         of data for incremental input file entry.
3226         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3227         group count, COMDAT group signatures.
3228         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3229         an unchanged input file.
3230         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3231         Initialize new data member.
3232         (Incremental_object_entry::add_comdat_group): New function.
3233         (Incremental_object_entry::get_comdat_group_count): New function.
3234         (Incremental_object_entry::get_comdat_signature_key): New function.
3235         (Incremental_object_entry::groups_): New data member.
3236         (Incremental_inputs::report_comdat_group): New function.
3237         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3238         data for incremental input file entry.
3239         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3240         (Incremental_input_entry_reader::get_input_section): Adjust size of
3241         data for incremental input file entry.
3242         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3243         (Incremental_input_entry_reader::get_comdat_group_signature): New
3244         function.
3245         * object.cc (Sized_relobj::include_section_group): Report kept
3246         COMDAT groups for incremental links.
3247
3248 2011-05-24  David Meyer  <pdox@google.com>
3249
3250         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3251         with name parameter.  Add found_name parameter.
3252         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3253         * dirsearch.h (class Dirsearch): Update declaration.
3254
3255 2011-05-24  Ian Lance Taylor  <iant@google.com>
3256
3257         * archive.cc (Library_base::should_include_member): Pull in object
3258         from archive if it defines the entry symbol.
3259         * parameters.cc (Parameters::entry): New function.
3260         * parameters.h (class Parameters): Declare entry.
3261         * output.h (class Output_file_header): Remove entry_ field.
3262         * output.cc (Output_file_header::Output_file_header): Remove entry
3263         parameter.  Change all callers.
3264         (Output_file_header::entry): Use parameters->entry.
3265         * gold.cc (queue_middle_tasks): Likewise.
3266         * plugin.cc (Plugin_hook::run): Likewise.
3267
3268 2011-05-24 Cary Coutant  <ccoutant@google.com>
3269
3270         * gold.cc (queue_initial_tasks): Pass incremental base filename
3271         to Output_file::open_base_file; don't print error message.
3272         * incremental-dump.cc (main): Adjust call to
3273         Output_file::open_for_modification.
3274         * incremental-dump.cc (main): Likewise.
3275         * incremental.cc (Incremental_inputs::report_command_line):
3276         Ignore --incremental-base option when comparing command lines.
3277         Ignore parameter when given as separate argument.
3278         * options.h (class General_options): Add --incremental-base.
3279         * output.cc (Output_file::Output_file):
3280         (Output_file::open_base_file): Add base_name and writable parameters;
3281         read base file into new file; print error message here.
3282         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3283         callers.
3284         * output.h (Output_file::open_for_modification): Rename to...
3285         (Output_file::open_base_file): ...this; add base_name and
3286         writable parameters; adjust all callers.
3287         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3288         callers.
3289         * testsuite/Makefile.am (incremental_test_4): Test
3290         --incremental-base.
3291         * testsuite/Makefile.in: Regenerate.
3292
3293 2011-05-24 Cary Coutant  <ccoutant@google.com>
3294
3295         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3296         incremental_test_4.
3297         * testsuite/Makefile.in: Regenerate.
3298         * testsuite/two_file_test_1_v1.cc: New test source file.
3299         * testsuite/two_file_test_1b_v1.cc: New test source file.
3300         * testsuite/two_file_test_2_v1.cc: New test source file.
3301
3302 2011-05-24 Cary Coutant  <ccoutant@google.com>
3303
3304         * dynobj.h (Dynobj::do_dynobj): New function.
3305         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3306         flag and soname for shared objects.
3307         * incremental.cc (Incremental_inputs::report_object): Make
3308         either Incremental_object_entry or Incremental_dynobj_entry; add
3309         soname to string table.
3310         (Incremental_inputs::report_input_section): Add assertion.
3311         (Output_section_incremental_inputs::set_final_data_size): Adjust
3312         type of input file entry for shared libraries; adjust size of
3313         shared library info entry.
3314         (Output_section_incremental_inputs::write_input_files): Write
3315         as_needed flag for shared libraries.
3316         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3317         of input file entry for shared libraries; write soname.
3318         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3319         soname from incremental info.
3320         * incremental.h (enum Incremental_input_flags): Add
3321         INCREMENTAL_INPUT_AS_NEEDED.
3322         (Incremental_input_entry::Incremental_input_entry): Initialize new
3323         data member.
3324         (Incremental_input_entry::set_as_needed): New function.
3325         (Incremental_input_entry::as_needed): New function.
3326         (Incremental_input_entry::do_dynobj_entry): New function.
3327         (Incremental_input_entry::as_needed_): New data member.
3328         (Incremental_object_entry::Incremental_object_entry): Don't check
3329         for shared library.
3330         (Incremental_object_entry::do_type): Likewise.
3331         (class Incremental_dynobj_entry): New class.
3332         (Incremental_input_entry_reader::as_needed): New function.
3333         (Incremental_input_entry_reader::get_soname): New function.
3334         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3335         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3336         size of shared library info entry.
3337         * layout.cc (Layout::finish_dynamic_section): Don't test for
3338         incremental link when adding DT_NEEDED entries.
3339         * object.h (Object::Object): Initialize new data member.
3340         (Object::dynobj): New function.
3341         (Object::set_as_needed): New function.
3342         (Object::as_needed): New function.
3343         (Object::do_dynobj): New function.
3344         (Object::as_needed_): New data member.
3345
3346 2011-05-24 Cary Coutant  <ccoutant@google.com>
3347
3348         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3349         info; adjust display of GOT entries.
3350         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3351         vector of input objects; remove file_status_.
3352         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3353         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3354         got_plt reader; call target hooks to reserve GOT entries.
3355         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3356         of input file info header and GOT info entry.
3357         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3358         relocation info.
3359         (Got_plt_view_info::got_descriptor): Remove.
3360         (Got_plt_view_info::sym_index): New data member.
3361         (Got_plt_view_info::input_index): New data member.
3362         (Local_got_offset_visitor::visit): Write input file index.
3363         (Global_got_offset_visitor::visit): Write 0 for input file index.
3364         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3365         with sym_index and input_index.
3366         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3367         incremental info GOT entry; replace got_descriptor with input_index.
3368         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3369         map from input file index to object.
3370         (Sized_relobj_incr::do_layout): Replace direct data member reference
3371         with accessor function.
3372         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3373         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3374         Adjust size of input file info header.
3375         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3376         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3377         (Incremental_input_entry_reader::get_input_section): Adjust size of
3378         input file info header.
3379         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3380         of incremental info GOT entry.
3381         (Incremental_got_plt_reader::get_got_desc): Remove.
3382         (Incremental_got_plt_reader::get_got_symndx): New function.
3383         (Incremental_got_plt_reader::get_got_input_index): New function.
3384         (Sized_incremental_binary::Sized_incremental_binary): Remove
3385         file_status_; add input_objects_.
3386         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3387         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3388         (Sized_incremental_binary::file_is_unchanged): Remove.
3389         (Sized_incremental_binary::set_input_object): New function.
3390         (Sized_incremental_binary::input_object): New function.
3391         (Sized_incremental_binary::file_status_): Remove.
3392         (Sized_incremental_binary::input_objects_): New data member.
3393         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3394         references.
3395         (Sized_relobj_incr::invalid_address): Move to base class.
3396         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3397         class.
3398         (Sized_relobj_incr::do_output_section_offset): Likewise.
3399         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3400         (Sized_relobj_incr::section_offsets_): Likewise.
3401         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3402         function.
3403         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3404         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3405         with accessor function.
3406         (Sized_relobj_file::do_layout): Likewise.
3407         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3408         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3409         (Sized_relobj_file::compute_final_local_value): Replace refs to
3410         section_offsets_ with accessor function.
3411         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3412         * object.h (Relobj::Relobj): Initialize new data members.
3413         (Relobj::add_dyn_reloc): New function.
3414         (Relobj::first_dyn_reloc): New function.
3415         (Relobj::dyn_reloc_count): New function.
3416         (Relobj::first_dyn_reloc_): New data member.
3417         (Relobj::dyn_reloc_count_): New data member.
3418         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3419         references.
3420         (Sized_relobj::Address): New typedef.
3421         (Sized_relobj::invalid_address): Move here from child class.
3422         (Sized_relobj::Sized_relobj): Initialize new data members.
3423         (Sized_relobj::sized_relobj): New function.
3424         (Sized_relobj::is_output_section_offset_invalid): Move here from
3425         child class.
3426         (Sized_relobj::get_output_section_offset): Likewise.
3427         (Sized_relobj::local_has_got_offset): Likewise.
3428         (Sized_relobj::local_got_offset): Likewise.
3429         (Sized_relobj::set_local_got_offset): Likewise.
3430         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3431         (Sized_relobj::clear_got_offsets): New function.
3432         (Sized_relobj::section_offsets): Move here from child class.
3433         (Sized_relobj::do_output_section_offset): Likewise.
3434         (Sized_relobj::do_set_section_offset): Likewise.
3435         (Sized_relobj::Local_got_offsets): Likewise.
3436         (Sized_relobj::local_got_offsets_): Likewise.
3437         (Sized_relobj::section_offsets_): Likewise.
3438         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3439         references.
3440         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3441         class.
3442         (Sized_relobj_file::sized_relobj): New function
3443         (Sized_relobj_file::local_has_got_offset): Move to base class.
3444         (Sized_relobj_file::local_got_offset): Likewise.
3445         (Sized_relobj_file::set_local_got_offset): Likewise.
3446         (Sized_relobj_file::get_output_section_offset): Likewise.
3447         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3448         (Sized_relobj_file::do_output_section_offset): Likewise.
3449         (Sized_relobj_file::do_set_section_offset): Likewise.
3450         (Sized_relobj_file::Local_got_offsets): Likewise.
3451         (Sized_relobj_file::local_got_offsets_): Likewise.
3452         (Sized_relobj_file::section_offsets_): Likewise.
3453         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3454         (all constructors).
3455         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3456         (Output_reloc::get_symbol_index): Likewise.
3457         (Output_reloc::local_section_offset): Likewise.
3458         (Output_reloc::get_address): Likewise.
3459         (Output_reloc::symbol_value): Likewise.
3460         (Output_data_got::reserve_slot): Move to class definition.
3461         (Output_data_got::reserve_local): New function.
3462         (Output_data_got::reserve_slot_for_global): Remove.
3463         (Output_data_got::reserve_global): New function.
3464         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3465         (all constructors, two instantiations).
3466         (Output_reloc::get_relobj): New function (two instantiations).
3467         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3468         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3469         (Output_data_reloc::add_global): Adjust type of relobj.
3470         (Output_data_reloc::add_global_relative): Likewise.
3471         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3472         (Output_data_reloc::add_local): Likewise.
3473         (Output_data_reloc::add_local_relative): Likewise.
3474         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3475         (Output_data_reloc::add_local_section): Likewise.
3476         (Output_data_reloc::add_output_section): Likewise.
3477         (Output_data_reloc::add_absolute): Likewise.
3478         (Output_data_reloc::add_target_specific): Likewise.
3479         (Output_data_got::reserve_slot): Move definition here.
3480         (Output_data_got::reserve_local): New function.
3481         (Output_data_got::reserve_global): New function.
3482         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3483         section_offsets_ with accessor function.
3484         (Sized_relobj_file::write_sections): Likewise.
3485         (Sized_relobj_file::do_relocate_sections): Likewise.
3486         * target.h (Sized_target::reserve_local_got_entry): New function.
3487         (Sized_target::reserve_global_got_entry): New function.
3488         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3489         (Target_x86_64::reserve_global_got_entry): New function.
3490         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3491
3492 2011-05-23 Cary Coutant  <ccoutant@google.com>
3493
3494         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3495         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3496         bit when checking got_type.
3497         * incremental.cc (Sized_incremental_binary::setup_readers):
3498         Store symbol table and string table locations; initialize bit vector
3499         of file status flags.
3500         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3501         unchanged files.
3502         (Sized_incremental_binary::do_process_got_plt): New function.
3503         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3504         (Output_section_incremental_inputs::set_final_data_size): Record
3505         file index for each input file.
3506         (Output_section_incremental_inputs::write_got_plt): Store file index
3507         instead of input entry offset for each GOT entry.
3508         * incremental.h
3509         (Incremental_input_entry::Incremental_input_entry): Initialize new
3510         data member.
3511         (Incremental_input_entry::set_offset): Store file index.
3512         (Incremental_input_entry::get_file_index): New function.
3513         (Incremental_input_entry::file_index_): New data member.
3514         (Incremental_binary::process_got_plt): New function.
3515         (Incremental_binary::do_process_got_plt): New function.
3516         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3517         data members.
3518         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3519         (Sized_incremental_binary::set_file_is_unchanged): New function.
3520         (Sized_incremental_binary::file_is_unchanged): New function.
3521         (Sized_incremental_binary::do_process_got_plt): New function.
3522         (Sized_incremental_binary::file_status_): New data member.
3523         (Sized_incremental_binary::main_symtab_loc_): New data member.
3524         (Sized_incremental_binary::main_strtab_loc_): New data member.
3525         * output.cc (Output_data_got::Got_entry::write): Add case
3526         RESERVED_CODE.
3527         (Output_data_got::add_global): Call add_got_entry.
3528         (Output_data_got::add_global_plt): Likewise.
3529         (Output_data_got::add_global_with_rel): Likewise.
3530         (Output_data_got::add_global_with_rela): Likewise.
3531         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3532         (Output_data_got::add_global_pair_with_rela): Likewise.
3533         (Output_data_got::add_local): Call add_got_entry.
3534         (Output_data_got::add_local_plt): Likewise.
3535         (Output_data_got::add_local_with_rel): Likewise.
3536         (Output_data_got::add_local_with_rela): Likewise.
3537         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3538         (Output_data_got::add_local_pair_with_rela): Likewise.
3539         (Output_data_got::reserve_slot): New function.
3540         (Output_data_got::reserve_slot_for_global): New function.
3541         (Output_data_got::add_got_entry): New function.
3542         (Output_data_got::add_got_entry_pair): New function.
3543         (Output_section::add_output_section_data): Edit FIXME.
3544         * output.h
3545         (Output_section_data_build::Output_section_data_build): New
3546         constructor with size parameter.
3547         (Output_data_space::Output_data_space): Likewise.
3548         (Output_data_got::Output_data_got): Initialize new data member; new
3549         constructor with size parameter.
3550         (Output_data_got::add_constant): Call add_got_entry.
3551         (Output_data_got::reserve_slot): New function.
3552         (Output_data_got::reserve_slot_for_global): New function.
3553         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3554         (Output_data_got::add_got_entry): New function.
3555         (Output_data_got::add_got_entry_pair): New function.
3556         (Output_data_got::free_list_): New data member.
3557         * target.h (Sized_target::init_got_plt_for_update): New function.
3558         (Sized_target::register_global_plt_entry): New function.
3559         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3560         Initialize new data member; call init; add constructor with PLT count.
3561         (Output_data_plt_x86_64::init): New function.
3562         (Output_data_plt_x86_64::add_relocation): New function.
3563         (Output_data_plt_x86_64::reserve_slot): New function.
3564         (Output_data_plt_x86_64::free_list_): New data member.
3565         (Target_x86_64::init_got_plt_for_update): New function.
3566         (Target_x86_64::register_global_plt_entry): New function.
3567         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3568         incremental updates.
3569         (Output_data_plt_x86_64::add_relocation): New function.
3570         * testsuite/object_unittest.cc (Object_test): Set default options.
3571
3572 2011-05-16  Ian Lance Taylor  <iant@google.com>
3573
3574         * options.h (class General_options): Make -i a synonym for -r.
3575
3576 2011-05-16  Ian Lance Taylor  <iant@google.com>
3577
3578         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3579
3580 2011-05-10 Cary Coutant  <ccoutant@google.com>
3581
3582         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3583         strip_all (-s).
3584
3585 2011-05-06  Ian Lance Taylor  <iant@google.com>
3586
3587         * layout.cc (Layout::layout): If the output section flags change,
3588         update the ordering.
3589
3590 2011-04-25 Cary Coutant  <ccoutant@google.com>
3591
3592         * incremental-dump.cc (dump_incremental_inputs): Print local
3593         symbol info for each input file.
3594         * incremental.cc
3595         (Output_section_incremental_inputs::set_final_data_size): Add local
3596         symbol info to input file entries in incremental info.
3597         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3598         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3599         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3600         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3601         implementation.
3602         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3603         (Sized_incr_relobj::do_relocate): Write the local symbols.
3604         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3605         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3606         Adjust size of input file header.
3607         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3608         (Incremental_inputs_reader::get_local_symbol_count): New function.
3609         (Incremental_inputs_reader::get_input_section): Adjust size of input
3610         file header.
3611         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3612         (Sized_incr_relobj::This): New typedef.
3613         (Sized_incr_relobj::sym_size): New const data member.
3614         (Sized_incr_relobj::Local_symbol): New struct.
3615         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3616         (Sized_incr_relobj::do_local_symbol_offset): New function.
3617         (Sized_incr_relobj::local_symbol_count_): New data member.
3618         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3619         (Sized_incr_relobj::local_symbol_index_): New data member.
3620         (Sized_incr_relobj::local_symbol_offset_): New data member.
3621         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3622         (Sized_incr_relobj::local_symbols_): New data member.
3623         * object.h (Relobj::output_local_symbol_count): New function.
3624         (Relobj::local_symbol_offset): New function.
3625         (Relobj::do_output_local_symbol_count): New function.
3626         (Relobj::do_local_symbol_offset): New function.
3627         (Sized_relobj::do_output_local_symbol_count): New function.
3628         (Sized_relobj::do_local_symbol_offset): New function.
3629
3630 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3631
3632         * descriptors.cc (set_close_on_exec): New function.
3633         (Descriptors::open): Use set_close_on_exec.
3634         * output.cc (S_ISLNK): Define if not defined.
3635
3636 2011-04-22 Cary Coutant  <ccoutant@google.com>
3637
3638         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3639         global symbol map.
3640         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3641         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3642         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3643         relocations.
3644         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3645         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3646         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3647         * incremental.h
3648         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3649         function.
3650         (Incremental_binary::apply_incremental_relocs): New function.
3651         (Incremental_binary::do_apply_incremental_relocs): New function.
3652         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3653         data member.
3654         (Sized_incremental_binary::add_global_symbol): New function.
3655         (Sized_incremental_binary::global_symbol): New function.
3656         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3657         (Sized_incremental_binary::symbol_map_): New data member.
3658         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3659         * target.h (Sized_target::apply_relocation): New function.
3660         * target-reloc.h (apply_relocation): New function.
3661         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3662
3663 2011-04-22  Doug Kwan  <dougkwan@google.com>
3664
3665         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3666         flag of a SHT_ARM_EXIDX section.
3667         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3668         * testsuite/Makefile.in: Regenerate.
3669         * testsuite/arm_exidx_test.s: New file.
3670         * testsuite/arm_exidx_test.sh: Same.
3671
3672 2011-04-20 Cary Coutant  <ccoutant@google.com>
3673
3674         PR gold/12689
3675         * archive.h (Incremental_archive_entry::Archive_member):
3676         Initialize arg_serial_ (second constructor).
3677
3678 2011-04-17  Ian Lance Taylor  <iant@google.com>
3679
3680         * object.cc (Relocate_info::location): Simplify location string.
3681         * errors.cc (Errors::error_at_location): Don't print program
3682         name.
3683         (Errors::warning_at_location): Likewise.
3684         (Errors::undefined_symbol): Likewise.
3685         * testsuite/debug_msg.sh: Update accordingly.
3686
3687 2011-04-14 Cary Coutant  <ccoutant@google.com>
3688
3689         * gold/layout.cc (Layout::symtab_section_offset): New function.
3690         * gold/layout.h (Layout::symtab_section_offset): New function.
3691         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3692
3693 2011-04-12  Ian Lance Taylor  <iant@google.com>
3694
3695         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3696         with MREMAP_MAYMOVE.
3697         * output.h (class Output_file): Add map_is_allocated_ field.
3698         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3699         not available, provide stubs.  If mremap is not available, #define
3700         it to gold_mremap.
3701         (MREMAP_MAYMOVE): Define if not defined.
3702         (Output_file::Output_file): Initialize map_is_allocated_.
3703         (Output_file::resize): Check map_is_allocated_.
3704         (Output_file::map_anonymous): If mmap fails, use malloc.
3705         (Output_file::unmap): Don't do anything for an anonymous map.
3706         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3707         is not available, provide stubs.
3708         (File_read::View::~View): Use free rather than delete[].
3709         (File_read::make_view): Use malloc rather than new[].  If mmap
3710         fails, use malloc.
3711         (File_read::find_or_make_view): Use malloc rather than new[].
3712         * gold.h: Remove HAVE_REMAP code.
3713         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3714         exists.  Rename mremap to gold_mremap.  If mmap is not available
3715         don't do anything.
3716         * configure, config.in: Rebuild.
3717
3718 2011-04-11  Ian Lance Taylor  <iant@google.com>
3719
3720         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3721         initialize local variable v.
3722
3723 2011-04-11  Cary Coutant  <ccoutant@google.com>
3724
3725         * archive.cc (Archive::include_member): Adjust call to
3726         report_object.
3727         (Add_archive_symbols::run): Track argument serial numbers.
3728         (Lib_group::include_member): Likewise.
3729         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3730         * archive.h (Incremental_archive_entry::Archive_member):
3731         Initialize arg_serial_.
3732         (Archive_member::arg_serial_): New data member.
3733         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3734         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3735         incremental link.
3736         (Sized_dynobj::do_for_all_local_got_entries): New function.
3737         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3738         function.
3739         * fileread.cc (get_mtime): New function.
3740         * fileread.h (get_mtime): New function.
3741         * gold.cc (queue_initial_tasks): Check for incremental update.
3742         (process_incremental_input): New function.
3743         (queue_middle_tasks): Don't force valid target for incremental
3744         update.
3745         * incremental-dump.cc (find_input_containing_global): Adjust
3746         size of symbol info entry.
3747         (dump_incremental_inputs): Dump argument serial number and
3748         in_system_directory flag; bias shndx by 1; print symbol names
3749         when dumping per-file symbol lists; use new symbol info readers.
3750         * incremental.cc
3751         (Output_section_incremental_inputs:update_data_size): New function.
3752         (Sized_incremental_binary::setup_readers): Setup input readers
3753         for each input file; build maps for files added from libraries
3754         and scripts.
3755         (Sized_incremental_binary::check_input_args): New function.
3756         (Sized_incremental_binary::do_check_inputs): Build map of argument
3757         serial numbers to input arguments.
3758         (Sized_incremental_binary::do_file_has_changed): Rename
3759         do_file_is_unchanged to this; compare file modification times.
3760         (Sized_incremental_binary::do_init_layout): New function.
3761         (Sized_incremental_binary::do_reserve_layout): New function.
3762         (Sized_incremental_binary::do_get_input_reader): Remove.
3763         (Sized_incremental_binary::get_symtab_view): New function.
3764         (Incremental_checker::can_incrementally_link_output_file): Remove.
3765         (Incremental_inputs::report_command_line): Exclude --debug options.
3766         (Incremental_inputs::report_archive_begin): Add parameter; track
3767         argument serial numbers; don't put input file entry for archive
3768         before archive members.
3769         (Incremental_inputs::report_archive_end): Put input file entry
3770         for archive after archive members.
3771         (Incremental_inputs::report_object): Add parameter; track argument
3772         serial numbers and in_system_directory flag.
3773         (Incremental_inputs::report_script): Add parameter; track argument
3774         serial numbers.
3775         (Output_section_incremental_inputs::set_final_data_size): Adjust
3776         size of symbol info entry; check for forwarding symbols.
3777         (Output_section_incremental_inputs::write_input_files): Write
3778         in_system_directory flag and argument serial number.
3779         (Output_section_incremental_inputs::write_info_blocks): Map section
3780         indices between incremental info and original input file; store
3781         input section index for each symbol.
3782         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3783         change operator() to visit().
3784         (class Global_got_offset_visitor): Likewise.
3785         (class Global_symbol_visitor_got_plt):
3786         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3787         classes.
3788         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3789         (Sized_incr_relobj::do_read_symbols): New function.
3790         (Sized_incr_relobj::do_layout): New function.
3791         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3792         (Sized_incr_relobj::do_add_symbols): New function.
3793         (Sized_incr_relobj::do_should_include_member): New function.
3794         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3795         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3796         (Sized_incr_relobj::do_section_size): New function.
3797         (Sized_incr_relobj::do_section_name): New function.
3798         (Sized_incr_relobj::do_section_contents): New function.
3799         (Sized_incr_relobj::do_section_flags): New function.
3800         (Sized_incr_relobj::do_section_entsize): New function.
3801         (Sized_incr_relobj::do_section_address): New function.
3802         (Sized_incr_relobj::do_section_type): New function.
3803         (Sized_incr_relobj::do_section_link): New function.
3804         (Sized_incr_relobj::do_section_info): New function.
3805         (Sized_incr_relobj::do_section_addralign): New function.
3806         (Sized_incr_relobj::do_initialize_xindex): New function.
3807         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3808         (Sized_incr_relobj::do_read_relocs): New function.
3809         (Sized_incr_relobj::do_gc_process_relocs): New function.
3810         (Sized_incr_relobj::do_scan_relocs): New function.
3811         (Sized_incr_relobj::do_count_local_symbols): New function.
3812         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3813         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3814         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3815         (Sized_incr_relobj::do_relocate): New function.
3816         (Sized_incr_relobj::do_set_section_offset): New function.
3817         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3818         (Sized_incr_dynobj::do_read_symbols): New function.
3819         (Sized_incr_dynobj::do_layout): New function.
3820         (Sized_incr_dynobj::do_add_symbols): New function.
3821         (Sized_incr_dynobj::do_should_include_member): New function.
3822         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3823         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3824         (Sized_incr_dynobj::do_section_size): New function.
3825         (Sized_incr_dynobj::do_section_name): New function.
3826         (Sized_incr_dynobj::do_section_contents): New function.
3827         (Sized_incr_dynobj::do_section_flags): New function.
3828         (Sized_incr_dynobj::do_section_entsize): New function.
3829         (Sized_incr_dynobj::do_section_address): New function.
3830         (Sized_incr_dynobj::do_section_type): New function.
3831         (Sized_incr_dynobj::do_section_link): New function.
3832         (Sized_incr_dynobj::do_section_info): New function.
3833         (Sized_incr_dynobj::do_section_addralign): New function.
3834         (Sized_incr_dynobj::do_initialize_xindex): New function.
3835         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3836         (make_sized_incremental_object): New function.
3837         (Incremental_library::copy_unused_symbols): New function.
3838         (Incremental_library::do_for_all_unused_symbols): New function.
3839         * incremental.h (enum Incremental_input_flags): New type.
3840         (class Incremental_checker): Remove.
3841         (Incremental_input_entry::Incremental_input_entry): Add argument
3842         serial number.
3843         (Incremental_input_entry::arg_serial): New function.
3844         (Incremental_input_entry::set_is_in_system_directory): New function.
3845         (Incremental_input_entry::is_in_system_directory): New function.
3846         (Incremental_input_entry::arg_serial_): New data member.
3847         (Incremental_input_entry::is_in_system_directory_): New data member.
3848         (class Script_info): Move here from script.h.
3849         (Script_info::Script_info): Add filename parameter.
3850         (Script_info::filename): New function.
3851         (Script_info::filename_): New data member.
3852         (Incremental_script_entry::Incremental_script_entry): Add argument
3853         serial number.
3854         (Incremental_object_entry::Incremental_object_entry): Likewise.
3855         (Incremental_object_entry::add_input_section): Build list of input
3856         sections with map to original shndx.
3857         (Incremental_object_entry::get_input_section_index): New function.
3858         (Incremental_object_entry::shndx_): New data member.
3859         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3860         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3861         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3862         serial number.
3863         (Incremental_inputs::report_archive_begin): Likewise.
3864         (Incremental_inputs::report_object): Likewise.
3865         (Incremental_inputs::report_script): Likewise.
3866         (class Incremental_global_symbol_reader): New class.
3867         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3868         and store flags and input file type.
3869         (Incremental_input_entry_reader::arg_serial): New function.
3870         (Incremental_input_entry_reader::type): Extract type from flags.
3871         (Incremental_input_entry_reader::is_in_system_directory): New function.
3872         (Incremental_input_entry_reader::get_input_section_count): Call
3873         accessor function for type.
3874         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3875         function for type; adjust size of global symbol entry.
3876         (Incremental_input_entry_reader::get_global_symbol_count): Call
3877         accessor function for type.
3878         (Incremental_input_entry_reader::get_object_count): Likewise.
3879         (Incremental_input_entry_reader::get_object_offset): Likewise.
3880         (Incremental_input_entry_reader::get_member_count): Likewise.
3881         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3882         (Incremental_input_entry_reader::get_member_offset): Likewise.
3883         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3884         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3885         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3886         (Incremental_input_entry_reader::get_global_symbol_reader): New
3887         function.
3888         (Incremental_input_entry_reader::get_output_symbol_index): New
3889         function.
3890         (Incremental_input_entry_reader::type_): Remove.
3891         (Incremental_input_entry_reader::flags_): New data member.
3892         (Incremental_inputs_reader::input_file_offset): New function.
3893         (Incremental_inputs_reader::input_file_index): New function.
3894         (Incremental_inputs_reader::input_file): Call input_file_offset.
3895         (Incremental_inputs_reader::input_file_at_offset): New function.
3896         (Incremental_relocs_reader::get_r_type): Reformat.
3897         (Incremental_relocs_reader::get_r_shndx): Reformat.
3898         (Incremental_relocs_reader::get_r_offset): Reformat.
3899         (Incremental_relocs_reader::data): New function.
3900         (Incremental_binary::Incremental_binary): Initialize new data members.
3901         (Incremental_binary::check_inputs): Add cmdline parameter.
3902         (Incremental_binary::file_is_unchanged): Remove.
3903         (Input_reader::arg_serial): New function.
3904         (Input_reader::get_unused_symbol_count): New function.
3905         (Input_reader::get_unused_symbol): New function.
3906         (Input_reader::do_arg_serial): New function.
3907         (Input_reader::do_get_unused_symbol_count): New function.
3908         (Input_reader::do_get_unused_symbol): New function.
3909         (Incremental_binary::input_file_count): New function.
3910         (Incremental_binary::get_input_reader): Change signature to use
3911         index instead of filename.
3912         (Incremental_binary::file_has_changed): New function.
3913         (Incremental_binary::get_input_argument): New function.
3914         (Incremental_binary::get_library): New function.
3915         (Incremental_binary::get_script_info): New function.
3916         (Incremental_binary::init_layout): New function.
3917         (Incremental_binary::reserve_layout): New function.
3918         (Incremental_binary::output_file): New function.
3919         (Incremental_binary::do_check_inputs): New function.
3920         (Incremental_binary::do_file_is_unchanged): Remove.
3921         (Incremental_binary::do_file_has_changed): New function.
3922         (Incremental_binary::do_init_layout): New function.
3923         (Incremental_binary::do_reserve_layout): New function.
3924         (Incremental_binary::do_input_file_count): New function.
3925         (Incremental_binary::do_get_input_reader): Change signature.
3926         (Incremental_binary::input_args_map_): New data member.
3927         (Incremental_binary::library_map_): New data member.
3928         (Incremental_binary::script_map_): New data member.
3929         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3930         new data members.
3931         (Sized_incremental_binary::output_section): New function.
3932         (Sized_incremental_binary::inputs_reader): Add const.
3933         (Sized_incremental_binary::symtab_reader): Add const.
3934         (Sized_incremental_binary::relocs_reader): Add const.
3935         (Sized_incremental_binary::got_plt_reader): Add const.
3936         (Sized_incremental_binary::get_symtab_view): New function.
3937         (Sized_incremental_binary::Inputs_reader): New typedef.
3938         (Sized_incremental_binary::Input_entry_reader): New typedef.
3939         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3940         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3941         (Sized_incremental_binary::do_file_has_changed): New function.
3942         (Sized_incremental_binary::do_init_layout): New function.
3943         (Sized_incremental_binary::do_reserve_layout): New function.
3944         (Sized_input_reader::Inputs_reader): Remove.
3945         (Sized_input_reader::Input_entry_reader): Remove.
3946         (Sized_input_reader::do_arg_serial): New function.
3947         (Sized_input_reader::do_get_unused_symbol_count): New function.
3948         (Sized_input_reader::do_get_unused_symbol): New function.
3949         (Sized_incremental_binary::do_input_file_count): New function.
3950         (Sized_incremental_binary::do_get_input_reader): Change signature;
3951         use index instead of filename.
3952         (Sized_incremental_binary::section_map_): New data member.
3953         (Sized_incremental_binary::input_entry_readers_): New data member.
3954         (class Sized_incr_relobj): New class.
3955         (class Sized_incr_dynobj): New class.
3956         (make_sized_incremental_object): New function.
3957         (class Incremental_library): New class.
3958         * layout.cc (Free_list::num_lists): New static data member.
3959         (Free_list::num_nodes): New static data member.
3960         (Free_list::num_removes): New static data member.
3961         (Free_list::num_remove_visits): New static data member.
3962         (Free_list::num_allocates): New static data member.
3963         (Free_list::num_allocate_visits): New static data member.
3964         (Free_list::init): New function.
3965         (Free_list::remove): New function.
3966         (Free_list::allocate): New function.
3967         (Free_list::dump): New function.
3968         (Free_list::print_stats): New function.
3969         (Layout_task_runner::run): Resize output file for incremental updates.
3970         (Layout::Layout): Initialize new data members.
3971         (Layout::set_incremental_base): New function.
3972         (Layout::init_fixed_output_section): New function.
3973         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3974         incremental updates.
3975         (Layout::create_gold_note): Do not create gold note section for
3976         incremental updates.
3977         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3978         for incremental updates.
3979         (Layout::set_section_offsets): For incremental updates, allocate space
3980         from free list.
3981         (Layout::create_symtab_sections): Layout with offsets relative to
3982         start of section; for incremental updates, allocate space from free
3983         list.
3984         (Layout::create_shdrs): For incremental updates, allocate space from
3985         free list.
3986         (Layout::finish_dynamic_section): For incremental updates, do not
3987         check --as-needed (fixed in subsequent patch).
3988         * layout.h (class Free_list): New class.
3989         (Layout::set_incremental_base): New function.
3990         (Layout::incremental_base): New function.
3991         (Layout::init_fixed_output_section): New function.
3992         (Layout::allocate): New function.
3993         (Layout::incremental_base_): New data member.
3994         (Layout::free_list_): New data member.
3995         * main.cc (main): Print Free_list statistics.
3996         * object.cc (Relobj::finalize_incremental_relocs): Add
3997         clear_counts parameter; clear counts only when clear_counts is set.
3998         (Sized_relobj::Sized_relobj): Initialize new base class.
3999         (Sized_relobj::do_layout): Don't report special sections.
4000         (Sized_relobj::do_for_all_local_got_entries): New function.
4001         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4002         symtab_off to all symbol table offsets.
4003         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4004         * object.h (class Got_offset_list): Move to top of file.
4005         (Object::Object): Allow case where input_file == NULL.
4006         (Object::~Object): Likewise.
4007         (Object::input_file): Assert that input_file != NULL.
4008         (Object::lock): Allow case where input_file == NULL.
4009         (Object::unlock): Likewise.
4010         (Object::is_locked): Likewise.
4011         (Object::token): Likewise.
4012         (Object::release): Likewise.
4013         (Object::is_incremental): New function.
4014         (Object::get_mtime): New function.
4015         (Object::for_all_local_got_entries): New function.
4016         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4017         (Object::set_is_in_system_directory): New function.
4018         (Object::is_in_system_directory): New function.
4019         (Object::do_is_incremental): New function.
4020         (Object::do_get_mtime): New function.
4021         (Object::do_for_all_local_got_entries): New function.
4022         (Object::is_in_system_directory_): New data member.
4023         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4024         (class Sized_relobj_base): New class.
4025         (class Sized_relobj): Derive from Sized_relobj_base.
4026         (class Sized_relobj::Symbols): Redeclare from base class.
4027         (class Sized_relobj::local_got_offset_list): Remove.
4028         (class Sized_relobj::Output_sections): Redeclare from base class.
4029         (class Sized_relobj::do_for_all_local_got_entries): New function.
4030         (class Sized_relobj::write_local_symbols): Add offset parameter.
4031         (class Sized_relobj::local_symbol_offset_): Update comment.
4032         (class Sized_relobj::local_dynsym_offset_): Update comment.
4033         * options.cc (Input_arguments::add_file): Remove const.
4034         * options.h (Input_file_argument::Input_file_argument):
4035         Initialize arg_serial_ (all constructors).
4036         (Input_file_argument::set_arg_serial): New function.
4037         (Input_file_argument::arg_serial): New function.
4038         (Input_file_argument::arg_serial_): New data member.
4039         (Input_arguments::Input_arguments): Initialize file_count_.
4040         (Input_arguments::add_file): Remove const.
4041         (Input_arguments::number_of_input_files): New function.
4042         (Input_arguments::file_count_): New data member.
4043         (Command_line::number_of_input_files): Call
4044         Input_arguments::number_of_input_files.
4045         * output.cc (Output_segment_headers::Output_segment_headers):
4046         Set current size.
4047         (Output_section::Input_section::current_data_size): New function.
4048         (Output_section::Output_section): Initialize new data members.
4049         (Output_section::add_input_section): Don't do merge sections for
4050         an incremental link; allocate space from free list for an
4051         incremental update.
4052         (Output_section::add_output_section_data): Allocate space from
4053         free list for an incremental update.
4054         (Output_section::update_data_size): New function.
4055         (Output_section::set_fixed_layout): New function.
4056         (Output_section::reserve): New function.
4057         (Output_segment::set_section_addresses): Remove const.
4058         (Output_segment::set_section_list_addresses): Remove const; allocate
4059         space from free list for an incremental update.
4060         (Output_segment::set_offset): Adjust size of RELRO segment for an
4061         incremental update.
4062         * output.h (Output_data::current_data_size): Move here from
4063         child classes.
4064         (Output_data::pre_finalize_data_size): New function.
4065         (Output_data::update_data_size): New function.
4066         (Output_section_headers::update_data_size): new function.
4067         (Output_section_data_build::current_data_size): Move to Output_data.
4068         (Output_data_strtab::update_data_size): New function.
4069         (Output_section::current_data_size): Move to Output_data.
4070         (Output_section::set_fixed_layout): New function.
4071         (Output_section::has_fixed_layout): New function.
4072         (Output_section::reserve): New function.
4073         (Output_section::update_data_size): New function.
4074         (Output_section::has_fixed_layout_): New data member.
4075         (Output_section::free_list_): New data member.
4076         (Output_segment::set_section_addresses): Remove const.
4077         (Output_segment::set_section_list_addresses): Remove const.
4078         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4079         New function.
4080         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4081         New function.
4082         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4083         parameter when calling Add_symbols constructor; store argument
4084         serial number for members of a lib group.
4085         (Add_symbols::locks): Allow case where token == NULL.
4086         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4087         (Read_member::~Read_member): New function.
4088         (Read_member::is_runnable): New function.
4089         (Read_member::locks): New function.
4090         (Read_member::run): New function.
4091         (Check_script::~Check_script): New function.
4092         (Check_script::is_runnable): New function.
4093         (Check_script::locks): New function.
4094         (Check_script::run): New function.
4095         (Check_library::~Check_library): New function.
4096         (Check_library::is_runnable): New function.
4097         (Check_library::locks): New function.
4098         (Check_library::run): New function.
4099         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4100         (Add_symbols::library_): New data member.
4101         (class Read_member): New class.
4102         (class Check_script): New class.
4103         (class Check_library): New class.
4104         * reloc.cc (Read_relocs::is_runnable): Allow case where
4105         token == NULL.
4106         (Read_relocs::locks): Likewise.
4107         (Scan_relocs::locks): Likewise.
4108         (Relocate_task::locks): Likewise.
4109         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4110         to clear counters.
4111         (Sized_relobj::incremental_relocs_scan): Fix comment.
4112         (Sized_relobj::do_relocate): Pass output file offset to
4113         write_local_symbols.
4114         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4115         from class declaration.
4116         * script.cc (read_input_script): Allocate Script_info; pass
4117         argument serial number to report_script.
4118         * script.h (class Script_info): Move to incremental.h.
4119         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4120         * symtab.h (Symbol_table::add_from_incrobj): New function.
4121         (Symbol_table::set_file_offset): New function.
4122
4123 2011-04-05  Cary Coutant  <ccoutant@google.com>
4124
4125         * incremental-dump.cc (dump_incremental_inputs): Change signature
4126         to take a Sized_incremental_binary; change caller.  Use readers
4127         in Sized_incremental_binary.
4128         * incremental.cc
4129         (Sized_incremental_binary::find_incremental_inputs_sections):
4130         Rename do_find_incremental_inputs_sections to this.
4131         (Sized_incremental_binary::setup_readers): New function.
4132         (Sized_incremental_binary::do_check_inputs): Check
4133         has_incremental_info_ flag; move setup code to setup_readers;
4134         use input readers.
4135         (Sized_incremental_binary::do_file_is_unchanged): New function.
4136         (Sized_incremental_binary::do_get_input_reader): New function.
4137         * incremental.h (class Incremental_binary): Move to end of file.
4138         (Incremental_binary::file_is_unchanged): New function.
4139         (Incremental_binary::do_file_is_unchanged): New function.
4140         (Incremental_binary::Input_reader): New class.
4141         (Incremental_binary::get_input_reader): New function.
4142         (class Sized_incremental_binary): Move to end of file.
4143         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4144         input section reader classes.
4145         (Sized_incremental_binary::has_incremental_info): New function.
4146         (Sized_incremental_binary::inputs_reader): New function.
4147         (Sized_incremental_binary::symtab_reader): New function.
4148         (Sized_incremental_binary::relocs_reader): New function.
4149         (Sized_incremental_binary::got_plt_reader): New function.
4150         (Sized_incremental_binary::do_file_is_unchanged): New function.
4151         (Sized_incremental_binary::Sized_input_reader): New class.
4152         (Sized_incremental_binary::get_input_reader): New function.
4153         (Sized_incremental_binary::find_incremental_inputs_sections):
4154         Rename do_find_incremental_inputs_sections to this.
4155         (Sized_incremental_binary::setup_readers): New function.
4156         (Sized_incremental_binary::has_incremental_info_): New data member.
4157         (Sized_incremental_binary::inputs_reader_): New data member.
4158         (Sized_incremental_binary::symtab_reader_): New data member.
4159         (Sized_incremental_binary::relocs_reader_): New data member.
4160         (Sized_incremental_binary::got_plt_reader_): New data member.
4161         (Sized_incremental_binary::current_input_file_): New data member.
4162
4163 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4164
4165         PR gold/12640
4166         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4167         violation.
4168
4169 2011-03-30  Cary Coutant  <ccoutant@google.com>
4170
4171         * archive.cc (Archive::include_member): Adjust call to report_object.
4172         (Add_archive_symbols::run): Add script_info to call to
4173         report_archive_begin.
4174         (Lib_group::include_member): Adjust call to report_object.
4175         (Add_lib_group_symbols::run): Adjust call to report_object.
4176         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4177         blocks.  Add object count for script input files.
4178         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4179         script_info parameter; change all callers.
4180         (Incremental_inputs::report_object): Add script_info parameter;
4181         change all callers.
4182         (Incremental_inputs::report_script): Store backpointer to
4183         incremental info entry.
4184         (Output_section_incremental_inputs::set_final_data_size): Record
4185         additional information for scripts.
4186         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4187         * incremental.h (Incremental_script_entry::add_object): New function.
4188         (Incremental_script_entry::get_object_count): New function.
4189         (Incremental_script_entry::get_object): New function.
4190         (Incremental_script_entry::objects_): New data member; adjust
4191         constructor.
4192         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4193         (Incremental_inputs::report_object): Add script_info parameter.
4194         (Incremental_inputs_reader::get_object_count): New function.
4195         (Incremental_inputs_reader::get_object_offset): New function.
4196         * options.cc (Input_arguments::add_file): Return reference to
4197         new input argument.
4198         * options.h (Input_argument::set_script_info): New function.
4199         (Input_argument::script_info): New function.
4200         (Input_argument::script_info_): New data member; adjust all
4201         constructors.
4202         (Input_file_group::add_file): Return reference to new input argument.
4203         (Input_file_lib::add_file): Likewise.
4204         (Input_arguments::add_file): Likewise.
4205         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4206         * script.cc (Parser_closure::Parser_closure): Add script_info
4207         parameter; adjust all callers.
4208         (Parser_closure::script_info): New function.
4209         (Parser_closure::script_info_): New data member.
4210         (read_input_script): Report scripts earlier to incremental info.
4211         (script_add_file): Set script_info in Input_argument.
4212         (script_add_library): Likewise.
4213         * script.h (Script_options::Script_info): Rewrite class.
4214
4215 2011-03-29  Cary Coutant  <ccoutant@google.com>
4216
4217         * archive.cc (Library_base::should_include_member): Move
4218         method here from class Archive.
4219         (Archive::Archive): Initialize base class.
4220         (Archive::should_include_member): Move to base class.
4221         (Archive::do_for_all_unused_symbols): New function.
4222         (Add_archive_symbols::run): Remove redundant access to
4223         incremental_inputs.
4224         (Lib_group::Lib_group): Initialize base class.
4225         (Lib_group::do_filename): New function.
4226         (Lib_group::include_member): Pass pointer to Lib_group to
4227         report_object.
4228         (Lib_group::do_for_all_unused_symbols): New function.
4229         (Add_lib_group_symbols::run): Report archive information for
4230         incremental links.
4231         * archive.h (class Library_base): New base class.
4232         (class Archive): Derive from Library_base.
4233         (Archive::filename): Move to base class.
4234         (Archive::set_incremental_info): Likewise.
4235         (Archive::incremental_info): Likewise.
4236         (Archive::Should_include): Likewise.
4237         (Archive::should_include_member): Likewise.
4238         (Archive::Armap_entry): Remove.
4239         (Archive::Unused_symbol_iterator): Remove.
4240         (Archive::unused_symbols_begin): Remove.
4241         (Archive::unused_symbols_end): Remove.
4242         (Archive::do_filename): New function.
4243         (Archive::do_get_mtime): New function.
4244         (Archive::do_for_all_unused_symbols): New function.
4245         (Archive::task_): Move to base class.
4246         (Archive::incremental_info_): Likewise.
4247         (class Lib_group): Derive from Library_base.
4248         (Lib_group::do_filename): New function.
4249         (Lib_group::do_get_mtime): New function.
4250         (Lib_group::do_for_all_unused_symbols): New function.
4251         (Lib_group::task_): Move to base class.
4252         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4253         function.
4254         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4255         function.
4256         * incremental.cc (Incremental_inputs::report_archive_begin):
4257         Use Library_base; call library's get_mtime; add incremental inputs
4258         entry before members.
4259         (class Unused_symbol_visitor): New class.
4260         (Incremental_inputs::report_archive_end): Use Library_base; use
4261         visitor class to record unused symbols; don't add incremental inputs
4262         entry after members.
4263         (Incremental_inputs::report_object): Use Library_base.
4264         * incremental.h
4265         (Incremental_archive_entry::Incremental_archive_entry): Remove
4266         unused Archive parameter.
4267         (Incremental_inputs::report_archive_begin): Use Library_base.
4268         (Incremental_inputs::report_archive_end): Likewise.
4269         (Incremental_inputs::report_object): Likewise.
4270         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4271         function.
4272         * object.h (Object::for_all_global_symbols): New function.
4273         (Object::do_for_all_global_symbols): New function.
4274         (Sized_relobj::do_for_all_global_symbols): New function.
4275         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4276         function.
4277         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4278         function.
4279
4280 2011-03-27  Ian Lance Taylor  <iant@google.com>
4281
4282         * archive.cc (Archive::interpret_header): Return -1 if something
4283         goes wrong.  Change callers accordingly.
4284
4285 2011-03-25  Cary Coutant  <ccoutant@google.com>
4286
4287         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4288         * testsuite/Makefile.in: Regenerate.
4289
4290 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4291
4292         * plugin.cc (get_view): New.
4293         (Plugin::load): Pass get_view to the plugin.
4294         (Plugin_manager::get_view): New.
4295
4296 2011-03-21  Ian Lance Taylor  <iant@google.com>
4297
4298         * testsuite/final_layout.sh: Rewrite to not use dc.
4299         * testsuite/relro_test.sh: Fail if dc is not present.
4300
4301 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4302
4303         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4304         Change == to -eq.
4305         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4306         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4307         Change == to -eq.
4308         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4309         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4310
4311 2011-03-14  Ian Lance Taylor  <iant@google.com>
4312
4313         * script-sections.cc (Sort_output_sections::script_compare):
4314         Rename from is_before, change return type.
4315         (Sort_output_sections::operator()): Adjust accordingly.
4316
4317 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4318
4319         PR gold/12572
4320         * testsuite/odr_violation2.cc: Add comment to make all error line
4321         numbers double digits.
4322         * testsuite/debug_msg.sh: Adjust expected errors.
4323
4324 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4325
4326         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4327         but mark earlier ones as non-canonical
4328         (offset_to_iterator): Update search target and example
4329         (do_addr2line): Return extra lines in a vector*
4330         (format_file_lineno): Extract from do_addr2line
4331         (one_addr2line): Add vector* out-param
4332         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4333         when a lineno entry appeared last for its instruction
4334         (Dwarf_line_info): Add vector* out-param
4335         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4336         * symtab.cc (Odr_violation_compare): Include the lineno in the
4337         comparison again.
4338         (linenos_from_loc): New. Combine the canonical line for an
4339         address with its other lines.
4340         (True_if_intersect): New. Helper functor to make
4341         std::set_intersection a query.
4342         (detect_odr_violations): Compare sets of lines instead of just
4343         one line for each function. This became less deterministic, but
4344         has fewer false positives.
4345         * symtab.h: Declarations.
4346         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4347         mix an optimized and non-optimized object in the same binary
4348         (odr_violation2.so): Same.
4349         * testsuite/Makefile.in: Regenerate from Makefile.am.
4350         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4351         * testsuite/debug_msg.sh: Update line numbers and add
4352         assertions.
4353         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4354         non-optimized context.
4355         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4356         isn't inlined, and use OdrDerived in an optimized context.
4357         * testsuite/odr_header1.h: Defines OdrDerived, where
4358         optimization will change the
4359         first-instruction-in-the-destructor's file and line number.
4360         * testsuite/odr_header2.h: Defines OdrBase.
4361
4362 2011-03-09  Ian Lance Taylor  <iant@google.com>
4363
4364         * fileread.cc (File_read::clear_views): Don't delete the whole
4365         file view.
4366
4367 2011-03-08  Ian Lance Taylor  <iant@google.com>
4368
4369         PR gold/12525
4370         * fileread.cc: #include <climits>.
4371         (GOLD_IOV_MAX): Define.
4372         (File_read::read_multiple): Limit number of entries by iov_max.
4373         * fileread.h (class File_read): Always set max_readv_entries to
4374         128.
4375
4376 2011-03-07  Ian Lance Taylor  <iant@google.com>
4377
4378         PR gold/12525
4379         * options.h (class General_options): Add -dy and -dn.
4380
4381 2011-03-02  Cary Coutant  <ccoutant@google.com>
4382
4383         * testsuite/script_test_9.t: Add TLS segment.
4384
4385 2011-03-02  Simon Baldwin  <simonb@google.com>
4386
4387         * configure.ac: Add check for gnu_indirect_function support in
4388         the toolchain building binutils.
4389         * configure: Rebuild.
4390
4391 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4392
4393         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4394         plugin only symbols.
4395         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4396         in plugin files as not needed in the symbol table.
4397
4398 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4399
4400         * output.cc (Output_section::add_input_section): Delay fill
4401         generation for section ordering.
4402
4403 2011-02-09  Ian Lance Taylor  <iant@google.com>
4404
4405         PR gold/12316
4406         * object.h (class Sized_relobj): Remove clear_local_symbols.
4407         * reloc.cc (Sized_relobj::do_relocate): Don't call
4408         clear_local_symbols.
4409
4410 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4411
4412         * plugin.cc (is_visible_from_outside): Return true for symbols
4413         in the -u option.
4414
4415 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4416
4417         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4418         filename.
4419
4420 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4421
4422         * icf.h (is_section_foldable_candidate): Change type of parameter
4423         to std::string.
4424         * icf.cc (Icf::find_identical_sections): Change type of local variable
4425         section_name to be std::string.
4426         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4427
4428 2011-01-25  Ian Lance Taylor  <iant@google.com>
4429
4430         * script.cc (script_add_extern): Rewrite to use
4431         add_symbol_reference.
4432
4433 2011-01-25  Doug Kwan  <dougkwan@google.com>
4434
4435         * icf.cc (get_section_contents): Always lock section's object.
4436
4437 2011-01-24  Ian Lance Taylor  <iant@google.com>
4438
4439         * options.h (class General_options): Accept
4440         --no-detect-odr-violations.
4441
4442 2011-01-24  Ian Lance Taylor  <iant@google.com>
4443
4444         * version.cc (version_string): Bump to 1.11.
4445
4446 2011-01-24  Ian Lance Taylor  <iant@google.com>
4447
4448         * plugin.cc (class Plugin_rescan): Define new class.
4449         (Plugin_manager::claim_file): Set any_claimed_.
4450         (Plugin_manager::save_archive): New function.
4451         (Plugin_manager::save_input_group): New function.
4452         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4453         necessary.
4454         (Plugin_manager::new_undefined_symbol): New function.
4455         (Plugin_manager::rescan): New function.
4456         (Plugin_manager::rescannable_defines): New function.
4457         (Plugin_manager::add_input_file): Set any_added_.
4458         * plugin.h (class Plugin_manager): define new fields rescannable_,
4459         undefined_symbols_, any_claimed_, and any_added_.  Declare
4460         Plugin_rescan as friend.  Declare new functions.
4461         (Plugin_manager::Rescannable): Define type.
4462         (Plugin_manager::Rescannable_list): Define type.
4463         (Plugin_manager::Undefined_symbol_list): Define type.
4464         (Plugin_manager::Plugin_manager): Initialize new fields.
4465         * archive.cc (Archive::defines_symbol): New function.
4466         (Add_archive_symbols::run): Pass archive to plugins if any.
4467         * archive.h (class Archive): Declare defines_symbol.
4468         * readsyms.cc (Input_group::~Input_group): New function.
4469         (Finish_group::run): Pass input_group to plugins if any.
4470         * readsyms.h (class Input_group): Declare destructor.
4471         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4472         any.
4473
4474 2011-01-10  Ian Lance Taylor  <iant@google.com>
4475
4476         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4477         section as relro.
4478         (Layout::set_segment_offsets): Reset increase_relro before calling
4479         set_section_addresses a second time.
4480
4481 2011-01-04  Cary Coutant  <ccoutant@google.com>
4482
4483         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4484         sections before NOBITS sections.
4485
4486 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4487
4488         * version.cc (print_version): Update copyright to 2011.
4489
4490 2010-12-23  Cary Coutant  <ccoutant@google.com>
4491
4492         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4493         of OS to this->add.  Add OD parameter to second form of the function.
4494
4495 2010-12-20  Ian Lance Taylor  <iant@google.com>
4496
4497         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4498         second of two consecutive entries with same offset.
4499
4500 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4501
4502         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4503         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4504         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4505         to avoid unneeded links against $(LDADD).
4506         * testsuite/Makefile.in: Regenerate.
4507
4508 2010-12-15  Ian Lance Taylor  <iant@google.com>
4509
4510         PR gold/12324
4511         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4512         for R_X86_64_32 and R_X86_64_PC32.
4513         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4514         ver_matching_def_pic.o.
4515         (ver_matching_def_pic.o): New target.
4516
4517 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4518
4519         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4520         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4521         Move definition before File_read::View member definitions.
4522         (File_read::View::~View): Initialize and hold lock before
4523         updating current_mapped_bytes.
4524
4525 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4526
4527         * dwarf_reader.cc: Remove outdated comment.
4528         * gold-threads.cc: Fix typo in error message.
4529         * archive.cc: Fix typos in comments.
4530         * archive.h: Likewise.
4531         * arm-reloc-property.cc: Likewise.
4532         * arm-reloc-property.h: Likewise.
4533         * arm-reloc.def: Likewise.
4534         * arm.cc: Likewise.
4535         * attributes.h: Likewise.
4536         * cref.cc: Likewise.
4537         * ehframe.cc: Likewise.
4538         * fileread.h: Likewise.
4539         * gold.h: Likewise.
4540         * i386.cc: Likewise.
4541         * icf.cc: Likewise.
4542         * incremental.h: Likewise.
4543         * int_encoding.cc: Likewise.
4544         * layout.h: Likewise.
4545         * main.cc: Likewise.
4546         * merge.h: Likewise.
4547         * object.cc: Likewise.
4548         * object.h: Likewise.
4549         * options.cc: Likewise.
4550         * readsyms.cc: Likewise.
4551         * reduced_debug_output.cc: Likewise.
4552         * reloc.cc: Likewise.
4553         * script-sections.cc: Likewise.
4554         * sparc.cc: Likewise.
4555         * symtab.h: Likewise.
4556         * target-reloc.h: Likewise.
4557         * target.cc: Likewise.
4558         * target.h: Likewise.
4559         * timer.cc: Likewise.
4560         * timer.h: Likewise.
4561         * x86_64.cc: Likewise.
4562
4563 2010-12-09  Cary Coutant  <ccoutant@google.com>
4564
4565         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4566         stack.
4567         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4568         parameter; change all callers.
4569         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4570         * options.h (warn_execstack): New option.
4571
4572 2010-12-07  Doug Kwan  <dougkwan@google.com>
4573
4574         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4575         like function call relocations.
4576
4577 2010-12-07  Ian Lance Taylor  <iant@google.com>
4578
4579         * archive.cc (Archive::get_elf_object_for_member): Permit
4580         punconfigured to be NULL.
4581         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4582         (Archive::include_member): Pass NULL to get_elf_object_for_member
4583         if we searched for the archive and this is the first included
4584         object.
4585
4586 2010-12-01  Ian Lance Taylor  <iant@google.com>
4587
4588         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4589         track_relocs_type_ field.
4590         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4591         Set track_relocs_type_.
4592         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4593         contents when using RELA relocs.
4594         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4595         reloc_map_.
4596         * reloc.cc (Track_relocs::next_addend): New function.
4597         * reloc.h (class Track_relocs): Declare next_addend.
4598
4599 2010-12-01  Ian Lance Taylor  <iant@google.com>
4600
4601         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4602         virtual destructor.
4603
4604 2010-12-01  Ian Lance Taylor  <iant@google.com>
4605
4606         * README: Update compilers known to work and fail.
4607
4608 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4609
4610         * configure.in: For --enable-gold, handle value `default' instead of
4611         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4612         not the default.
4613         * configure: Regenerate.
4614
4615 2010-11-18  Doug Kwan  <dougkwan@google.com>
4616
4617         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4618         and right_alignment to be zero.  Store result alignment only if it is
4619         greater than existing alignment.
4620
4621 2010-11-16  Cary Coutant  <ccoutant@google.com>
4622
4623         PR gold/12220
4624         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4625         Check for ".zdebug_line".
4626
4627 2010-11-16  Doug Kwan  <dougkwan@google.com>
4628             Cary Coutant  <ccoutant@google.com>
4629
4630         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4631         by reference; adjust all callers.
4632         * output.cc (Output_segment::set_section_addresses): Adjust references
4633         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4634         list is empty.
4635         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4636         end at page boundary.
4637
4638 2010-11-16  Cary Coutant  <ccoutant@google.com>
4639
4640         PR gold/12220
4641         * layout.cc (Layout::choose_output_section): Transform names of
4642         compressed sections even when using a script with a SECTIONS clause.
4643         (Layout::output_section_name): Remove code to transform
4644         compressed debug section names.
4645         * output.cc (Output_section::add_input_section): Use uncompressed
4646         section size when tracking input sections.
4647
4648 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4649
4650         * symtab.h (Symbol::NON_PIC_REF): Remove.
4651         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4652         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4653         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4654         (Symbol::use_plt_offset): Take a flags argument and pass it
4655         directly to needs_dynamic_reloc.  Restrict check for undefined
4656         weak symbols to function calls.
4657         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4658         (Target_arm::Scan::global): Use it.
4659         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4660         (Target_arm::Relocate::relocate): Likewise.
4661         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4662         parameter with an r_type parameter.  Use get_reference_flags
4663         to get the flags.
4664         (Target_arm::Relocate::relocate): Update accordingly.
4665         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4666         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4667         (Target_i386::Scan::global): Likewise.
4668         (Target_i386::Relocate::relocate): Likewise.
4669         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4670         parameter with an r_type parameter.  Use get_reference_flags
4671         to get the flags.
4672         (Target_i386::Relocate::relocate): Update accordingly.
4673         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4674         (Target_powerpc::Scan::global): Use it.
4675         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4676         (Target_powerpc::Relocate::relocate): Likewise.
4677         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4678         (Target_sparc::Scan::global): Use it.
4679         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4680         (Target_sparc::Relocate::relocate): Likewise.
4681         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4682         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4683         (Target_x86_64::Scan::global): Likewise.
4684         (Target_x86_64::Relocate::relocate): Likewise.
4685
4686 2010-11-08  Doug Kwan  <dougkwan@google.com>
4687             Cary Coutant  <ccoutant@google.com>
4688
4689         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4690         (Arm_exidx_merge_section::section_contents_): New data member.
4691         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4692         (Arm_input_section::~Arm_input_section): De-allocate memory.
4693         (Arm_input_section::original_contents_): New data member.
4694         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4695         in parameters instead of calling Object::section_contents without
4696         locking.
4697         (Arm_output_section::group_section): New parameter TASK.  Pass it
4698         to callees that need locking objects.
4699         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4700         to lock EXIDX input sections.  Fix a formatting issue.  Call
4701         Arm_exidx_merged_section::build_contents to create merged section
4702         contents.
4703         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4704         to lock object of stub table owner.
4705         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4706         TEXT_SIZE to initialize data member TEXT_SIZE_.
4707         (Arm_exidx_input_section::addralign): Fix typo in comment.
4708         (Arm_exidx_input_section::text_size): New method.
4709         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4710         that require locking objects.  Lock objects before scanning for stubs
4711         and updating local symbols.
4712         (Arm_input_section<big_endian>::init): Copy contents of original
4713         input section.
4714         (Arm_input_section<big_endian>::do_write): Use saved contents of
4715         original input section instead of calling Object::section_contents
4716         without locking.
4717         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4718         size without calling Object::section_size().
4719         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4720         for size.  Allocate a buffer for merged EXIDX entries.
4721         (Arm_exidx_merged_section::build_contents): New method.
4722         (Arm_exidx_merged_section::do_write): Move merge section contents
4723         building code to Arm_exidx_merged_section::build_contetns.  Write
4724         out contetns in buffer instead of building it on the fly.
4725         (Arm_relobj::make_exidx_input_section): Also pass text section size
4726         to Arm_exidx_input_section constructor.
4727         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4728         (Arm_dynobj::do_read_symbols): Fix memory leak.
4729         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4730         * target.h: (class Task): Add forward declaration.
4731         (Target::relax): Add new parameter TASK and pass it to
4732         Target::do_relax().
4733         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4734
4735 2010-11-05  Cary Coutant  <ccoutant@google.com>
4736
4737         PR gold/10708
4738         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4739         object when reading from the file.
4740         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4741         second layout pass.
4742         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4743         when reading section contents.
4744         (get_section_contents): Likewise.
4745         (icf::find_identical_sections): Likewise.
4746         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4747         object when reading from the file.
4748         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4749         the object when doing deferred section layout.
4750
4751 2010-11-03  Nick Clifton  <nickc@redhat.com>
4752
4753         PR gold/12001
4754         * script.h (class Symbol_assignment: name): New member.  Returns
4755         the name of the symbol.
4756         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4757         Returns true if the given symbol name is on the list of
4758         assignments wating to be processed.
4759         * archive.cc (should_incldue_member): If the symbol is undefined,
4760         check to see if it is on the list of symbols pending assignment.
4761
4762 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4763
4764         * script-sections.cc (Script_sections::find_memory_region): Check
4765         for a NULL output section pointer.
4766
4767 2010-10-29  Doug Kwan  <dougkwan@google.com>
4768
4769         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4770         Output_section::add_relaxed_input_section.
4771         * output.cc (Output_section::add_relaxed_input_section): Add new
4772         arguments LAYOUT and NAME.  Set section order index.
4773         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4774         Copy section order index.
4775         * output.h (Output_section::add_relaxed_input_section): Add new
4776         arguments LAYOUT and NAME.
4777
4778 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4779
4780         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4781         NATIVE_OR_CROSS_LINKER.
4782         * testsuite/Makefile.in: Regenerate.
4783
4784 2010-10-20  Doug Kwan  <dougkwan@google.com>
4785
4786         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4787         without SHF_LINK_ORDER flags.
4788         * layout.cc (Layout::choose_output_section): Do not filter
4789         SHF_LINK_ORDER flag in a relocatable link.
4790
4791 2010-10-17  Cary Coutant  <ccoutant@google.com>
4792
4793         * output.h (Output_segment::set_section_addresses): Change function
4794         signature.  Update all callers.
4795         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4796         sections.
4797         (Output_segment::set_section_addresses): Align after last TLS
4798         section.  Add padding before last relro section instead of after.
4799
4800 2010-10-17  Doug Kwan  <dougkwan@google.com>
4801
4802         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4803         GOT output section to be writable.
4804
4805 2010-10-14  Cary Coutant  <ccoutant@google.com>
4806
4807         * debug.h (DEBUG_INCREMENTAL): New flag.
4808         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4809         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4810         mode.
4811         * incremental.cc (report_command_line): Ignore all forms of
4812         --incremental.
4813         * layout.cc (Layout::Layout): Check parameters for incremental link
4814         mode.
4815         * options.cc (General_options::parse_incremental): New function.
4816         (General_options::parse_no_incremental): New function.
4817         (General_options::parse_incremental_full): New function.
4818         (General_options::parse_incremental_update): New function.
4819         (General_options::incremental_mode_): New data member.
4820         (General_options::finalize): Check incremental_mode_.
4821         * options.h (General_options): Update help text for --incremental.
4822         Add --no-incremental, --incremental-full, --incremental-update.
4823         (General_options::Incremental_mode): New enum type.
4824         (General_options::incremental_mode): New function.
4825         (General_options::incremental_mode_): New data member.
4826         * parameters.cc (Parameters::incremental_mode_): New data member.
4827         (Parameters::set_options): Set incremental_mode_.
4828         (Parameters::set_incremental_full): New function.
4829         (Parameters::incremental): New function.
4830         (Parameters::incremental_update): New function.
4831         (set_parameters_incremental_full): New function.
4832         * parameters.h (Parameters::set_incremental_full): New function.
4833         (Parameters::incremental): New function.
4834         (Parameters::incremental_update): New function.
4835         (Parameters::incremental_mode_): New data member.
4836         (set_parameters_incremental_full): New function.
4837         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4838         incremental link mode.
4839         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4840         (Sized_relobj::do_relocate_sections): Likewise.
4841         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4842         option.
4843         * testsuite/Makefile.in: Regenerate.
4844         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4845
4846 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4847
4848         * script-sections.h (class Script_sections): Make
4849         Sections_elements typedef public.
4850         * script-sections.cc (class Sort_output_sections): Add elements_
4851         field.  Add constructor which sets it; change all callers.
4852         (Sort_output_sections::is_before): New function.
4853         (Sort_output_sections::operator()): Call is_before.
4854         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4855         conditional.
4856         * testsuite/script_test_10.sh: New test. Test script section
4857         order.
4858         * testsuite/script_test_10.t: Likewise.
4859         * testsuite/script_test_10.s: Likewise.
4860         * testsuite/Makefile.am: Wrap the cross linker tests and the
4861         common tests into NATIVE_OR_CROSS_LINKER.
4862         (check_SCRIPTS): Add script_test_10.sh.
4863         (check_DATA): Add script_test_10.stdout.
4864         (script_test_10.o, script_test_10): New targets.
4865         (script_test_10.stdout): New target.
4866         * configure, testsuite/Makefile.in: Regenerate.
4867
4868 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4869
4870         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4871         error for the deprecated relocations.
4872         (Target_arm::Scan::global): Likewise.
4873         (Target_arm::Relocate::relocate): Likewise.
4874
4875 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4876
4877         * fileread.cc (Input_file::find_file): Initialize *found_name
4878         and *namep when using the fallback search for case 4.
4879
4880 2010-10-11  Cary Coutant  <ccoutant@google.com>
4881
4882         * options.h (class General_options): Redefine -z lazy as an alias for
4883         the negation of -z now.
4884
4885 2010-10-11  Ian Lance Taylor  <iant@google.com>
4886
4887         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4888         binding.
4889
4890 2010-10-06  Nick Clifton  <nickc@redhat.com>
4891
4892         * script-sections.cc(class Memory_region): Remove
4893         current_lma_offset_ field.  Rename current_vma_offset_ to
4894         current_offset_.  Add last_section_ field.
4895         (Memory_region::get_current_vma_address): Rename to
4896         get_current_address.
4897         (Memory_region::get_current_lma_address): Delete.
4898         (Memory_region::increment_vma_offset): Rename to
4899         increment_offset.
4900         (Memory_region::increment_lma_offset): Delete.
4901         (Memory_region::attributes_compatible): New method.  Returns
4902         true if the provided section is compatible with the region.
4903         (Memory_region::get_last_section): New method.  Returns the last
4904         section to use the region.
4905         (Memory_region::set_last_section): New method.  Stores the last
4906         section to use the region.
4907         (Script_sections::block_in_region): New method.  Returns true if
4908         a block of memory is contained within a region.
4909         (Script_sections::find_memory_region): New method.  Locates a
4910         memory region to be used to set a VMA or LMA address.
4911         (Output_section_definition::set_section_addresses): Add code to
4912         check for addresses set by memory regions.
4913         (Output_segment::set_section_addresses): Remove memory region
4914         walking code.
4915         (Script_sections::create_segment): Add a warning if a header
4916         segment is created outside of any region.
4917         * script-sections.h (class Script_sections): Add prototypes for
4918         find_memory_region and block_in_region methods.
4919         * testsuite/memory_test.s: Use .long instead of .word.
4920         * testsuite/memory_test.t: Add some more output sections.
4921         * testsuite/memory_test.sh: Update expected output.
4922
4923 2010-10-02  Doug Kwan  <dougkwan@google.com>
4924
4925         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4926         defintion to symtab.h
4927         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4928         declaration to defintion.
4929
4930 2010-10-01  Nick Clifton  <nickc@redhat.com>
4931
4932         * expression.cc (eval): Replace dummy argument with NULL.
4933         (eval_maybe_dot): Check for a NULL result section pointer.
4934         (Symbol_expression::value): Likewise.
4935         (Dot_expression::value): Likewise.
4936         (BINARY_EXPRESSION): Likewise.
4937         (Max_expression::value): Likewise.
4938         (Min_expression::value): Likewise.
4939         (Absolute_expression::value): Likewise.
4940         (Addr_expression::value_from_output_section): Likewise.
4941         (Loaddddr_expression::value_from_output_section): Likewise.
4942         (Segment_start_expression::value): Likewise.
4943         * script-sections.cc
4944         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4945         argument with NULL.
4946         (Sections_elememt_dot_assignment::set_section_addresses):
4947         Likewise.
4948         (Output_data_expression::do_write_to_buffer): Likewise.
4949         (Output_section_definition::finalize_symbols): Likewise.
4950         (Output_section_definition::set_section_addresses): Likewise.
4951
4952 2010-09-30  Doug Kwan  <dougkwan@google.com>
4953
4954         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4955
4956 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4957
4958         * target.h (Target::can_icf_inline_merge_sections): New virtual
4959         function.
4960         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4961         virtual function.
4962         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4963         virtual function.
4964         * icf.cc (get_section_contents): Inline merge sections only when
4965         target allows it.
4966
4967 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4968
4969         * configure: Regenerate.
4970
4971 2010-09-17  Ian Lance Taylor  <iant@google.com>
4972
4973         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4974         * testsuite/Makefile.am (memory_test.o): New target.
4975         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4976         memory_test.t.
4977         * testsuite/Makefile.in: Rebuild.
4978
4979 2010-09-17  Doug Kwan  <dougkwan@google.com>
4980
4981         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4982         defintion if relocation uses GOT entries of the symbol.
4983         * testsuite/icf_safe_test.sh: Fix test.
4984         * testsuite/icf_safe_so_test.sh: Fix test.
4985
4986 2010-09-16  Cary Coutant  <ccoutant@google.com>
4987
4988         * script_sections.cc (class Memory_region): Remove "NULL" from
4989         vector initializations.
4990
4991 2010-09-15  Cary Coutant  <ccoutant@google.com>
4992
4993         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4994         Resolve forwarding symbols.
4995
4996 2010-09-15  Doug Kwan  <dougkwan@google.com>
4997
4998         * gold/testsuite/script_test_3.t: Add ARM special sections.
4999         * gold/testsuite/script_test_4.t: Same.
5000         * gold/testsuite/script_test_5.t: Same.
5001         * gold/testsuite/script_test_6.t: Same.
5002         * gold/testsuite/script_test_7.t: Same.
5003         * gold/testsuite/script_test_7.t: Same.
5004         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5005
5006 2010-09-14  Cary Coutant  <ccoutant@google.com>
5007
5008         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5009         (Target_x86_64::Relocate::relocate_tls): Replace check for
5010         saw_tls_block_reloc_ with test for executable section.
5011
5012 2010-09-12  Cary Coutant  <ccoutant@google.com>
5013
5014         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5015         position-independent executables to shared libraries need dynamic
5016         relocations.
5017         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5018         position-independent executables.
5019         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5020         * testsuite/Makefile.in: Regenerate.
5021
5022 2010-09-10  Nick Clifton  <nickc@redhat.com>
5023
5024         PR gold/11997
5025         * testsuite/memory_test.t: Discard any sections that are not
5026         needed.
5027
5028 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5029
5030         PR gold/11996
5031         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5032         "This::" to work around a bug in gcc 4.2.
5033
5034         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5035
5036 2010-09-09  Rafael Espindola  <espindola@google.com>
5037
5038         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5039         sections with different PF_X flags in the same segment.
5040         (Layout::find_first_load_seg): Search all segments to find the first
5041         one.
5042         * options.h (rosegment): New.
5043
5044 2010-09-08  Rafael Espindola  <espindola@google.com>
5045
5046         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5047
5048 2010-09-08  Doug Kwan  <dougkwan@google.com>
5049
5050         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5051         (Arm_relobj::do_relocate_sections): Add new parameter for output
5052         file to match the parent.
5053         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5054         of local symbols instead of input values.  Update code to track
5055         changes in gold::relocate_section.
5056         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5057         (Sized_relobj::compute_final_local_value_internal): New methods.
5058         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5059         body into private version of Sized_relobj::compute_final_local_value.
5060         Call the inline method.
5061         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5062         merged symbol value if there is one.
5063         (Symbol_value::has_output_value): New method defintiion.
5064         (Sized_relobj::Compute_final_local_value_status): New enum type.
5065         (Sized_relobj::compute_final_local_value): New methods.
5066         (Sized_relobj::compute_final_local_value_internal): New methods.
5067         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5068         and arm_cortex_a8.sh.
5069         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5070         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5071         New tests.
5072         * Makefile.in: Regenerate.
5073         * testsuite/arm_bl_out_of_range.s: Update test.
5074         * testsuite/thumb_bl_out_of_range.s: Ditto.
5075         * testsuite/thumb_blx_out_of_range.s: Ditto.
5076         * testsuite/arm_branch_out_of_range.sh: New file.
5077         * testsuite/arm_cortex_a8.sh: Ditto.
5078         * testsuite/arm_cortex_a8_b.s: Ditto.
5079         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5080         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5081         * testsuite/arm_cortex_a8_bl.s: Ditto.
5082         * testsuite/arm_cortex_a8_blx.s: Ditto.
5083         * testsuite/arm_cortex_a8_local.s: Ditto.
5084         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5085         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5086
5087 2010-09-08  Rafael Espindola  <espindola@google.com>
5088
5089         * Makefile.am (memory_test.stdout): Run readelf with -W.
5090         * Makefile.in: Regenerate.
5091         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5092         64 bit output.
5093
5094 2010-09-08  Rafael Espindola  <espindola@google.com>
5095
5096         * script-sections.cc (Script_sections::add_memory_region): Convert
5097         field precision to int.
5098         * script.cc (script_set_section_region, script_set_section_region):
5099         Convert field precision to int.
5100
5101 2010-09-08  Rafael Espindola  <espindola@google.com>
5102
5103         * arm.cc (do_finalize_sections): Create the __exidx_start and
5104         __exdix_end symbols even when the section is missing.
5105
5106 2010-09-08  Nick Clifton  <nickc@redhat.com>
5107
5108         * README: Remove claim that MEMORY is not supported.
5109         * expression.cc (script_exp_function_origin)
5110         (script_exp_function_length): Move from here to ...
5111         * script.cc: ... here.
5112         (script_set_section_region, script_add_memory)
5113         (script_parse_memory_attr, script_include_directive): New
5114         functions.
5115         * script-sections.cc
5116         (class Memory_region): New class.
5117         (class Output_section_definition): Add set_memory_region,
5118         set_section_vma, set_section_lma and get_section_name methods.
5119         (class Script_Sections): Add add_memory_region,
5120         find_memory_region, find_memory_region_origin,
5121         find_memory_region_length and set_memory_region methods.
5122         Have set_section_addresses method walk the list of set memory
5123         regions.
5124         Extend the print methos to display memory regions.
5125         * script-sections.h: Add prototypes for new methods.
5126         Add enum for MEMORY region attributes.
5127         * yyscript.y: Add support for parsing MEMORY regions.
5128         * script-c.h: Add prototypes for new functions.
5129         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5130         * testsuite/Makefile.in: Regenerate.
5131         * testsuite/memory_test.sh: New script.
5132         * testsuite/memory_test.s: New assembler source file.
5133         * testsuite/memory_test.t: New linker script.
5134
5135 2010-08-27  Doug Kwan  <dougkwan@google.com>
5136
5137         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5138         reference override an existing dynamic weak reference.
5139         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5140         * testsuite/Makefile.in: Regenerate.
5141         * testsuite/dyn_weak_ref.sh: New file.
5142         * testsuite/dyn_weak_ref_1.c: Ditto.
5143         * testsuite/dyn_weak_ref_2.c: Ditto.
5144
5145 2010-08-27  Ian Lance Taylor  <iant@google.com>
5146
5147         * incremental.h (class Incremental_input_entry): Add virtual
5148         destructor.
5149
5150 2010-08-27  Ian Lance Taylor  <iant@google.com>
5151
5152         * testsuite/start_lib_test_3.c: Mark t3 as used.
5153
5154 2010-08-27  Nick Clifton  <nickc@redhat.com>
5155
5156         * options.cc (version_script): Fix small typo in previous
5157         whitespace tidyup.
5158
5159 2010-08-25  Nick Clifton  <nickc@redhat.com>
5160
5161         * archive.cc: Formatting fixes: Remove whitespace between
5162         typename and following asterisk.  Remove whitespace between
5163         function name and opening parenthesis.
5164         * archive.h: Likewise.
5165         * arm.cc: Likewise.
5166         * attributes.cc: Likewise.
5167         * attributes.h: Likewise.
5168         * common.cc: Likewise.
5169         * copy-relocs.cc: Likewise.
5170         * dirsearch.h: Likewise.
5171         * dynobj.cc: Likewise.
5172         * ehframe.cc: Likewise.
5173         * ehframe.h: Likewise.
5174         * expression.cc: Likewise.
5175         * fileread.cc: Likewise.
5176         * fileread.h: Likewise.
5177         * gc.h: Likewise.
5178         * gold-threads.cc: Likewise.
5179         * gold.cc: Likewise.
5180         * i386.cc: Likewise.
5181         * icf.h: Likewise.
5182         * incremental-dump.cc: Likewise.
5183         * incremental.cc: Likewise.
5184         * layout.cc: Likewise.
5185         * layout.h: Likewise.
5186         * main.cc: Likewise.
5187         * merge.cc: Likewise.
5188         * merge.h: Likewise.
5189         * object.cc: Likewise.
5190         * object.h: Likewise.
5191         * options.cc: Likewise.
5192         * options.h: Likewise.
5193         * output.cc: Likewise.
5194         * output.h: Likewise.
5195         * plugin.cc: Likewise.
5196         * plugin.h: Likewise.
5197         * powerpc.cc: Likewise.
5198         * reloc.cc: Likewise.
5199         * script-c.h: Likewise.
5200         * script-sections.cc: Likewise.
5201         * script.cc: Likewise.
5202         * stringpool.cc: Likewise.
5203         * symtab.cc: Likewise.
5204         * symtab.h: Likewise.
5205         * target.cc: Likewise.
5206         * timer.cc: Likewise.
5207         * timer.h: Likewise.
5208         * version.cc: Likewise.
5209         * x86_64.cc: Likewise.
5210
5211 2010-08-24  Nick Clifton  <nickc@redhat.com>
5212
5213         PR 11899
5214         * layout.cc (segment_precedes): Sort segments by their physical
5215         addresses, if they have been set.
5216
5217 2010-08-23  Cary Coutant  <ccoutant@google.com>
5218
5219         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5220         symbols data.
5221         (Lib_group::include_member): Unlock object after deleting its
5222         symbols data.
5223         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5224         the bug fixed here.
5225
5226 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5227             Cary Coutant  <ccoutant@google.com>
5228
5229         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5230         constructor, and set_blocker.
5231         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5232         readsyms_blocker_.
5233         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5234         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5235         * testsuite/Makefile.am (start_lib_test): New test case.
5236         * testsuite/Makefile.in: Regenerate.
5237         * testsuite/start_lib_test_main.c: New file.
5238         * testsuite/start_lib_test_1.c: New file.
5239         * testsuite/start_lib_test_2.c: New file.
5240         * testsuite/start_lib_test_3.c: New file.
5241
5242 2010-08-19  Ian Lance Taylor  <iant@google.com>
5243
5244         * Makefile.in: Rebuild with automake 1.11.1.
5245         * aclocal.m4: Likewise.
5246         * testsuite/Makefile.in: Likewise.
5247
5248 2010-08-19  Ian Lance Taylor  <iant@google.com>
5249
5250         PR 10893
5251         * i386.cc (class Output_data_plt_i386): Update declarations.
5252         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5253         local_ifuncs_ fields.
5254         (Target_i386::do_plt_section_for_global): New function.
5255         (Target_i386::do_plt_section_for_local): New function.
5256         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5257         parameter; change all callers.  Initialize global_ifuncs_ and
5258         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5259         __rel_iplt_end.
5260         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5261         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5262         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5263         symbols.
5264         (Target_i386::make_plt_section): New function, broken out of
5265         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5266         (Target_i386::make_plt_entry): Call make_plt_section.
5267         (Target_i386::make_local_ifunc_plt_entry): New function.
5268         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5269         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5270         R_386_IRELATIVE to switch.
5271         (Target_i386::Scan::global): Likewise.
5272         (Target_i386::Relocate::relocate): Likewise.
5273         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5274         switch.
5275         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5276         (Target_x86_64::do_plt_section_for_global): New function.
5277         (Target_x86_64::do_plt_section_for_local): New function.
5278         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5279         parameter; change all callers.  If doing a static link define
5280         __rela_iplt_start and __rela_iplt_end.
5281         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5282         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5283         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5284         to point to .plt.
5285         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5286         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5287         switch.
5288         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5289         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5290         R_X86_64_IRELATIVE to switch.
5291         (Target_x86_64::Scan::global): Likewise.
5292         (Target_x86_64::Relocate::relocate): Likewise.
5293         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5294         switch.
5295         * target.h (class Target): Add plt_section_for_global and
5296         plt_section_for_local functions.  Add do_plt_section_for_global
5297         and do_plt_section_for_local virtual functions.
5298         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5299         clarifying comments.
5300         (Symbol::use_plt_offset): Handle IFUNC symbol.
5301         * object.cc (Sized_relobj::Sized_relobj): Initialize
5302         local_plt_offsets_.
5303         (Sized_relobj::local_has_plt_offset): New function.
5304         (Sized_relobj::local_plt_offset): New function.
5305         (Sized_relobj::set_local_plt_offset): New function.
5306         (Sized_relobj::do_count): Handle IFUNC symbol.
5307         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5308         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5309         is_ifunc_symbol functions.
5310         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5311         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5312         local_plt_offsets_ field.
5313         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5314         * output.h (class Output_section_data): Add non-const
5315         output_section function.
5316         (class Output_data_got): Update declarations.
5317         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5318         Add use_plt_offset parameter to global and local constructors.
5319         Change all callers.  Change local_sym_index_ field to 31 bits.
5320         Change GSYM_CODE and CONSTANT_CODE accordingly.
5321         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5322         doing a static link don't set sh_link field.
5323         (Output_data_got::Got_entry::write): Use PLT offset if
5324         appropriate.
5325         (Output_data_got::add_global_plt): New function.
5326         (Output_data_got::add_local_plt): New function.
5327         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5328         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5329         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5330         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5331         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5332         IFUNC conditional.
5333         * testsuite/ifunc-sel.h: New file.
5334         * testsuite/ifuncmain1.c: New file.
5335         * testsuite/ifuncmain1vis.c: New file.
5336         * testsuite/ifuncmod1.c: New file.
5337         * testsuite/ifuncdep2.c: New file.
5338         * testsuite/ifuncmain2.c: New file.
5339         * testsuite/ifuncmain3.c: New file.
5340         * testsuite/ifuncmod3.c: New file.
5341         * testsuite/ifuncmain4.c: New file.
5342         * testsuite/ifuncmain5.c: New file.
5343         * testsuite/ifuncmod5.c: New file.
5344         * testsuite/ifuncmain6pie.c: New file.
5345         * testsuite/ifuncmod6.c: New file.
5346         * testsuite/ifuncmain7.c: New file.
5347         * configure, testsuite/Makefile.in: Rebuild.
5348
5349 2010-08-18  Ian Lance Taylor  <iant@google.com>
5350
5351         * incremental.cc
5352         (Output_section_incremental_inputs::write_input_files): Add cast
5353         to avoid signed/unsigned comparison warning.
5354         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5355
5356 2010-08-12  Cary Coutant  <ccoutant@google.com>
5357
5358         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5359
5360 2010-08-13  Ian Lance Taylor  <iant@google.com>
5361
5362         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5363
5364 2010-08-12  Cary Coutant  <ccoutant@google.com>
5365             Doug Kwan  <dougkwan@google.com>
5366
5367         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5368         defintion overrides non-weak undef, remember that the original undef
5369         is not weak.
5370         * symtab.cc (Symbol_table::sized_write_global): For undef without
5371         an original weak binding, set binding to global in output.
5372         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5373         * testsuite/Makefile.in: Regenerate.
5374         * testsuite/strong_ref_weak_def.sh: New file.
5375         * testsuite/strong_ref_weak_def_1.c: Ditto.
5376         * testsuite/strong_ref_weak_def_2.c: Ditto.
5377
5378 2010-08-12  Cary Coutant  <ccoutant@google.com>
5379
5380         * testsuite/incremental_test.sh: Rewrite.
5381         * testsuite/incremental_test_1.c: Rewrite.
5382         * testsuite/incremental_test_2.c: Rewrite.
5383
5384 2010-08-12  Cary Coutant  <ccoutant@google.com>
5385
5386         * arm.cc (Target_arm::got_size): Add const.
5387         (Target_arm::got_entry_count): New function.
5388         (Target_arm::plt_entry_count): New function.
5389         (Target_arm::first_plt_entry_offset): New function.
5390         (Target_arm::plt_entry_size): New function.
5391         (Output_data_plt_arm::entry_count): New function.
5392         (Output_data_plt_arm::first_plt_entry_offset): New function.
5393         (Output_data_plt_arm::get_plt_entry_size): New function.
5394         * i386.cc (Target_i386::got_size): Add const.
5395         (Target_i386::got_entry_count): New function.
5396         (Target_i386::plt_entry_count): New function.
5397         (Target_i386::first_plt_entry_offset): New function.
5398         (Target_i386::plt_entry_size): New function.
5399         (Output_data_plt_i386::entry_count): New function.
5400         (Output_data_plt_i386::first_plt_entry_offset): New function.
5401         (Output_data_plt_i386::get_plt_entry_size): New function.
5402         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5403         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5404         * incremental.cc: Include target.h.
5405         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5406         parameter.  Adjust all callers.  Find incremental_got_plt section.
5407         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5408         section.
5409         (Output_section_incremental_inputs::set_final_data_size): Calculate
5410         size of incremental_got_plt section.
5411         (Output_section_incremental_inputs::do_write): Write the
5412         incremental_got_plt section.
5413         (Got_plt_view_info): New struct.
5414         (Local_got_offset_visitor): New class.
5415         (Global_got_offset_visitor): New class.
5416         (Global_symbol_visitor_got_plt): New class.
5417         (Output_section_incremental_inputs::write_got_plt): New function.
5418         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5419         Add parameter.  Adjust all callers.
5420         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5421         (Incremental_inputs::got_plt_section): New function.
5422         (Incremental_inputs::got_plt_section_): New data member.
5423         (Incremental_got_plt_reader): New class.
5424         * layout.cc (Layout::create_incremental_info_sections): Add the
5425         incremental_got_plt section.
5426         * object.h (Got_offset_list::get_list): New function.
5427         (Got offset_list::for_all_got_offsets): New function.
5428         (Sized_relobj::local_got_offset_list): New function.
5429         * powerpc.cc (Target_powerpc::got_size): Add const.
5430         (Target_powerpc::got_entry_count): New function.
5431         (Target_powerpc::plt_entry_count): New function.
5432         (Target_powerpc::first_plt_entry_offset): New function.
5433         (Target_powerpc::plt_entry_size): New function.
5434         (Output_data_plt_powerpc::entry_count): New function.
5435         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5436         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5437         * sparc.cc (Target_sparc::got_size): Add const.
5438         (Target_sparc::got_entry_count): New function.
5439         (Target_sparc::plt_entry_count): New function.
5440         (Target_sparc::first_plt_entry_offset): New function.
5441         (Target_sparc::plt_entry_size): New function.
5442         (Output_data_plt_sparc::entry_count): New function.
5443         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5444         (Output_data_plt_sparc::get_plt_entry_size): New function.
5445         * symtab.h (Symbol::got_offset_list): New function.
5446         (Symbol_table::for_all_symbols): New function.
5447         * target.h (Sized_target::got_entry_count): New function.
5448         (Sized_target::plt_entry_count): New function.
5449         (Sized_target::plt_entry_size): New function.
5450         * x86_64.cc (Target_x86_64::got_size): Add const.
5451         (Target_x86_64::got_entry_count): New function.
5452         (Target_x86_64::plt_entry_count): New function.
5453         (Target_x86_64::first_plt_entry_offset): New function.
5454         (Target_x86_64::plt_entry_size): New function.
5455         (Output_data_plt_x86_64::entry_count): New function.
5456         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5457         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5458
5459 2010-08-12  Cary Coutant  <ccoutant@google.com>
5460
5461         * archive.cc: Include incremental.h.
5462         (Archive::Archive): Initialize incremental_info_.
5463         (Archive::include_member): Record archive members in incremental info.
5464         (Add_archive_symbols::run): Record begin and end of an archive in
5465         incremental info.
5466         (Lib_group::include_member): Record objects in incremental info.
5467         * archive.h (Incremental_archive_entry): Forward declaration.
5468         (Archive::set_incremental_info): New member function.
5469         (Archive::incremental_info): New member function.
5470         (Archive::Unused_symbol_iterator): New class.
5471         (Archive::unused_symbols_begin): New member function.
5472         (Archive::unused_symbols_end): New member function.
5473         (Archive::incremental_info_): New data member.
5474         * incremental-dump.cc (find_input_containing_global): New function.
5475         (dump_incremental_inputs): Dump new incremental info sections.
5476         * incremental.cc: Include symtab.h.
5477         (Output_section_incremental_inputs): New class.
5478         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5479         new incremental info sections.
5480         (Sized_incremental_binary::do_check_inputs): Likewise.
5481         (Incremental_inputs::report_archive): Remove.
5482         (Incremental_inputs::report_archive_begin): New function.
5483         (Incremental_inputs::report_archive_end): New function.
5484         (Incremental_inputs::report_object): New function.
5485         (Incremental_inputs::finalize_inputs): Remove.
5486         (Incremental_inputs::report_input_section): New function.
5487         (Incremental_inputs::report_script): Rewrite.
5488         (Incremental_inputs::finalize): Do nothing but finalize string table.
5489         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5490         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5491         (Incremental_inputs::create_data_sections): New function.
5492         (Incremental_inputs::relocs_entsize): New function.
5493         (Output_section_incremental_inputs::set_final_data_size): New function.
5494         (Output_section_incremental_inputs::do_write): New function.
5495         (Output_section_incremental_inputs::write_header): New function.
5496         (Output_section_incremental_inputs::write_input_files): New function.
5497         (Output_section_incremental_inputs::write_info_blocks): New function.
5498         (Output_section_incremental_inputs::write_symtab): New function.
5499         * incremental.h (Incremental_script_entry): Forward declaration.
5500         (Incremental_object_entry): Forward declaration.
5501         (Incremental_archive_entry): Forward declaration.
5502         (Incremental_inputs): Forward declaration.
5503         (Incremental_inputs_header_data): Remove.
5504         (Incremental_inputs_header): Remove.
5505         (Incremental_inputs_header_write): Remove.
5506         (Incremental_inputs_entry_data): Remove.
5507         (Incremental_inputs_entry): Remove.
5508         (Incremental_inputs_entry_write): Remove.
5509         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5510         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5511         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5512         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5513         Likewise.
5514         (Incremental_input_entry): New class.
5515         (Incremental_script_entry): New class.
5516         (Incremental_object_entry): New class.
5517         (Incremental_archive_entry): New class.
5518         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5519         (Incremental_inputs::report_inputs): Remove.
5520         (Incremental_inputs::report_archive): Remove.
5521         (Incremental_inputs::report_archive_begin): New function.
5522         (Incremental_inputs::report_archive_end): New function.
5523         (Incremental_inputs::report_object): Change prototype.
5524         (Incremental_inputs::report_input_section): New function.
5525         (Incremental_inputs::report_script): Change prototype.
5526         (Incremental_inputs::get_reloc_count): New function.
5527         (Incremental_inputs::set_reloc_count): New function.
5528         (Incremental_inputs::create_data_sections): New function.
5529         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5530         (Incremental_inputs::inputs_section): New function.
5531         (Incremental_inputs::symtab_section): New function.
5532         (Incremental_inputs::relocs_section): New function.
5533         (Incremental_inputs::get_stringpool): Add const.
5534         (Incremental_inputs::command_line): Add const.
5535         (Incremental_inputs::inputs): Remove.
5536         (Incremental_inputs::command_line_key): New function.
5537         (Incremental_inputs::input_file_count): New function.
5538         (Incremental_inputs::input_files): New function.
5539         (Incremental_inputs::relocs_entsize): New function.
5540         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5541         (Incremental_inputs::finalize_inputs): Remove.
5542         (Incremental_inputs::Input_info): Remove.
5543         (Incremental_inputs::lock_): Remove.
5544         (Incremental_inputs::inputs_): Change type.
5545         (Incremental_inputs::inputs_map_): Remove.
5546         (Incremental_inputs::current_object_entry_): New data member.
5547         (Incremental_inputs::inputs_section_): New data member.
5548         (Incremental_inputs::symtab_section_): New data member.
5549         (Incremental_inputs::relocs_section_): New data member.
5550         (Incremental_inputs::reloc_count_): New data member.
5551         (Incremental_inputs_reader): New class.
5552         (Incremental_symtab_reader): New class.
5553         (Incremental_relocs_reader): New class.
5554         * layout.cc (Layout::finalize): Move finalization of incremental info
5555         and creation of incremental info sections to follow finalization of
5556         symbol table.  Set offsets for postprocessing sections.
5557         (Layout::create_incremental_info_sections): Call
5558         Incremental_inputs::create_data_sections.  Add incremental symtab
5559         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5560         sections to layout after input sections.
5561         * layout.h (struct Timespec): Forward declaration.
5562         (Layout::incremental_inputs): Add const.
5563         (Layout::create_incremental_info_sections): Add parameter.
5564         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5565         * object.cc: Include incremental.h.
5566         (Relobj::finalize_incremental_relocs): New function.
5567         (Sized_relobj::do_layout): Record input sections in incremental info.
5568         * object.h (Object::output_section): New function.
5569         (Object::output_section_offset): Moved from Relobj.
5570         (Object::get_incremental_reloc_base): New function.
5571         (Object::get_incremental_reloc_count): New function.
5572         (Object::do_output_section): New function.
5573         (Object::do_output_section_offset): Moved from Relobj.
5574         (Object::do_get_incremental_reloc_base): New function.
5575         (Object::do_get_incremental_reloc_count): New function.
5576         (Object::Object): Initialize new data members.
5577         (Relobj::output_section): Renamed do_output_section and moved to
5578         protected.
5579         (Relobj::output_section_offset): Moved to Object.
5580         (Relobj::do_get_incremental_reloc_base): New function.
5581         (Relobj::do_get_incremental_reloc_count): New function.
5582         (Relobj::allocate_incremental_reloc_counts): New function.
5583         (Relobj::count_incremental_reloc): New function.
5584         (Relobj::finalize_incremental_relocs): New function.
5585         (Relobj::next_incremental_reloc_index): New function.
5586         (Relobj::reloc_counts_): New data member.
5587         (Relobj::reloc_bases_): New data member.
5588         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5589         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5590         (Sized_relobj::incremental_relocs_scan): New function.
5591         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5592         (Sized_relobj::incremental_relocs_write): New function.
5593         (Sized_relobj::incremental_relocs_write_reltype): New function.
5594         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5595         incremental link.
5596         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5597         archives and object files elsewhere.
5598         (Add_symbols::run): Report object files here.
5599         (Finish_group::run): Report end of archive at end of group.
5600         * reloc.cc: Include layout.h, incremental.h.
5601         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5602         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5603         (Sized_relobj::incremental_relocs_scan): New function.
5604         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5605         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5606         (Sized_relobj::incremental_relocs_write): New function.
5607         (Sized_relobj::incremental_relocs_write_reltype): New function.
5608         * script.cc (read_input_script): Rewrite test for incremental link.
5609         Change call to Incremental_inputs::report_script.
5610         * symtab.h (Symbol_table::first_global_index): New function.
5611         (Symbol_table::output_count): New function.
5612
5613 2010-08-12  Doug Kwan  <dougkwan@google.com>
5614
5615         * arm.cc (Target_arm::merge_object_attributes): Check command line
5616         options --no-wchar-size-warning and --no-enum-size-warning.
5617         * options.h (General_options): Add ld-compatible options
5618         --no-enum-size-warning and --no-wchar-size-warning.
5619
5620 2010-08-04  Ian Lance Taylor  <iant@google.com>
5621
5622         * x86_64.cc (Target_x86_64::Scan::local): Use
5623         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5624         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5625         (Target_x86_64::Scan::global): Likewise.
5626         (Target_x86_64::Relocate::relocate): Likewise.
5627         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5628         Likewise.
5629
5630 2010-08-03  Cary Coutant  <ccoutant@google.com>
5631
5632         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5633         to reserve space in merged_strings vector. Keep total input size
5634         for stats.
5635         (Output_merge_string::do_print_merge_stats): Print total input size.
5636         * merge.h (Output_merge_string): Add input_size_ field.
5637         * stringpool.cc (Stringpool_template::string_length): Move
5638         implementations out of Stringpool_template class and place in
5639         stringpool.h.
5640         * stringpool.h (string_length): Move out of Stringpool_template.
5641
5642 2010-08-03  Ian Lance Taylor  <iant@google.com>
5643
5644         PR 11712
5645         * layout.cc (relaxation_loop_body): If address of load segment is
5646         set, adjust address to include headers if possible.
5647
5648 2010-08-03  Ian Lance Taylor  <iant@google.com>
5649
5650         * version.cc (version_string): Bump to 1.10.
5651
5652 2010-08-03  Ian Lance Taylor  <iant@google.com>
5653
5654         PR 11805
5655         * layout.h (enum Output_section_order): Define.
5656         (class Layout): Update declarations.
5657         * layout.cc (Layout::get_output_section): Add order parameter.
5658         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5659         is_first_non_relro parameters.  Change all callers.
5660         (Layout::choose_output_section): Likewise.
5661         (Layout::add_output_section_data): Likewise.
5662         (Layout::make_output_section): Likewise.  Set order.
5663         (Layout::default_section_order): New function.
5664         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5665         * output.cc (Output_section::Output_section): Initialize order_.
5666         Don't initialize deleted fields.
5667         (Output_segment::Output_segment): Don't initialize deleted
5668         fields.
5669         (Output_segment::add_output_section_to_load): New function
5670         replacing add_output_section.  Change all callers to call this or
5671         add_output_section_to_nonload.
5672         (Output_segment::add_output_section_to_nonload): New function.
5673         (Output_segment::remove_output_section): Rewrite.
5674         (Output_segment::add_initial_output_data): Likewise.
5675         (Output_segment::has_any_data_sections): Likewise.
5676         (Output_segment::is_first_section_relro): Likewise.
5677         (Output_segment::maximum_alignment): Likewise.
5678         (Output_segment::has_dynamic_reloc): New function replacing
5679         dynamic_reloc_count.  Change all callers.
5680         (Output_segment::has_dynamic_reloc_list): New function replacing
5681         dynamic_reloc_count_list.  Change all callers.
5682         (Output_segment::set_section_addresses): Rewrite.
5683         (Output_segment::set_offset): Rewrite.
5684         (Output_segment::find_first_and_last_list): Remove.
5685         (Output_segment::set_tls_offsets): Rewrite.
5686         (Output_segment::first_section_load_address): Likewise.
5687         (Output_segment::output_section_count): Likewise.
5688         (Output_segment::section_with_lowest_load_address): Likewise.
5689         (Output_segment::write_section_headers): Likewise.
5690         (Output_segment::print_sections_to_map): Likewise.
5691         * output.h (class Output_data): Remove dynamic_reloc_count_
5692         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5693         (Output_data::add_dynamic_reloc): Rewrite.
5694         (Output_data::has_dynamic_reloc): New function.
5695         (Output_data::dynamic_reloc_count): Remove.
5696         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5697         is_last_relro_, is_first_non_relro_, is_interp_,
5698         is_dynamic_linker_section_ fields.  Add order and set_order
5699         functions.  Remove is_relro_local, set_is_relro_local,
5700         is_last_relro, set_is_last_relro, is_first_non_relro,
5701         set_is_first_non_relro functions, is_interp, set_is_interp,
5702         is_dynamic_linker_section, and set_is_dynamic_linker_section
5703         functions.
5704         (class Output_segment): Change Output_data_list from std::list to
5705         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5706         output_bss_ fields.  Update declarations.
5707
5708 2010-08-02  Ian Lance Taylor  <iant@google.com>
5709
5710         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5711         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5712         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5713
5714 2010-08-02  Ian Lance Taylor  <iant@google.com>
5715
5716         PR 11855
5717         * script.cc (Script_options::Script_options): Initialize
5718         symbol_definitions_ and symbol_references_.
5719         (Script_options::add_symbol_assignment): Update
5720         symbol_definitions_ and symbol_references_.
5721         (Script_options::add_symbol_reference): New function.
5722         (script_symbol): New function.
5723         * script.h (class Script_options): Add symbol_definitions_ and
5724         symbol_references_ fields.
5725         (Script_options::referenced_const_iterator): New type.
5726         (Script_options::referenced_begin): New function.
5727         (Script_options::referenced_end): New function.
5728         (Script_options::is_referenced): New function.
5729         (Script_options::any_unreferenced): New function.
5730         * script-c.h (script_symbol): Declare.
5731         * yyscript.y (exp): Call script_symbol.
5732         * symtab.cc: Include "script.h".
5733         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5734         Change all callers.  Check symbols referenced by scripts.
5735         (Symbol_table::add_undefined_symbols_from_command_line): Add
5736         layout parameter.  Change all callers.
5737         (Symbol_table::do_add_undefined_symbols_from_command_line):
5738         Likewise.  Break out loop body.  Check symbols referenced by
5739         scripts.
5740         (Symbol_table::add_undefined_symbol_from_command_line): New
5741         function broken out of
5742         do_add_undefined_symbols_from_command_line.
5743         * symtab.h (class Symbol_table): Update declarations.
5744         * archive.cc: Include "layout.h".
5745         (Archive::should_include_member): Add layout parameter.  Change
5746         all callers.  Check for symbol mentioned in expression.
5747         * archive.h (class Archive): Update declaration.
5748         * object.cc (Sized_relobj::do_should_include_member): Add layout
5749         parameter.
5750         * object.h (Object::should_include_member): Add layout parameter.
5751         Change all callers.
5752         (Object::do_should_include_member): Add layout parameter.
5753         (class Sized_relobj): Update declaration.
5754         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5755         parameter.
5756         * dynobj.h (class Sized_dynobj): Update declaration.
5757         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5758         layout parameter.
5759         * plugin.h (class Sized_pluginobj): Update declaration.
5760
5761 2010-08-02  Ian Lance Taylor  <iant@google.com>
5762
5763         PR 11866
5764         * output.cc (Output_segment::set_offset): Search for the first and
5765         last sections rather than assuming that the list is in order.
5766         (Output_segment::find_first_and_last_list): New function.
5767         * output.h (class Output_segment): Update declarations.
5768         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5769         (relro_strip_test_SOURCES): New variable.
5770         (relro_strip_test_DEPENDENCIES): New variable.
5771         (relro_strip_test_LDFLAGS): New variable.
5772         (relro_strip_test_LDADD): New variable.
5773         (relro_strip_test.so): New target.
5774
5775 2010-08-02  Ian Lance Taylor  <iant@google.com>
5776
5777         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5778         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5779         (Target_i386::got_tlsdesc_section): New function.
5780         (Target_i386::got_section): Create space for GOT entries for
5781         TLSDESC relocations.
5782         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5783         R_386_TLS_GOTDESC.
5784         (Target_i386::Scan::global): Likewise.
5785         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5786         using TLSDESC GOT.
5787         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5788         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5789         (Target_x86_64::got_tlsdesc_section): New function.
5790         (Target_x86_64::got_section): Create space for GOT entries for
5791         TLSDESC relocations.
5792         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5793         R_386_TLS_GOTDESC.
5794         (Target_x86_64::Scan::global): Likewise.
5795         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5796         using TLSDESC GOT.
5797
5798 2010-08-02  Ian Lance Taylor  <iant@google.com>
5799
5800         * testsuite/final_layout.sh: Use dc to convert from hex to
5801         decimal.
5802
5803 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5804
5805         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5806         paramter to the call to gold::gc_process_relocs.
5807         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5808         paramter to the call to gold::gc_process_relocs.
5809         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5810         parameter to the call to gold::gc_process_relocs.
5811         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5812         template parameter to the call to gold::gc_process_relocs.
5813         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5814         paramter to the call to gold::gc_process_relocs.
5815         * gc.h (get_embedded_addend_size): New function.
5816         (gc_process_relocs): Save the size of the reloc for use by ICF.
5817         * icf.cc (get_section_contents): Get the addend from the text section
5818         for SHT_REL relocation sections.
5819         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5820         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5821         * int_encoding.h (read_from_pointer): New overloaded function.
5822         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5823         * testsuite/icf_sht_rel_addend_test.sh: New file.
5824         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5825         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5826
5827 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5828
5829         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5830         * Makefile.in: Regenerate.
5831         * testsuite/Makefile.in: Regenerate.
5832
5833 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5834
5835         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5836         * gold/testsuite/debug_msg.cc: Likewise.
5837         * gold/testsuite/odr_violation1.cc
5838         * gold/testsuite/odr_violation2.cc
5839
5840 2010-07-21  Cary Coutant  <ccoutant@google.com>
5841
5842         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5843         string, and length fields.
5844         (Output_merge_string::Merged_strings_list): New type.
5845         (Output_merge_string::Merged_strings_lists): New typedef.
5846         (Output_merge_string): Replace merged_strings_ with
5847         merged_strings_lists_.
5848         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5849         Merged_strings_list per input object and section.  Don't store pointer
5850         to the string.  Don't store length with each merged string entry.
5851         (Output_merge_string::finalize_merged_data): Loop over list of merged
5852         strings lists.  Recompute length of each merged string.
5853
5854 2010-07-15  Cary Coutant  <ccoutant@google.com>
5855
5856         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5857         here.
5858
5859 2010-07-14  Ian Lance Taylor  <iant@google.com>
5860
5861         * descriptors.cc (Descriptors::open): Report correct name in error
5862         message.
5863
5864 2010-07-13  Doug Kwan  <dougkwan@google.com>
5865
5866         * arm.cc (Arm_input_section::Arm_input_section): For a
5867         SHT_ARM_EXIDX section, always keeps the input sections.
5868         (Arm_input_section::set_exidx_section_link): New method.
5869         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5870         has_errors_ to false.
5871         (Arm_exidx_input_section::has_errors,
5872         Arm_exidx_input_section::set_has_errors): New methods.
5873         (Arm_exidx_input_section::has_errors_): New data member.
5874         (Arm_relobj::get_exidx_shndx_list): New method.
5875         (Arm_output_section::append_text_sections_to_list): Do not skip
5876         section without SHF_EXECINSTR.
5877         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5878         errors.
5879         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5880         section header.  Make error messages more verbose.  Check for
5881         a non-executable section linked to an EXIDX section.
5882         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5883         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5884         check that there is no deferred EXIDX section if we exit early.
5885         Instead of not making an EXIDX section in case of an error, make one
5886         and set the has_errors flag of it.
5887         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5888         in a relocatable link.
5889         (Target_arm::do_relax): Look for the EXIDX output section instead of
5890         assuming that it is called .ARM.exidx.
5891         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5892         section list.  Do not check for SHF_EXECINSTR section flags but
5893         skip any input section with errors.
5894         * output.cc (Output_section::Output_section): Initialize
5895         always_keeps_input_sections_ to false.
5896         (Output_section::add_input_section): Check for
5897         always_keeps_input_sections_.
5898         *  output.h (Output_section::always_keeps_input_sections,
5899         Output_section::set_always_keeps_input_sections): New methods.
5900         (Output_section::always_keeps_input_sections): New data member.
5901
5902 2010-07-13  Rafael Espindola  <espindola@google.com>
5903
5904         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5905         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5906
5907 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5908             Ian Lance Taylor  <iant@google.com>
5909
5910         * output.h (Output_section_lookup_maps::add_merge_section):
5911         Correct check of whether value was inserted.
5912         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5913         (Output_section_lookup_maps::add_relaxed_input_section):
5914         Likewise.
5915         * arm.cc (Target_arm::got_section): Remove used local os.
5916         * i386.cc (Target_i386::got_section): Likewise.
5917         * x86_64.cc (Target_x86_64::got_section): Likewise.
5918         * sparc.cc (Target_sparc::got_section): Likewise.
5919         (Target_sparc::relocate): Remove unused local have_got_offset.
5920         * powerpc.cc (Target_powerpc::relocate): Likewise.
5921
5922 2010-07-13  Ian Lance Taylor  <iant@google.com>
5923
5924         * compressed_output.cc (zlib_decompress): Fix signature in
5925         !HAVE_ZLIB_H case.
5926
5927         * archive.cc (Archive::include_member): Unlock an external member
5928         of a thin archive.  Don't bother to delete an object we know is
5929         NULL.
5930
5931 2010-07-12  Cary Coutant  <ccoutant@google.com>
5932
5933         * compressed_output.cc (zlib_decompress): New function.
5934         (get_uncompressed_size): New function.
5935         (decompress_input_section): New function.
5936         * compressed_output.h (get_uncompressed_size): New function.
5937         (decompress_input_section): New function.
5938         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5939         Handle compressed debug sections.
5940         * layout.cc (is_compressed_debug_section): New function.
5941         (Layout::output_section_name): Map compressed section names to
5942         canonical names.
5943         * layout.h (is_compressed_debug_section): New function.
5944         (is_debug_info_section): Recognize compressed debug sections.
5945         * merge.cc: Include compressed_output.h.
5946         (Output_merge_data::do_add_input_section): Handle compressed
5947         debug sections.
5948         (Output_merge_string::do_add_input_section): Handle compressed
5949         debug sections.
5950         * object.cc: Include compressed_output.h.
5951         (Sized_relobj::Sized_relobj): Initialize new data members.
5952         (build_compressed_section_map): New function.
5953         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5954         * object.h (Object::section_is_compressed): New method.
5955         (Object::do_section_is_compressed): New method.
5956         (Sized_relobj::Compressed_section_map): New type.
5957         (Sized_relobj::do_section_is_compressed): New method.
5958         (Sized_relobj::compressed_sections_): New data member.
5959         * output.cc (Output_section::add_input_section): Handle compressed
5960         debug sections.
5961         * reloc.cc: Include compressed_output.h.
5962         (Sized_relobj::write_sections): Handle compressed debug sections.
5963
5964 2010-07-08  Cary Coutant  <ccoutant@google.com>
5965
5966         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5967         weak when resolving to a dynamic def.
5968         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5969         for weak undef/dynamic def cases. Adjust callers.
5970         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5971         undef_binding_weak_.
5972         (Symbol_table::sized_write_globals): Adjust symbol binding.
5973         (Symbol_table::sized_write_symbol): Add binding parameter.
5974         * symtab.h (Symbol::set_undef_binding): New method.
5975         (Symbol::is_undef_binding_weak): New method.
5976         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5977         (Symbol_table::should_override): Add new parameter.
5978         (Symbol_table::sized_write_symbol): Add new parameter.
5979
5980         * testsuite/weak_undef_file1.cc: Add new test case.
5981         * testsuite/weak_undef_file2.cc: Fix header comment.
5982         * testsuite/weak_undef_test.cc: Add new test case.
5983
5984 2010-06-29  Doug Kwan  <dougkwan@google.com>
5985
5986         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5987         Initialize USE_SYMBOL_.
5988         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5989         definition.
5990         (Arm_reloc_property::uses_symbol_): New data member declaration.
5991         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5992         uses symbol value and symbol is undefined but not weakly undefined.
5993
5994 2010-06-28  Rafael Espindola  <espindola@google.com>
5995
5996         * plugin.cc (Plugin::load): Use dlerror.
5997
5998 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5999
6000         * symtab.cc (detect_odr_violations): When reporting an ODR
6001         violation, report an object where the symbol is defined.
6002
6003 2010-06-25  Doug Kwan  <dougkwan@google.com>
6004
6005         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6006         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6007         definition.
6008         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6009         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6010         target hook to detect function points.
6011         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6012         * icf.h (Icf::check_section_for_function_pointers): Change type of
6013         parameter SECTION_NAME to const reference to std::string.  Use
6014         target hook to determine if section may have unsafe pointers.
6015         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6016         method definition.
6017
6018 2010-06-21  Rafael Espindola  <espindola@google.com>
6019
6020         * fileread.cc (Input_file::find_fie): New
6021         (Input_file::open): Use Input_file::find_fie.
6022         * fileread.h (Input_file::find_fie): New
6023         * plugin.cc (set_extra_library_path): New.
6024         (Plugin::load): Add set_extra_library_path to the transfer vector.
6025         (Plugin_manager::set_extra_library_path): New.
6026         (Plugin_manager::add_input_file): Use the extra search path if set.
6027         (set_extra_library_path(): New.
6028         * plugin.h (Plugin_manager): Add set_extra_library_path and
6029         extra_search_path_.
6030
6031 2010-06-19  Cary Coutant  <ccoutant@google.com>
6032
6033         * layout.cc (gdb_sections): Add .debug_types.
6034         (lines_only_debug_sections): Likewise.
6035
6036 2010-06-18  Rafael Espindola  <espindola@google.com>
6037
6038         * plugin.cc (add_input_file,add_input_library)
6039         (Plugin_manager::add_input_file): Make filename arguments const.
6040         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6041         const.
6042
6043 2010-06-16  Doug Kwan  <dougkwan@google.com>
6044
6045         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6046         .ARM.attributes section if we have not merged any input
6047         attributes sections.
6048
6049 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6050
6051         * arm.cc: Allow combining objects with no EABI version
6052         information.
6053
6054 2010-06-15  Rafael Espindola  <espindola@google.com>
6055
6056         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6057
6058 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6059
6060         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6061         (struct iovec): Correct !HAVE_READV definition.
6062
6063 2010-06-10  Cary Coutant  <ccoutant@google.com>
6064
6065         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6066         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6067         reloc sections.
6068         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6069
6070         PR 11683
6071         * symtab.h (Symbol::is_placeholder): New member function.
6072         * target-reloc.h (relocate_section): Check for placeholder symbols.
6073
6074         * testsuite/Makefile.am (plugin_test_8): New test.
6075         (plugin_test_9): New test.
6076         * testsuite/Makefile.in: Regenerate.
6077
6078 2010-06-09  Nick Clifton  <nickc@redhat.com>
6079
6080         * yyscript.y (input_list_element): Allow strings prefixed with
6081         the '-' character.  Treat these as libraries.
6082         * script.cc (script_add_library): New function.  Adds a library
6083         specified by "-l<name>" found in an input script.
6084         * script-c.h: Add prototype for script_add_library.
6085
6086 2010-06-07  Doug Kwan  <dougkwan@google.com>
6087
6088         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6089         Restrict stub-group size to be within long conditional branch
6090         range when working around cortex-A8 erratum.
6091
6092 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6093
6094         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6095         #ifdef typo.
6096
6097 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6098
6099         PR gold/11658
6100         * output.cc
6101         (Output_section::Input_section_sort_entry::compare_section_ordering):
6102         Change to return non-zero correctly.
6103         (Output_section::Input_section_sort_section_order_index_compare
6104         ::operator()): Change to fix ambiguity in comparisons.
6105
6106 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6107
6108         * gold.h (is_wildcard_string): New function.
6109         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6110         (Layout::layout_eh_frame): Ditto.
6111         (Layout::find_section_order_index): New method.
6112         (Layout::read_layout_from_file): New method.
6113         * layout.h (Layout::find_section_order_index): New method.
6114         (Layout::read_layout_from_file): New method.
6115         (Layout::input_section_position_): New private member.
6116         (Layout::input_section_glob_): New private member.
6117         * main.cc (main): Call read_layout_from_file here.
6118         * options.h (--section-ordering-file): New option.
6119         * output.cc (Output_section::input_section_order_specified_): New
6120         member.
6121         (Output_section::Output_section): Initialize new member.
6122         (Output_section::add_input_section): Add new parameter.
6123         Keep input sections when --section-ordering-file is used.
6124         (Output_section::set_final_data_size): Sort input sections when
6125         section ordering file is specified.
6126         (Output_section::Input_section_sort_entry): Add new parameter.
6127         Check sorting type.
6128         (Output_section::Input_section_sort_entry::compare_section_ordering):
6129         New method.
6130         (Output_section::Input_section_sort_compare::operator()): Change to
6131         consider section_order_index.
6132         (Output_section::Input_section_sort_init_fini_compare::operator()):
6133         Change to consider section_order_index.
6134         (Output_section::Input_section_sort_section_order_index_compare
6135         ::operator()): New method.
6136         (Output_section::sort_attached_input_sections): Change to sort
6137         according to section order when specified.
6138         (Output_section::add_input_section<32, true>): Add new parameter.
6139         (Output_section::add_input_section<64, true>): Add new parameter.
6140         (Output_section::add_input_section<32, false>): Add new parameter.
6141         (Output_section::add_input_section<64, false>): Add new parameter.
6142         * output.h (Output_section::add_input_section): Add new parameter.
6143         (Output_section::input_section_order_specified): New
6144         method.
6145         (Output_section::set_input_section_order_specified): New method.
6146         (Input_section::Input_section): Initialize section_order_index_.
6147         (Input_section::section_order_index): New method.
6148         (Input_section::set_section_order_index): New method.
6149         (Input_section::section_order_index_): New member.
6150         (Input_section::Input_section_sort_section_order_index_compare): New
6151         struct.
6152         (Output_section::input_section_order_specified_): New member.
6153         * script-sections.cc (is_wildcard_string): Delete and move modified
6154         method to gold.h.
6155         (Output_section_element_input::Output_section_element_input): Modify
6156         call to is_wildcard_string.
6157         (Output_section_element_input::Input_section_pattern
6158         ::Input_section_pattern): Ditto.
6159         (Output_section_element_input::Output_section_element_input): Ditto.
6160         * testsuite/Makefile.am (final_layout): New test case.
6161         * testsuite/Makefile.in: Regenerate.
6162         * testsuite/final_layout.cc: New file.
6163         * testsuite/final_layout.sh: New file.
6164
6165 2010-06-01  Rafael Espindola  <espindola@google.com>
6166
6167         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6168
6169 2010-06-01  Rafael Espindola  <espindola@google.com>
6170
6171         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6172         visibility of symbols.
6173
6174 2010-05-27  Doug Kwan  <dougkwan@google.com>
6175
6176         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6177         from start of output section instead of address for a local symbol
6178         in a merged or relaxed section when doing a relocatable link.
6179
6180 2010-05-26  Rafael Espindola  <espindola@google.com>
6181
6182         PR 11604
6183         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6184         adding sections the garbage collector removed.
6185         * gold/testsuite/Makefile.am: Add test.
6186         * gold/testsuite/Makefile.in: Regenerate.
6187         * gold/testsuite/plugin_test_7.sh: New.
6188         * gold/testsuite/plugin_test_7_1.c: New.
6189         * gold/testsuite/plugin_test_7_2.c: New.
6190
6191 2010-05-26  Rafael Espindola  <espindola@google.com>
6192
6193         * script-sections.cc (Output_section_definition::set_section_addresses):
6194         Check for --section-start.
6195
6196 2010-05-26  Doug Kwan  <dougkwan@google.com>
6197
6198         * arm.cc (Arm_scan_relocatable_relocs): New class.
6199         (Target_arm::relocate_special_relocatable): New method.
6200         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6201         (Arm_relocate_functions::thumb_branch_common): Same.
6202         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6203         instead of Default_scan_relocatable_relocs.
6204         * target-reloc.h (relocate_for_relocatable): Let target handle
6205         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6206         * target.h (Sized_target::relocate_special_relocatable): New method.
6207
6208 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6209
6210         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6211
6212 2010-05-23  Doug Kwan  <dougkwan@google.com>
6213
6214         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6215         instead of a cast.
6216         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6217         with a direct branch, not a conditional branch, to a stub.
6218         * merge.cc (Output_merge_base::record_input_section): New method
6219         defintion.
6220         (Output_merge_data::do_add_input_section): Record input section if
6221         keeps-input-sections flag is set.
6222         (Output_merge_string::do_add_input_section): Ditto.
6223         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6224         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6225         INPUT_SECTIONS_.
6226         (Output_merge_base::keeps_input_sections,
6227         Output_merge_base::set_keeps_input_sections,
6228         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6229         method definitions.
6230         (Output_merge_base::Input_sections): New type declaration.
6231         (Output_merge_base::input_sections_begin,
6232         Output_merge_base::input_sections_end,
6233         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6234         (Output_merge_base::bool keeps_input_sections_,
6235         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6236         Output_merge_base::input_sections_): New data members.
6237         (Output_merge_data::do_set_keeps_input_sections): New method
6238         defintion.
6239         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6240         * output.cc (Output_section::Input_section::relobj): Move method
6241         defintion from class declaration to here and handle merge sections.
6242         (Output_section::Input_section::shndx): Ditto.
6243         (Output_section::Output_section): Remove initializations of removed
6244         data members and initialize new data member LOOKUP_MAPS_.
6245         (Output_section::add_input_section): Set keeps-input-sections flag
6246         for a newly created merge output section as appropriate.  Adjust code
6247         to use Output_section_lookup_maps class.
6248         (Output_section::add_relaxed_input_section): Adjst code for lookup
6249         maps code refactoring.
6250         (Output_section::add_merge_input_section): Add a new parameter
6251         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6252         class.  If adding input section to a newly created merge output
6253         section fails, remove the new merge section.
6254         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6255         Adjust code for use of the Output_section_lookup_maps class.
6256         (Output_section::find_merge_section): Ditto.
6257         (Output_section::build_lookup_maps): New method defintion.
6258         (Output_section::find_relaxed_input_section): Adjust code to use
6259         Output_section_lookup_maps class.
6260         (Output_section::get_input_sections): Export merge sections.  Adjust
6261         code to use Output_section_lookup_maps class.
6262         (Output_section:::add_script_input_section): Adjust code to use
6263         Output_section_lookup_maps class.  Update lookup maps for merge
6264         sections also.
6265         (Output_section::discard_states): Use Output_section_lookup_maps.
6266         (Output_section::restore_states): Same.
6267         * output.h (Merge_section_properties): Move class defintion out of
6268         Output_section.
6269         (Output_section_lookup_maps): New class.
6270         (Output_section::Input_section::is_merge_section): New method
6271         defintion.
6272         (Output_section::Input_section::relobj): Move defintion out of class
6273         defintion.  Declare method only.
6274         (Output_section::Input_section::shndx): Ditto.
6275         (Output_section::Input_section::output_merge_base): New method defintion.
6276         (Output_section::Input_section::u2_.pomb): New union field.
6277         (Output_section::Merge_section_by_properties_map,
6278         Output_section::Output_section_data_by_input_section_map,
6279         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6280         Remove types.
6281         (Output_section::add_merge_input_section): Add new parameter
6282         KEEPS_INPUT_SECTIONS.
6283         (Output_section::build_lookup_maps): New method declaration.
6284         (Output_section::merge_section_map_,
6285         Output_section::merge_section_by_properties_map_,
6286         Output_section::relaxed_input_section_map_,
6287         Output_section::is_relaxed_input_section_map_valid_): Remove data
6288         members.
6289         (Output_section::lookup_maps_): New data member.
6290
6291 2010-05-21  Doug Kwan  <dougkwan@google.com>
6292
6293         PR gold/11619
6294         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6295         avoid a compilation error.
6296
6297 2010-05-19  Rafael Espindola  <espindola@google.com>
6298
6299         * script-sections.cc (Output_section_definition::allocate_to_segment):
6300         Update the phdrs_list even when the output section is NULL.
6301         * testsuite/Makefile.am: Add test.
6302         * testsuite/Makefile.in: Regenerate.
6303         * testsuite/script_test_9.cc: New.
6304         * testsuite/script_test_9.sh: New.
6305         * testsuite/script_test_9.t: New.
6306
6307 2010-05-19  Doug Kwan  <dougkwan@google.com>
6308
6309         * arm.cc (Arm_input_section::original_size): New method.
6310         (Arm_input_section::do_addralign): Add a cast.
6311         (Arm_input_section::do_output_offset): Remove static cast.
6312         (Arm_input_section::original_addralign,
6313          Arm_input_section::original_size_): Change type to uint32_t.
6314         (Arm_input_section::init): Add safe casts for section alignment
6315         and size.
6316         (Arm_input_section::set_final_data_size): Do not set address and
6317         offset of stub table.
6318         (Arm_output_section::fix_exidx_coverage): Change use of of
6319         Output_section::Simple_input_section to that of
6320         Output_section::Input_section.
6321         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6322         except for the first pass.
6323         * output.cc (Output_section::get_input_sections): Change type of
6324         input_sections to std::list<Input_section>.
6325         (Output_section::add_script_input_section): Rename from
6326         Output_section::add_simple_input_section.  Change type of SIS
6327         parameter from Simple_input_section to Input_section.
6328         * output.h (Output_section::Simple_input_section): Remove class.
6329         (Output_section::Input_section): Change class visibility to public.
6330         (Output_section::Input_section::addralign): Use stored alignments
6331         for special input sections if set.
6332         (Output_section::Input_section::set_addralign): New method.
6333         (Output_section::get_input_sections): Change parameter type from
6334         list of Simple_input_section to list of Input_section.
6335         (Output_section::add_script_input_section): Rename from
6336         Output_section::add_simple_input_section. Change first parameter's
6337         type from Simple_input_section to Input_section and remove the
6338         second and third parameters.
6339         * script-sections.cc (Input_section::Input_section_list): Change
6340         type to list of Output_section::Input_section/
6341         (Input_section_info::Input_section_info): Change parameter type of
6342         INPUT_SECTION to Output_section::Input_section.
6343         (Input_section_info::input_section): Change return type.
6344         (Input_section_info::input_section_): Change type to
6345         Output_section::Input_section.
6346         (Output_section_element_input::set_section_addresses): Adjust code
6347         to use Output_section::Input_section instead of
6348         Output_section::Simple_input_section.  Adjust code for renaming
6349         of Output_section::add_simple_input_section.
6350         (Orphan_output_section::set_section_addresses): Ditto.
6351
6352 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6353
6354         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6355         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6356
6357 2010-05-18  Rafael Espindola  <espindola@google.com>
6358
6359         * options.cc (General_options::finalize): Handle -nostdlib.
6360         * options.h (nostdlib): New option.
6361         * script.cc (script_add_search_dir): Handle -nostdlib.
6362
6363 2010-05-12  Doug Kwan  <dougkwan@google.com>
6364
6365         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6366         attributes section only if there no attributes section after merging.
6367         (Target_arm::merge_object_attributes): Move value of
6368         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6369         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6370         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6371         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6372         and arm_attr_merge_7.stdout.
6373         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6374         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6375         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6376         arm_attr_merge_7b.o): New rules.
6377         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6378         arm_attr_merge_7
6379         * testsuite/Makefile.in: Regenerate.
6380         * testsuite/arm_attr_merge.sh: New file.
6381         * testsuite/arm_attr_merge_[67][ab].s: Same.
6382
6383 2010-05-05  Nick Clifton  <nickc@redhat.com>
6384
6385         * po/es.po: Updated Spanish translation.
6386
6387 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6388
6389         * Makefile.am (install-exec-local): Properly install gold as
6390         default cross linker.
6391         * Makefile.in: Regenerated.
6392
6393 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6394             Nick Clifton  <nickc@redhat.com>
6395
6396         * configure.ac (install_as_default): Define and set to false
6397         unless --enable-gold or --enable-gold=both/gold has been
6398         specified.
6399         * configure: Regenerate.
6400
6401         * Makefile.am (install-exec-local): Install the executable as
6402         'ld.gold'.  If install_as_default is true then also install it as
6403         'ld'.
6404         * Makefile.in: Regenerated.
6405
6406 2010-04-24  Ian Lance Taylor  <iant@google.com>
6407
6408         * layout.cc (Layout::layout_reloc): In relocatable link don't
6409         combine reloc sections for grouped sections.
6410
6411 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6412
6413         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6414         sections that are not ordinary to icf.
6415         * icf.cc (get_section_contents): Handle relocation pointing to section
6416         with no object or shndx information.
6417         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6418         * testsuite/Makefile.in: Regenerate.
6419         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6420         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6421
6422 2010-04-22  Ian Lance Taylor  <iant@google.com>
6423
6424         * expression.cc (Expression::Expression_eval_info): Add
6425         result_alignment_pointer field.
6426         (Expression::eval_with_dot): Add result_alignment_pointer
6427         parameter.  Change all callers.
6428         (Expression::eval_maybe_dot): Likewise.
6429         (class Binary_expression): Add alignment_pointer parameter to
6430         left_value and right_value.  Change all callers.
6431         (BINARY_EXPRESSION): Set result alignment.
6432         (class Trinary_expression): Add alignment_pointer parameter to
6433         arg2_value and arg3_value.  Change all callers.
6434         (Trinary_cond::value): Set result alignment.
6435         (Max_expression::value, Min_expression::value): Likewise.
6436         (Align_expression::value): Likewise.
6437         * script-sections.cc (class Sections_element): Add dot_alignment
6438         parameter to set_section_addresses virtual function.  Update
6439         instantiations.
6440         (class Output_section_element): Likewise.
6441         (Script_sections::create_segments): Add dot_alignment parameter.
6442         Change all callers.
6443         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6444         (Script_sections::set_phdrs_clause_addresses): Likewise.
6445         * script-sections.h: Update declarations.
6446         * script.h: Update declarations.
6447         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6448         min_p_align.
6449         * testsuite/script_test_3.t: Set large alignment.
6450         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6451         segment has expected alignment.
6452
6453 2010-04-22  Nick Clifton  <nickc@redhat.com>
6454
6455         * po/gold.pot: Updated by the Translation project.
6456         * po/vi.po: Updated Vietnamese translation.
6457
6458 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6459
6460         * testsuite/Makefile.am (check_PROGRAMS): Add
6461         icf_virtual_function_folding_test.
6462         * testsuite/Makefile.in: Regenerated.
6463
6464 2010-04-15  Andrew Haley  <aph@redhat.com>
6465
6466         * options.h (merge_exidx_entries): New option.
6467         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6468         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6469         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6470         (Target_arm::merge_exidx_entries): New function.
6471         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6472         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6473         to Arm_exidx_fixup constructor.
6474         Add new arg, merge_exidx_entries.
6475         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6476         Arm_output_section::fix_exidx_coverage.
6477
6478 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6479
6480         * icf.cc (get_section_contents): Check for preemptible functions.
6481         Ignore addend when appropriate.
6482         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6483         section folded.
6484         (add_from_relobj): Check for section folded.
6485         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6486         * symtab.h (should_add_dynsym_entry): Add new parameter.
6487         * target-reloc.h (scan_relocs): Check for section folded.
6488         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6489         Check reloc types for function pointers in shared objects.
6490         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6491         case.
6492         (icf_preemptible_functions_test): New test case.
6493         (icf_string_merge_test): New test case.
6494         * testsuite.Makefile.in: Regenerate.
6495         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6496         bar_glob.  Refactor code.
6497         * testsuite/icf_preemptible_functions_test.cc: New file.
6498         * testsuite/icf_preemptible_functions_test.sh: New file.
6499         * testsuite/icf_string_merge_test.cc: New file.
6500         * testsuite/icf_string_merge_test.sh: New file.
6501         * testsuite/icf_virtual_function_folding_test.cc: New file.
6502         * testsuite/icf_virtual_function_folding_test.sh: New file.
6503
6504 2010-04-14  Doug Kwan  <dougkwan@google.com>
6505
6506         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6507         for local symbol recounting if we remove a section due to ICF.
6508         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6509         there are no regular objects in input.
6510
6511 2010-04-13  Doug Kwan  <dougkwan@google.com>
6512
6513         * arm.cc (Arm_input_section::set_final_data_size): Compute
6514         accurate final data size instead of using current data size.
6515
6516 2010-04-09  Doug Kwan  <dougkwan@google.com>
6517
6518         * layout.cc (Layout::choose_output_section): Handle script section
6519         types.
6520         (Layout::make_output_section_for_script): Add section type parameter.
6521         Handle script section types.
6522         * layout.h (Layout::make_output_section_for_script): Add section
6523         type parameter.
6524         * output.cc (Output_section::Output_section): Initialize data member
6525         is_noload_.
6526         (Output_section::do_reset_address_and_file_offset): Do not set address
6527         to 0 if section is a NOLOAD section.
6528         * output.h (Output_section::is_noload): New method.
6529         (Output_section::set_is_noload): Ditto.
6530         (Output_section::is_noload_): New data member.
6531         * script-c.h (Script_section_type): New enum type.
6532         (struct Parser_output_section_header): Add new file section_type.
6533         * script-sections.cc (Sections_element::output_section_name): Add
6534         parameter for returning script section type.
6535         (Output_section_definition::output_section_name): Ditto.
6536         (Output_section_definition::section_type)P; New method.
6537         (Output_section_definiton::script_section_type_name): Ditto.
6538         (Output_section_definition::script_section_type_): New data member.
6539         (Output_section_definition::Output_section_definition): Initialize
6540         data member Output_section_definition::script_section_type_.
6541         (Output_section_definition::create_sections): Pass script section type
6542         to Layout::make_output_section_for_script.
6543         (Output_section_definition::output_section_name): Return script
6544         section type to caller.
6545         (Output_section_definition::set_section_address): Do not advance
6546         dot value and load address if section type is NOLOAD.  Set address
6547         of NOLOAD sections regardless of section flags.
6548         (Output_section_definition::print): Print section type if it is
6549         not SCRIPT_SECTION_TYPE_NONE.
6550         (Output_section_definition::section_type): New method.
6551         (Output_section_definition::script_section_type_name): Ditto.
6552         (Script_sections::output_section_name): Add new parameter
6553         PSECTION_TYPE for returning script section type.  Pass it to
6554         section elements.  Handle discard sections.
6555         (Sort_output_sections::operator()): Handle NOLOAD sections.
6556         * script-sections.h (Script_sections::Section_type): New enum type.
6557         (Script_sections::output_section_name): Add a new parameter for
6558         returning script section type.
6559         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6560         INFO and NOLOAD.
6561         * yyscript.y (union): Add new field SECTION_TYPE.
6562         (COPY, DSECT, INFO, NOLOAD): New tokens.
6563         (opt_address_and_section_type): Change type to output_section_header.
6564         (section_type): New non-terminal
6565         (section_header): Handle section type.
6566         (opt_address_and_section_type): Return section type value.
6567
6568 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6569
6570         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6571         * testsuite/plugin_common_test_2.c (foo): Likewise.
6572
6573 2010-04-08  Doug Kwan  <dougkwan@google.com>
6574
6575         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6576         Output_merge_data.
6577         * output.cc (Output_section::add_merge_input_section): Simplify
6578         code and return status of Output_merge_base::add_input_section.
6579         Update merge section map only if Output_merge_base::add_input_section
6580         returns true.
6581
6582 2010-04-07  Doug Kwan  <dougkwan@google.com>
6583
6584         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6585         if section is marked as containing instructions but has no mapping
6586         symbols.
6587         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6588         correct section index.
6589         (Arm_relobj::find_linked_text_section): Ditto.
6590
6591 2010-04-07  Cary Coutant  <ccoutant@google.com>
6592
6593         * archive.cc (include_member): Destroy Read_symbols_data object before
6594         releasing file.
6595         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6596         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6597         (Read_symbols_data::~Read_symbols_data) New destructor.
6598         (Section_relocs::Section_relocs) New constructor.
6599         (Section_relocs::~Section_relocs) New destructor.
6600         (Read_relocs_data::Read_relocs_data) New constructor.
6601         (Read_relocs_data::~Read_relocs_data) New destructor.
6602         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6603         pointers to NULL after deleting.
6604
6605 2010-04-07  Doug Kwan  <dougkwan@google.com>
6606
6607         * arm.cc: Replace "endianity" with "endianness" in comments.
6608         (Arm_exidx_cantunwind): Ditto.
6609         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6610         (Arm_relobj::merge_flags_and_attributes): New method.
6611         (Arm_relobj::merge_flags_and_attributes_): New data member.
6612         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6613         (Arm_relobj::scan_sections_for_stubs): Ditto.
6614         (Arm_relobj::do_read_symbols): Check to see if we really want to
6615         merge processor-specific flags and attributes.  Exit early if
6616         an object is empty except for section names and the undefined symbol.
6617         (Target_arm::do_finalize_sections): Move check for ELF format to
6618         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6619         attributes from a regular object only when we have determined that
6620         it is aapropriate.  Do not create an .ARM.attributes section in
6621         output if there is no regular input object.
6622         (Target_arm::merge_processor_specific_flags): Check
6623         --warn-mismatch before printing any error.
6624         (Target_arm::merge_object_attributes): Ditto.
6625         * gold.cc (queue_middle_tasks): Handle the case in which there is
6626         no regular object in input.
6627         * options.cc (General_options::parse_EB): New method.
6628         (General_options::parse_EL): Same.
6629         (General_options::General_options): Initialize endianness_.
6630         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6631         New options.
6632         (General_options::Endianness): New enum.
6633         (General_options::endianness): New method.
6634         (General_options::endianness_): New data member.
6635         * parameters.cc (Parameters::set_options): Check target endianness.
6636         (Parameters::set_target_once): Ditto.
6637         (Parameters::check_target_endianness): New method.
6638         (parameters_force_valid_target): If either -EL or -EB is specified,
6639         use it to define endianness of default target.
6640         * parameters.h (Parameters::check_target_endianness): New method
6641         declaration.
6642         * target.h (class Target): Change "endianity" to "endianness"
6643         in comments.
6644
6645 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6646
6647         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6648         * configure: Regenerate.
6649         * Makefile.in: Regenerate.
6650         * testsuite/Makefile.in: Regenerate.
6651
6652 2010-04-06  Cary Coutant  <ccoutant@google.com>
6653
6654         gcc PR lto/42757
6655         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6656         prevailing definitions of common symbols.
6657         * testsuite/plugin_test_6.sh: New test case.
6658         * testsuite/plugin_common_test_1.c: New test case.
6659         * testsuite/plugin_common_test_2.c: New test case.
6660         * testsuite/Makefile.am (plugin_test_6): New test case.
6661         * testsuite/Makefile.in: Regenerate.
6662
6663 2010-04-06  Nick Clifton  <nickc@redhat.com>
6664
6665         * po/vi.po: New Vietnamese translation.
6666
6667 2010-03-30  Doug Kwan  <dougkwan@google.com>
6668
6669         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6670
6671 2010-03-25  Doug Kwan  <dougkwan@google.com>
6672
6673         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6674         to avoid a conversion warning on a 32-bit host.
6675
6676 2010-03-24  Ian Lance Taylor  <iant@google.com>
6677
6678         * testsuite/script_test_3.t: Add a TLS segment.
6679         * testsuite/Makefile.am (check_PROGRAMS): Add
6680         tls_phdrs_script_test.
6681         (tls_phdrs_script_test_SOURCES): Define.
6682         (tls_phdrs_script_test_DEPENDENCIES): Define.
6683         (tls_phdrs_script_test_LDFLAGS): Define.
6684         (tls_phdrs_script_test_LDADD): Define.
6685         * testsuite/Makefile.in: Rebuild.
6686
6687 2010-03-23  Cary Coutant  <ccoutant@google.com>
6688
6689         * fileread.cc (find_or_make_view): Fix comment.
6690
6691 2010-03-23  Ian Lance Taylor  <iant@google.com>
6692
6693         * script-sections.cc (class Orphan_section_placement): Define
6694         PLACE_TLS and PLACE_TLS_BSS.
6695         (Orphan_section_placement::Orphan_section_placement): Initialize
6696         new places.
6697         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6698         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6699         (tls_script_test_SOURCES): Define.
6700         (tls_script_test_DEPENDENCIES): Define.
6701         (tls_script_test_LDFLAGS): Define.
6702         (tls_script_test_LDADD): Define.
6703         * testsuite/Makefile.in: Rebuild.
6704
6705 2010-03-22  Doug Kwan  <dougkwan@google.com>
6706
6707         * arm.cc (Arm_relocate_functions::abs8,
6708         Arm_relocate_functions::abs16): Use correct check for overflow
6709         specified in the ARM ELF specs.
6710         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6711         target of a BLX instruction specially.
6712         (Reloc_stub::stub_type_for_reloc): Ditto.
6713         (Relocate::relocate): Use symbolic names instead of numeric relocation
6714         codes to report error.
6715         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6716         workaround.
6717         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6718         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6719         thumb2_blx_out_of_range.stdout
6720         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6721         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6722         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6723         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6724         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6725         thumb2_blx_in_range, thumb2_blx_in_range.o,
6726         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6727         thumb2_blx_out_of_range.o): New rules.
6728         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6729         thumb2_blx_in_range and thumb2_blx_out_of_range.
6730         * testsuite/Makefile.in: Regenerate.
6731         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6732         * testsuite/thumb_blx_in_range.s: New file.
6733         * testsuite/thumb_blx_out_of_range.s: New file.
6734
6735 2010-03-22  Rafael Espindola  <espindola@google.com>
6736
6737         * archive.cc (Should_include): Move to archive.h.
6738         (should_include_member): Make it a member of Archive.
6739         (Lib_group): New.
6740         (Add_lib_group_symbols): New.
6741         * archive.h: Include options.h.
6742         (Archive_member): Moved from Archive.
6743         (Should_include): Moved from archive.cc.
6744         (Lib_group): New.
6745         (Add_lib_group_symbols): New.
6746         * dynobj.cc (do_should_include_member): New.
6747         * dynobj.h (do_should_include_member): New.
6748         * gold.cc (queue_initial_tasks): Update call to queue.
6749         * main.cc (main): Print lib group stats.
6750         * object.cc (do_should_include_member): New.
6751         * object.h: Include archive.h.
6752         (Object::should_include_member): New.
6753         (Object::do_should_include_member): New.
6754         (Sized_relobj::do_should_include_member): New.
6755         * options.cc (General_options::parse_start_lib): New.
6756         (General_options::parse_end_lib): New.
6757         (Input_arguments::add_file): Handle lib groups.
6758         (Input_arguments::start_group): Check we are not in a lib.
6759         (Input_arguments::start_lib): New.
6760         (Input_arguments::end_lib): New.
6761         * options.h (General_options): Add start_lib and end_lib.
6762         (Input_argument::lib_): New.
6763         (Input_argument::lib): New.
6764         (Input_argument::is_lib): New.
6765         (Input_file_lib): New.
6766         (Input_arguments::in_lib_): New.
6767         (Input_arguments::in_lib): New.
6768         (Input_arguments::start_lib): New.
6769         (Input_arguments::end_lib_): New.
6770         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6771         in unused members as preempted.
6772         (Sized_pluginobj::do_should_include_member): New.
6773         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6774         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6775         return the blocker.
6776         (Read_symbols::do_whole_lib_group): New.
6777         (Read_symbols::do_lib_group): New.
6778         (Read_symbols::do_read_symbols): Handle lib groups.
6779         (Read_symbols::get_name): Handle lib groups.
6780         * readsyms.h (Read_symbols): Add an archive member pointer.
6781         (Read_symbols::do_whole_lib_group): New.
6782         (Read_symbols::do_lib_group): New.
6783         (Read_symbols::member_): New.
6784         * script.cc (read_input_script): Update call to queue_soon.
6785
6786 2010-03-19  Doug Kwan  <dougkwan@google.com>
6787
6788         * arm.cc (Stub_table::Stub_table): Initialize new data members
6789         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6790         (Stub_table::add_reloc_stub): Assign stub offset and update
6791         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6792         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6793         New data members.
6794         (Stub_table::update_data_size_and_addralign): Use
6795         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6796         instead of going over all reloc stubs.
6797         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6798         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6799         Stringpool_template::offset_ to size of Stringpool_char.
6800         (Stringpool_template::new_key_offset): Remove code to initialize
6801         Stringpool_template::offset_.
6802         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6803         Stringpool_template::offset_ to zero.
6804
6805 2010-03-15  Doug Kwan  <dougkwan@google.com>
6806
6807         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6808         offset_.
6809         (Stringpool_template::new_key_offset): New method.
6810         (Stringpool_template::add_string): Assign offsets when adding new
6811         strings.
6812         (Stringpool_template::set_string_offsets): Do not set string offsets
6813         when not optimizing.
6814         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6815         member size_.
6816         (Chunked_vector::clear): Clear size_.
6817         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6818         (Chunked_vector::size): Return size_.
6819         (Chunked_vector::push_back): Use size_ to find insert position.
6820         (Chunked_vector::size_): New data member.
6821         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6822         (Stringpool_template::new_key_offset): New method declaration.
6823         (Stringpool_template::offset_): New data member.
6824
6825 2010-03-15   Rafael Espindola  <espindola@google.com>
6826
6827         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6828         Add_symbols' constructor.
6829         * readsyms.h (Add_symbols): Remove the input_group member.
6830
6831 2010-03-10  Ian Lance Taylor  <iant@google.com>
6832
6833         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6834         target to ask whether a reference to a symbol requires a stack
6835         split.
6836         * target.h (Target::is_call_to_non_split): New function.
6837         (Target::do_is_call_to_non_split): Declare virtual function.
6838         * target.cc: Include "symtab.h".
6839         (Target::do_is_call_to_non_split): New function.
6840         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6841
6842 2010-03-10  Cary Coutant  <ccoutant@google.com>
6843
6844         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6845         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6846         (File_read::open[2]): Add whole_file_view_ to list of views.
6847         (File_read::make_view): Remove test of whole_file_view_.
6848         (File_read::find_or_make_view): Create whole_file_view_ if
6849         necessary.
6850         (File_read::clear_views): Replace bool parameter with enum;
6851         adjust all callers.  Don't delete views with permanent data;
6852         do delete cached views and views from archives if
6853         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6854         if clearing the corresponding view.
6855         * fileread.h (File_read::Clear_views_mode): New enum.
6856         (File_read::View::is_permanent_view): New method.
6857         (File_read::clear_views): Replace bool parameter
6858         with enum; adjust all callers.
6859         * options.h (General_options): Change keep_files_mapped option;
6860         add map_whole_files.
6861         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6862         releasing the file.
6863         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6864         the file.
6865
6866 2010-03-10  David S. Miller  <davem@davemloft.net>
6867
6868         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6869
6870 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6871
6872         * icf.cc (get_section_contents): Add '@' marker after processing the
6873         merge reloc.
6874
6875 2010-03-08  Doug Kwan  <dougkwan@google.com>
6876
6877         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6878         due to a conversion warning.
6879         (Arm_relobj::update_output_local_symbol_count): Check for local
6880         symbol with unset output index.
6881
6882 2010-03-05  Ian Lance Taylor  <iant@google.com>
6883
6884         * options.h (class General_options): Add --spare-dynamic-tags.
6885         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6886         --spare-dynamic-tags.
6887
6888 2010-03-05  Ian Lance Taylor  <iant@google.com>
6889
6890         * incremental.cc: Include "libiberty.h".
6891
6892 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6893
6894         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6895         function, is_info_ member.
6896         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6897         (Versions::Versions): Update caller.
6898         (Versions::define_base_version): Likewise.
6899         (Versions::add_def): Likewise.
6900
6901 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6902
6903         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6904         (Scan::possible_function_pointer_reloc): New function.
6905         (Scan::local_reloc_may_be_function_pointer): Change to call
6906         possible_function_pointer_reloc.
6907         (Scan::global_reloc_may_be_function_pointer): Ditto.
6908         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6909         relocations in ".data.rel.ro._ZTV" section.
6910         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6911         * testsuite/icf_safe_so_test.cc: Ditto.
6912         * testsuite/icf_safe_test.cc: Ditto.
6913         * testsuite/icf_safe_test.sh: Ditto.
6914
6915 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6916             Ian Lance Taylor  <iant@google.com>
6917
6918         * target-reloc.h (relocate_section): Check the symbol table index
6919         for -1U before setting the local symbol index.
6920         (scan_relocatable_relocs): If copying the relocation, record that
6921         the local symbol is required.
6922         * object.h (Symbol_value::is_output_symtab_index_set): New
6923         function.
6924         (Symbol_value::may_be_discarded_from_output_symtab): New
6925         function.
6926         (Symbol_value::has_output_symtab_entry): New function.
6927         (Symbol_value::needs_output_symtab_entry): Remove.
6928         (Symbol_value::output_symtab_index): Make sure the symbol index is
6929         set.
6930         (Symbol_value::set_output_symtab_index): Make sure the symbol
6931         index is not set.  Make sure the new index is valid.
6932         (Symbol_value::set_must_have_output_symtab_entry): New function.
6933         (Symbol_value::has_output_dynsym_entry): New function.
6934         (Symbol_value::set_output_dynsym_index): Make sure the new index
6935         is valid.
6936         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6937         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6938         local symbol if permitted.
6939         (Sized_relobj::do_finalize_local_symbols): Call
6940         is_output_symtab_index_set rather than needs_output_symtab_entry.
6941         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6942         rather than needs_output_symtab_entry.  Call
6943         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6944         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6945         is_output_symtab_index_set rather than needs_output_symtab_entry.
6946         * testsuite/discard_locals_relocatable_test.c: New file.
6947         * testsuite/discard_locals_test.sh: Test -r.
6948         * testsuite/Makefile.am (check_DATA): Add
6949         discard_locals_relocatable_test1.syms,
6950         discard_local_relocatable_test2.syms.
6951         (MOSTLYCLEANFILES): Likewise.  Also add
6952         discard_locals_relocatable_test1.lout and
6953         discard_locals_relocatable_test2.out.
6954         (discard_locals_relocatable_test1.syms): New target.
6955         (discard_locals_relocatable_test.o): New target.
6956         (discard_locals_relocatable_test1.out): New target.
6957         (discard_locals_relocatable_test2.syms): New target.
6958         (discard_locals_relocatable_test2.out): New target.
6959         (various): Add missing ../ld-new dependencies.
6960         * testsuite/Makefile.in: Rebuild.
6961
6962 2010-03-03  Nick Clifton  <nickc@redhat.com>
6963
6964         * po/fi.po: New Finnish translation.
6965
6966 2010-03-01  Doug Kwan  <dougkwan@google.com>
6967
6968         * layout.cc (Layout::Layout): Force section types of .init_array*,
6969         .preinit_array* and .fini_array* sections.
6970         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6971         Fix check of return value of std::string::find.().
6972         (Output_section::Input_section_sort_compare::operator()): Remove
6973         comment about .init_array.
6974         (Output_section::Input_section_sort_init_fini_compare::operator()):
6975         New method.
6976         (Output_section::sort_attached_input_sections): Handle .init_array
6977         and .fini_array specially.
6978         * output.h (Output_section::Inut_section_sort_compare): Update
6979         comment.
6980         (Output_section::Input_section_sort_init_fini_compare): New struct.
6981
6982 2010-02-26  Doug Kwan  <dougkwan@google.com>
6983
6984         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6985         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6986         * testsuite/debug_msg.sh: Avoid matching source line number for
6987         use of global variable undef_int.
6988
6989 2010-02-26  Doug Kwan  <dougkwan@google.com>
6990
6991         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6992         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6993         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6994         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6995         * options.cc (General_options::General_options): Initialize member
6996         fix_v4bx_.
6997         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6998         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6999         and rm_no_fix_v4bx.stdout
7000         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7001         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7002         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7003         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7004         and arm_no_fix_v4bx.
7005         * Makefile.in: Regenerate.
7006         * testsuite/arm_fix_v4bx.s: New file.
7007         * testsuite/arm_fix_v4bx.sh: Ditto.
7008
7009 2010-02-24  Doug Kwan  <dougkwan@google.com>
7010
7011         * arm.cc (Target_arm::got_section): Make the .got section the first
7012         non RELRO section in the data segment.
7013         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7014         suffixes of section names.
7015
7016 2010-02-24  Doug Kwan  <dougkwan@google.com>
7017
7018         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7019         flags and attributes merging if an input file is a binary file.
7020         * fileread.cc (Input_file::open): Record format of original file.
7021         * fileread.h (Input_file::Format): New enum type.
7022         (Input_file::Input_file): Initialize data member format_.
7023         (Input_file::format): New method definition.
7024         (Input_file::format_):: New data member.
7025
7026 2010-02-24  Doug Kwan  <dougkwan@google.com>
7027
7028         * arm.cc (Arm_output_data_got): New class.
7029         (ARM_TCB_SIZE): New constant
7030         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7031         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7032         If user uses a script with a SECTIONS clause, issue only a warning
7033         for a misplaced EXIDX input section.  Otherwise, issue an error.
7034         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7035         garbage collection.
7036         (Target_arm::got_mode_index_entry): Handle static linking.
7037         (Target_arm::Scan::local): Ditto.
7038         (Target_arm::Scan::global): Ditto.
7039         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7040         all incorrectly implemented relocations.
7041         (Target_arm::fix_exidx_coverage): Pass layout to
7042         Arm_output_section::fix_exidx_coverage.
7043         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7044         from ".ARM.exidx." and ".ARM.extab.".
7045
7046 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7047
7048         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7049         section if it does not already exist.
7050         * attributes.cc (Attributes_section_data::Attributes_section_data):
7051         Don't crash if size is zero.
7052
7053 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7054             Ian Lance Taylor  <iant@google.com>
7055
7056         * gold.cc (queue_middle_tasks): If no input files were opened,
7057         exit.
7058         * workqueue.h (Task_function::Task_function): Assert that there is
7059         a blocker.
7060
7061 2010-02-22  Doug Kwan  <dougkwan@google.com>
7062
7063         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7064         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7065         types to avoid warnings due to different uint64_t implementations
7066         on different hosts.
7067
7068 2010-02-21  Doug Kwan  <dougkwan@google.com>
7069
7070         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7071         handling of the maximum backward branch offset.
7072         (Arm_relocate_functions::thumb_branch_common): Ditto.
7073         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7074         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7075         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7076         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7077         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7078         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7079         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7080         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7081         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7082         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7083         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7084         thumb2_bl_out_of_range.o): New rules.
7085         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7086         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7087         thumb2_bl_out_of_range
7088         * testsuite/Makefile.in: Regenerate.
7089         * testsuite/arm_bl_in_range.s: New file.
7090         * testsuite/arm_bl_out_of_range.s: Ditto.
7091         * testsuite/arm_branch_in_range.sh: Ditto.
7092         * testsuite/arm_branch_range.t: Ditto.
7093         * testsuite/thumb2_branch_range.t: Ditto.
7094         * testsuite/thumb_bl_in_range.s: Ditto.
7095         * testsuite/thumb_bl_out_of_range.s: Ditto.
7096         * testsuite/thumb_branch_range.t: Ditto.
7097
7098 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7099
7100         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7101         Add reloc offset information.
7102         * icf.cc (get_section_contents): Change iterators to point to the new
7103         vectors. Add reloc offset information to the contents.
7104         * icf.h (Icf::Sections_reachable_info): New typedef.
7105         (Icf::Sections_reachable_list): New typedef.
7106         (Icf::Offset_info): New typedef.
7107         (Icf::Reloc_info): New struct typedef.
7108         (Icf::Reloc_info_list): New typedef.
7109         (Icf::symbol_reloc_list): Delete method.
7110         (Icf::addend_reloc_list): Delete method.
7111         (Icf::section_reloc_list): Delete method.
7112         (Icf::reloc_info_list): New method.
7113         (Icf::reloc_info_list_): New member.
7114
7115 2010-02-19  Doug Kwan  <dougkwan@google.com>
7116
7117         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7118         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7119         * arm.cc (Arm_relocation_functions): New forward declaration.
7120         (Target_arm::Target_arm): Initialize new data members
7121         got_mod_index_offset_ and tls_base_symbol_defined_.
7122         (Target_arm::Relocate::relocate_tls): New method.
7123         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7124          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7125         New methods.
7126         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7127         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7128         (Target_arm::got_mod_index_offset_,
7129         Target_arm::tls_base_symbol_defined_): New data members.
7130         (Target_arm::Scan::local, Target::Scan::global,
7131         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7132         relocations.
7133
7134 2010-02-18  Doug Kwan  <dougkwan@google.com>
7135
7136         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7137         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7138         text section as a parameter becuase some broken tools may not set
7139         the link in section header.
7140         (Target_arm::has_got_section): New method.
7141         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7142         without any mapping symbol as data only.  Remove warning.
7143         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7144         link in its section header, try to discover the link by inspecting the
7145         REL31 relocation at the beginning of the section.
7146         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7147         in error message.
7148         (Target_arm::Scan::global): Treat any reference to the symbol
7149         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7150
7151 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7152
7153         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7154         (Scan::global_reloc_may_be_function_pointer): New function.
7155         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7156         (Scan::global_reloc_may_be_function_pointer): New function.
7157         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7158         (Scan::global_reloc_may_be_function_pointer): New function.
7159         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7160         (Scan::global_reloc_may_be_function_pointer): New function.
7161         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7162         (Scan::global_reloc_may_be_function_pointer): New function.
7163         (Scan::possible_function_pointer_reloc): New function.
7164         (Target_x86_64::can_check_for_function_pointers): New function.
7165         * gc.h (gc_process_relocs): Scan relocation types to determine if
7166         function pointers were taken for targets that support it.
7167         * icf.cc (Icf::find_identical_sections): Include functions for
7168         folding in safe ICF whose pointer is not taken.
7169         * icf.h (Secn_fptr_taken_set): New typedef.
7170         (fptr_section_id_): New member.
7171         (section_has_function_pointers): New function.
7172         (set_section_has_function_pointers): New function.
7173         (check_section_for_function_pointers): New function.
7174         * options.h: Fix comment for safe ICF option.
7175         * target.h (can_check_for_function_pointers): New function.
7176         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7177         Modify icf_safe_test for X86-64.
7178         * testsuite/Makefile.in: Regenerate.
7179         * testsuite/icf_safe_so_test.cc: New file.
7180         * testsuite/icf_safe_so_test.sh: New file.
7181         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7182         (main): Change to take pointer to function kept_func_3.
7183         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7184         folding is done correctly for X86-64.
7185
7186 2010-02-12  David S. Miller  <davem@davemloft.net>
7187
7188         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7189         is_symbolless parameter.
7190         (Output_reloc<SHT_REL>::is_symbolless): New.
7191         (Output_reloc<SHT_REL>::is_symbolless_): New.
7192         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7193         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7194         (Output_reloc<SHT_RELA>::is_symbolless): New.
7195         (Output_data_reloc::add_global): Handle is_symbolless.
7196         (Output_data_reloc::add_global_relative): Likewise.
7197         (Output_data_reloc::add_local): Likewise.
7198         (Output_data_reloc::add_local_relative): Likewise.
7199         (Output_data_reloc::add_symbolless_global_addend): New.
7200         (Output_data_reloc::add_symbolless_local_addend): New.
7201         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7202         is_symbolless.
7203         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7204         instead of ->is_relative_
7205         (Output_reloc::write): Likewise.
7206         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7207         (Output_reloc::write_rel): Simplify.
7208
7209         * sparc.cc (Target_sparc::Scan::local): Use
7210         ->add_symbolless_local_addend as needed.
7211         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7212         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7213         based upon relocation offset.
7214
7215 2010-02-11  Doug Kwan  <dougkwan@google.com>
7216
7217         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7218         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7219         beginning of function.
7220         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7221         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7222         parameter is_32bit in calls to should_apply_static_reloc.
7223         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7224         (check_DATA): Add arm_abs_global.stdout.
7225         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7226         arm_abs_global.stdout): New rules.
7227         (MOSTLLYCLEANFILES): Add arm_abs_global
7228         * Makefile.in: Regenerate.
7229         * testsuite/arm_abs_global.s: New file.
7230         * testsuite/arm_abs_global.sh: Ditto.
7231         * testsuite/arm_abs_lib.s: Ditto.
7232
7233 2010-02-11  Ian Lance Taylor  <iant@google.com>
7234
7235         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7236         Read_relocs task.
7237         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7238         Allocate_commons_task first.
7239         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7240         task, rather than symtab_lock_.
7241         (Gc_process_relocs::~Gc_process_relocs): New function.
7242         (Gc_process_relocs::is_runnable): Check this_blocker_.
7243         (Gc_process_relocs::locks): Use next_blocker_ rather than
7244         blocker_.
7245         (Scan_relocs::~Scan_relocs): New function.
7246         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7247         symtab_lock_.
7248         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7249         next_blocker_.
7250         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7251         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7252         constructor accordingly.
7253         (class Gc_process_relocs): Likewise.
7254         (class Scan_relocs): Likewise.
7255         * common.h (class Allocate_commons_task): Remove symtab_lock_
7256         field, and corresponding constructor parameter.
7257         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7258         symtab_lock_.
7259         (Allocate_commons_task::locks): Likewise.
7260
7261 2010-02-11  Ian Lance Taylor  <iant@google.com>
7262
7263         * gold-threads.h (class Once): Define.
7264         (class Initialize_lock): Rewrite as child of Once.
7265         * gold-threads.cc (class Once_initialize): Define.
7266         (once_pointer_control): New static variable.
7267         (once_pointer, once_arg): New static variables.
7268         (c_run_once): New static function.
7269         (Once::Once, Once::run_once, Once::internal_run): New functions.
7270         (class Initialize_lock_once): Remove.
7271         (initialize_lock_control): Remove.
7272         (initialize_lock_pointer): Remove.
7273         (initialize_lock_once): Remove.
7274         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7275         (Initialize_lock::initialize): Rewrite.
7276         (Initialize_lock::do_run_once): New function.
7277         * archive.cc (Archive::interpret_header): Only clear name if it is
7278         not already empty.
7279         * fileread.cc: Include "gold-threads.h"
7280         (file_counts_lock): New static variable.
7281         (file_counts_initialize_lock): Likewise.
7282         (File_read::release): Only increment counts when using --stats.
7283         Use a lock around the increment.
7284         * parameters.cc (class Set_parameters_target_once): Define.
7285         (set_parameters_target_once): New static variable.
7286         (Parameters::Parameters): Move here from parameters.h.
7287         (Parameters::set_target): Rewrite.
7288         (Parameters::set_target_once): New function.
7289         (Parameters::clear_target): Move here and rewrite.
7290         * parameters.h (class Parameters): Update declarations.  Add
7291         set_parameters_target_once_ field.
7292         (Parameters::Parameters): Move to parameters.cc.
7293         (Parameters::clear_target): Likewise.
7294         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7295         task.
7296         (Start_group::~Start_group): New function.
7297         (Start_group::is_runnable): New function.
7298         (Start_group::locks, Start_group::run): New functions.
7299         (Finish_group::run): Change saw_undefined to size_t.
7300         * readsyms.h (class Start_group): Define.
7301         (class Finish_group): Change saw_undefined_ field to size_t.
7302         (Finish_group::Finish_group): Remove saw_undefined and
7303         this_blocker parameters.  Change all callers.
7304         (Finish_group::set_saw_undefined): New function.
7305         (Finish_group::set_blocker): New function.
7306         * symtab.h (class Symbol_table): Change saw_undefined to return
7307         size_t.  Change saw_undefined_ field to size_t.
7308         * target-select.cc (Set_target_once::do_run_once): New function.
7309         (Target_selector::Target_selector): Initialize set_target_once_
7310         field.  Don't initialize lock_ and initialize_lock_ fields.
7311         (Target_selector::instantiate_target): Rewrite.
7312         (Target_selector::set_target): New function.
7313         * target-select.h (class Set_target_once): Define.
7314         (class Target_selector): Update declarations.  Make
7315         Set_target_once a friend.  Remove lock_ and initialize_lock_
7316         fields.  Add set_target_once_ field.
7317
7318 2010-02-10  Ian Lance Taylor  <iant@google.com>
7319
7320         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7321         queueing any tasks.
7322         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7323         (queue_middle_tasks): Add all blockers before queueing any tasks.
7324         (queue_final_tasks): Likewise.
7325         * token.h (Task_token::add_blockers): New function.
7326         * object.h (Input_objects::number_of_relobjs): New function.
7327
7328 2010-02-10  Ian Lance Taylor  <iant@google.com>
7329
7330         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7331         shared, not if not position independent.
7332         * x86_64.cc (Relocate::relocate_tls): Likewise.
7333         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7334         (tls_pie_pic_test): New target.
7335         * testsuite/Makefile.in: Rebuild.
7336
7337         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7338         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7339         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7340         * testsuite/Makefile.in: Rebuild.
7341
7342 2010-02-09  David S. Miller  <davem@davemloft.net>
7343
7344         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7345         R_SPARC_RELATIVE using ->add_local_relative().
7346         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7347
7348         * output.h (Output_data_dynamic::add_section_size): New method
7349         that takes two Output_data objects.
7350         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7351         entry param.  Handle it in initializers.
7352         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7353         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7354         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7355         arg.
7356         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7357         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7358         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7359         for dynrel_includes_plt.
7360         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7361         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7362         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7363         before .rela.plt
7364         (Target_sparc::do_finalize_sections): Update to pass true for
7365         dynrel_includes_plt.
7366         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7367         output before .rela.plt
7368         (Target_powerpc::do_finalize_sections): Update to pass true for
7369         dynrel_includes_plt when 32-bit.
7370
7371 2010-02-08  Doug Kwan  <dougkwan@google.com>
7372
7373         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7374         method.
7375         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7376         Arm_relobj::scan_section_for_cortex_a8_stubs,
7377         Arm_relobj::do_relocation_section): Instead of calling
7378         Output_section::output_address, use faster
7379         Arm_relobj::simple_input_section_output_address.
7380
7381 2010-02-08  David S. Miller  <davem@davemloft.net>
7382
7383         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7384         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7385         relocation helper function.
7386
7387         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7388         just like R_SPARC_GOT{10,13,22}.
7389         (Target_sparc::Scan::local): Likewise.
7390         (Target_sparc::Relocate:relocate): Likewise.
7391
7392 2010-02-06  Ian Lance Taylor  <iant@google.com>
7393
7394         * configure.ac: Rewrite targetobjs duplicate removal code to use
7395         only shell constructs.
7396         * configure: Rebuild.
7397
7398 2010-02-05  Doug Kwan  <dougkwan@google.com>
7399
7400         PR 11247
7401         * arm.cc (Arm_relobj::section_is_scannable): New method.
7402         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7403         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7404
7405 2010-02-04  Doug Kwan  <dougkwan@google.com>
7406
7407         PR 11247
7408         * arm-reloc-property.cc (cstdio): Include.
7409         * configure.ac (targetobjs): Remove duplicates.
7410         * configure: Regenerate.
7411         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7412         big and little endian version for a given address size.
7413
7414 2010-02-03  Doug Kwan  <dougkwan@google.com>
7415
7416         * arm-reloc-property.cc
7417         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7418         definition.
7419         * arm-reloc-property.h
7420         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7421         New method definition.
7422         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7423         declaration.
7424         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7425         overflow to N.
7426         (GOT_PREL): Change implemented to Y.
7427         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7428         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7429         (Arm_relocate_functions::movw_abs_nc): Remove method.
7430         (Arm_relocate_functions::movt_abs): Ditto.
7431         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7432         (Arm_relocate_functions::thm_movt_abs): Ditto.
7433         (Arm_relocate_functions::movw_rel_nc): Ditto.
7434         (Arm_relocate_functions::movw_rel): Ditto.
7435         (Arm_relocate_functions::movt_rel): Ditto.
7436         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7437         (Arm_relocate_functions:thm_movw_rel): Ditto.
7438         (Arm_relocate_functions:thm_movt_rel): Ditto.
7439         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7440         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7441         New method definitions.
7442         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7443         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7444         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7445         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7446         (Target_arm::Relocate::relocate): Check for non-static or
7447         unimplemented relocation code and exit early.  Change calls to
7448         Target_arm::reloc_uses_thumb_bit and
7449         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7450         instead.  Refactor code to handle similar relocations to increase
7451         code sharing.  Remove check for unsupported relocation code in switch
7452         statement.
7453         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7454         relocation property table to find out size.  Change error message to
7455         print out the name of a relocation code instead of the numeric value.
7456         (Target_arm::scan_reloc_for_stub): Use relocation property table
7457         instead of calling Target_arm::reloc_uses_thumb_bit().
7458
7459 2010-02-02  Doug Kwan  <dougkwan@google.com>
7460
7461         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7462         types of relaxed input section.
7463
7464 2010-02-02  Doug Kwan  <dougkwan@google.com>
7465
7466         * Makefile.am (HFILES): Add arm-reloc-property.h.
7467         (DEFFILES): New.
7468         (TARGETSOURCES): Add arm-reloc-property.cc
7469         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7470         (libgold_a_SOURCES): $(DEFFILES)
7471         * Makefile.in: Regenerate.
7472         * arm-reloc-property.cc: New file.
7473         * arm-reloc-property.h: New file.
7474         * arm-reloc.def: New file.
7475         * arm.cc: Update comments.
7476         (arm-reloc-property.h): New included header.
7477         (arm_reloc_property_table): New global variable.
7478         (Target_arm::do_select_as_default_target): New method definition.
7479         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7480         arm-reloc-property to targ_extra_obj.
7481         * parameters.cc (set_parameters_target): Call
7482         Target::select_as_default_target().
7483         * target.h (Target::select_as_default_target): New method definition.
7484         (Target::do_select_as_default_target): Same.
7485
7486 2010-02-01  Doug Kwan  <dougkwan@google.com>
7487
7488         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7489         first_output_text_section_.
7490         (Arm_exidx_fixup::first_output_text_section): New method definition.
7491         (Arm_exidx_fixup::first_output_text_section_): New data member.
7492         (Arm_exidx_fixup::process_exidx_section): Record the first text
7493         output section seen.
7494         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7495         and entsize in output section header.
7496
7497 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7498
7499         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7500         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7501         (Arm_relocate_functions::thm_alu11): New Method.
7502         (Arm_relocate_functions::thm_pc8): New Method.
7503         (Arm_relocate_functions::thm_pc12): New Method.
7504         (Target_arm::Scan::local): Handle the relocations.
7505         (Target_arm::Scan::global): Likewise.
7506         (Target_arm::Relocate::relocate): Likewise.
7507         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7508
7509 2010-01-29  Doug Kwan  <dougkwan@google.com>
7510
7511         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7512         of relocation types as ld.
7513
7514 2010-01-29  Doug Kwan  <dougkwan@google.com>
7515
7516         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7517         to public.
7518         (Arm_relocate_functions::thumb_branch_common): Ditto.
7519         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7520         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7521         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7522         Arm_relocate_functions::jump24): Remove.
7523         (Target_arm::Relocate::relocate): Adjust code to call
7524         Arm_relocation_functions::arm_branch_common and
7525         Arm_relocation_functions::thumb_branch_common instead of their removed
7526         wrappers.  Merge switch-cases together to reduce source code size.
7527
7528 2010-01-29  Doug Kwan  <dougkwan@google.com>
7529
7530         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7531         output_local_symbol_count_needs_update_.
7532         (Arm_relobj::output_local_symbol_count_needs_update,
7533          Arm_relobj::set_output_local_symbol_count_needs_update,
7534          Arm_relobj::update_output_local_symbol_count): New methods.
7535         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7536         member.
7537         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7538         of pointed function as in a R_ARM_PREL31 relocation.
7539         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7540         for output local symbol count updating.
7541         (Target_arm::do_relax): Update output local symbol counts in objects
7542         if necessary.
7543         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7544
7545 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7546
7547         * arm.cc: Added support for the ARM relocations:
7548         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7549         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7550         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7551         movw_prel_nc).
7552         (Arm_relocate_functions::movw_rel): New method.
7553         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7554         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7555         thm_movw_prel_nc).
7556         (Arm_relocate_functions::thm_movw_rel): New method.
7557         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7558         thm_movt_prel).
7559         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7560         relocations.
7561         (Target_arm::Scan::global): Likewise.
7562         (Target_arm::Relocate::relocate): Likewise.
7563         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7564         Likewise.
7565
7566 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7567
7568         * arm.cc: Added support for ARM group relocations.
7569         (Target_arm::reloc_needs_sym_origin): New method.
7570         (Arm_relocate_functions::calc_grp_kn): New method.
7571         (Arm_relocate_functions::calc_grp_residual): New method.
7572         (Arm_relocate_functions::calc_grp_gn): New method.
7573         (Arm_relocate_functions::arm_grp_alu): New Method.
7574         (Arm_relocate_functions::arm_grp_ldr): New Method.
7575         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7576         (Arm_relocate_functions::arm_grp_ldc): New Method.
7577         (Target_arm::Scan::local): Handle the ARM group relocations.
7578         (Target_arm::Scan::global): Likewise.
7579         (Target_arm::Relocate::relocate): Likewise.
7580         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7581         Likewise.
7582
7583 2010-01-26  Doug Kwan  <dougkwan@google.com>
7584
7585         * arm.cc (set): Include.
7586         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7587         pointer type.
7588         (Arm_output_section::Text_section_list): New type.
7589         (Arm_output_section::append_text_sections_to_list): New method.
7590         (Arm_output_section::fix_exidx_coverage): Ditto.
7591         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7592         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7593         Relobj::set_section_offset() instead of
7594         Sized_relobj::invalidate_section_offset().
7595         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7596         parameter for section headers. Ignore relocation sections for
7597         unallocated sections and EXIDX sections.
7598         (Target_arm::fix_exidx_coverage): New method.
7599         (Target_arm::output_section_address_less_than): New type.
7600         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7601         linked text section instead of the EXIDX section.
7602         (Arm_output_section::create_stub_group): Add an assertion to check
7603         that this is not an EXIDX output section.
7604         (Arm_output_section::append_text_sections_to_list): New method.
7605         (Arm_output_section::fix_exidx_coverage): Ditto.
7606         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7607         Arm_relobj::section_needs_reloc_stub_scanning.
7608         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7609         first pass.
7610         (Target_arm::fix_exidx_coverage): New method.
7611         * object.h (Relobj::set_output_section): New method.
7612         (Sized_relobj::invalidate_section_offset): Remove method.
7613         (Sized_relobj::do_invalidate_section_offset): Remove method.
7614         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7615
7616 2010-01-25  Doug Kwan  <dougkwan@google.com>
7617
7618         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7619         Fix warning due to signed and unsigned comparison on a 32-bit host.
7620
7621 2010-01-22  Doug Kwan  <dougkwan@google.com>
7622
7623         * arm.cc (Target_arm::do_relax): Record an output section for section
7624         offset adjustment it contains any stub table that has changed.
7625         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7626         offsets in an output section if necessary.
7627         * output.cc (Output_section::Output_section): Initialize
7628         section_offsets_need_adjustments_.
7629         (Output_section::add_input_section_for_script): Renamed to
7630         Output_section::add_simple_input_section.
7631         (Output_section::save_states): Add a comment.
7632         (Output_section::discard_states): New method defintion.
7633         (Output_section::adjust_section_offsets): Same.
7634         * output.h (Output_section::add_input_section_for_script): Renamed to
7635         Output_section::add_simple_input_section.
7636         (Output_section::discard_states): New method declaration.
7637         (Output_section::adjust_section_offsets): Same.
7638         (Output_section::section_offsets_need_adjustment,
7639         Output_section::set_section_offsets_need_adjustment): New method
7640         definitions.
7641         (Output_section::section_offsets_need_adjustment_): New data member.
7642         * script-sections.cc
7643         (Output_section_element_input::set_section_address): Adjust code for
7644         renaming of Output_section::add_input_section_for_script.
7645         (Orphan_output_section::set_section_address): Same.
7646
7647 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7648
7649         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7650         Fix_v4bx enum values .
7651         * gold/options.h (General_options): New option definitions.
7652         (General_options::fix_v4bx): New method.
7653         (General_options::Fix_v4bx): New enum.
7654         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7655         (General_options::parse_fix_v4bx_interworking): New method.
7656
7657 2010-01-22  Doug Kwan  <dougkwan@google.com>
7658
7659         * arm.cc (Arm_exidx_fixup): New class.
7660
7661 2010-01-21  Doug Kwan  <dougkwan@google.com>
7662
7663         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7664         classes.
7665         (Arm_exidx_section_offset_map): New type.
7666
7667 2010-01-21  Doug Kwan  <dougkwan@google.com>
7668
7669         * arm.cc (Arm_exidx_input_section): New class.
7670         (Arm_relobj::exidx_input_section_by_link,
7671         Arm_relobj::exidx_input_section_by_shndx,
7672         Arm_relobj::make_exidx_input_section): New methods.
7673         (read_arm_attributes_section): Remove.
7674         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7675         information about them.
7676         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7677         to here.
7678
7679 2010-01-20  Doug Kwan  <dougkwan@google.com>
7680
7681         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7682         Input_section_specifier to Section_id.
7683         (Target_arm::new_arm_input_section: Adjust code for change of key
7684         type.
7685         (Target_arm::find_arm_input_section): Ditto.
7686         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7687         (Section_id): Remove.
7688         (Garbage_collection::Section_id_hash): Remove.
7689         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7690         (Section_id): Remove.
7691         (Icf::Section_id_hash): Remove.
7692         * object.h (Section_id, Const_section_id, Section_id_hash,
7693         Const_section_id_hash): New type definitions.
7694         * output.cc (Output_section::add_relaxed_input_section): Change to
7695         use Const_section_id instead of Input_section_specifier as key type.
7696         (Output_section::add_merge_input_section): Ditto.
7697         (Output_section::build_relaxation_map): Change to use Section_id
7698         instead of Input_section_specifier as key type.
7699         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7700         Ditto.
7701         (Output_section::convert_input_sections_to_relaxed_sections): Change
7702         to use Const_section_id instead of Input_section_specifier as key type.
7703         (Output_section::find_merge_section): Ditto.
7704         (Output_section::find_relaxed_input_section): Ditto.
7705         * output.h (Input_section_specifier): Remove class.
7706         (Output_section::Output_section_data_by_input_section_map): Change
7707         key type to Const_section_id.
7708         (Output_section::Output_relaxed_input_section_by_input_section_map):
7709         Ditto.
7710         (Output_section::Relaxation_map): Change key type to Section_id.
7711
7712 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7713
7714         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7715         (class Arm_v4bx_stub): New class.
7716         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7717         (Stub_factory::make_arm_v4bx_stub): New method.
7718         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7719         (Stub_table::empty): Handle v4bx stubs.
7720         (Stub_table::add_arm_v4bx_stub): New method.
7721         (Stub_table::find_arm_v4bx_stub): New method.
7722         (Arm_relocate_functions::v4bx): New method.
7723         (Target_arm::fix_v4bx): New method.
7724         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7725         (Stub_table::relocate_stubs): Likewise.
7726         (Stub_table::do_write): Likewise.
7727         (Stub_table::update_data_size_and_addralign): Likewise.
7728         (Stub_table::finalize_stubs):  Likewise.
7729         (Target_arm::Scan::local): Likewise.
7730         (Target_arm::Scan::global): Likewise.
7731         (Target_arm::do_finalize_sections): Likewise.
7732         (Target_arm::Relocate::relocate): Likewise.
7733         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7734         Likewise.
7735         (Target_arm::scan_reloc_for_stub): Likewise.
7736         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7737
7738 2010-01-19  Ian Lance Taylor  <iant@google.com>
7739
7740         * output.cc (Output_section_headers::do_sized_write): Write large
7741         segment count to sh_info field.
7742         (Output_file_header::do_sized_write): For large segment count,
7743         write PN_XNUM to e_phnum field.
7744
7745 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7746
7747         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7748         (Arm_relocate_functions::thm_jump8): New function.
7749         (Arm_relocate_functions::thm_jump11): New function.
7750         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7751         R_ARM_THM_JUMP11.
7752         (Target_arm::Scan::global): Likewise.
7753         (Target_arm::Relocate::relocate): Likewise.
7754         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7755         Likewise.
7756
7757 2010-01-14  Doug Kwan  <dougkwan@google.com>
7758
7759         * arm.cc (map, utility): Include headers.
7760         (Target_arm::apply_cortex_a8_workaround): New method.
7761         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7762         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7763         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7764         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7765         the --[no-]fix-cortex-a8 command line options.
7766         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7767         (Target_arm::relocate_stub): Use addend in instruction template.
7768         * options.h (DEFINE_bool): Set the user-set flag.
7769         (General_options): Add --[no-]-fix-cortex options.
7770         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7771         : Update fast look-up map after conversion.
7772
7773 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7774
7775         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7776         in the first pass of do_layout.
7777
7778 2010-01-13  Doug Kwan  <dougkwan@google.com>
7779
7780         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7781         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7782         apparent compiler problem of not folding static constant integral
7783         data members of elfcpp::Elf_sizes<32>.
7784
7785 2010-01-13  Doug Kwan  <dougkwan@google.com>
7786
7787         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7788         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7789         Arm_relobj::scan_section_for_cortex_a8_erratum,
7790         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7791         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7792         sections to scan for relocation stubs into a new method
7793         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7794         relocation and Cortex-A8 stub scanning.
7795         (Target_arm::do_relax): Force stubs to be after stubbed sections
7796         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7797         the beginning of a new relaxation pass.  Update a comment.
7798         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7799
7800 2010-01-12  Ian Lance Taylor  <iant@google.com>
7801
7802         * target-reloc.h (visibility_error): New inline function.
7803         (relocate_section): Call visibility_error.
7804         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7805         (MOSTLYCLEANFILES): Likewise.
7806         (protected_4_pic.o, protected_3.err): New targets.
7807         * testsuite/protected_4.cc: New file.
7808
7809 2010-01-12  Doug Kwan  <dougkwan@google.com>
7810
7811         * arm.cc (Cortex_a8_reloc): New class.
7812         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7813         and cortex_a8_relocs_info_.
7814         (Target_arm::fix_cortex_a8): New method definition.
7815         (Target_arm::Cortex_a8_relocs_info): New type.
7816         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7817         New data member declarations.
7818         (Target_arm::scan_reloc_for_stub): Record information about
7819         relocations for THUMB branches that might be exempted from the
7820         Cortex-A8 workaround.
7821         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7822         at the beginning of a relaxation pass.
7823
7824 2010-01-12  Doug Kwan  <dougkwan@google.com>
7825
7826         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7827         (Arm_relobj::Mapping_symbol_position,
7828          Arm_reloj::Mapping_symbol_position_less,
7829          Arm_relobj::Mapping_symbols_info): New types.
7830         (Target_arm::is_mapping_symbol_name): New method definition.
7831         (Arm_relobj::do_count_local_symbols): Save information about mapping
7832         symbols.
7833
7834 2010-01-11  Doug Kwan  <dougkwan@google.com>
7835
7836         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7837         Arm_relocate_functions::thumb32_branch_upper,
7838         Arm_relocate_functions::thumb32_branch_lower,
7839         Arm_relocate_functions::thumb32_cond_branch_offset,
7840         Arm_relocate_functions::thumb32_cond_branch_upper,
7841         Arm_relocate_functions::thumb32_cond_branch_lower,
7842         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7843         branch offset encoding.
7844         (Arm_relocate_functions::thumb_branch_common): Use new branch
7845         offset encoding methods to avoid code duplication.
7846         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7847         (Stub_addend_reader::operator()): Use new branch encoding method
7848         to avoid code duplication.
7849
7850 2010-01-11  Doug Kwan  <dougkwan@google.com>
7851
7852         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7853         (Target_arm::do_finalize_sections): Define special EXIDX section
7854         symbols only if referenced.
7855         * gc.h (Garbage_collection::add_reference): New method.
7856         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7857         code duplication.
7858
7859 2010-01-11  Ian Lance Taylor  <iant@google.com>
7860
7861         * script.cc (Version_script_info::build_expression_list_lookup):
7862         Change complaing about duplicate wildcard match from error to
7863         warning.
7864
7865         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7866         of 2009-12-30.
7867         (Version_script_info::Version_script_info): Initialize globs_,
7868         default_version_, default_is_global_, and exact_.  Don't
7869         initialize globals_ or locals_.
7870         (Version_script_info::build_lookup_tables): Build local symbols
7871         first.
7872         (Version_script_info::unquote): New function.
7873         (Version_script_info::add_exact_match): New function.
7874         (Version_script_info::build_expression_list_lookup): Remove lookup
7875         parameter.  Add is_global parameter.  Change all callers.  Handle
7876         wildcard pattern specially.  Unquote pattern.  Call
7877         add_exact_match.
7878         (Version_script_info::get_name_to_match): New function.
7879         (Version_script_info::get_symbol_version): New function.
7880         (Version_script_info::get_symbol_version_helper): Remove.
7881         (Version_script_info::check_unmatched_names): Call unquote.
7882         * script.h (class Version_script_info): Change get_symbol_version
7883         to be non-inline and add is_global parameter; change all callers.
7884         Rewrite symbol_is_local.  Update declarations.  Define struct
7885         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7886         Remove globals_ and locals_ members.  Add exact_, globs_,
7887         default_version_, is_global_.
7888         (Version_script_info::Glob): Remove pattern, add expression and
7889         is_global.  Update constructor.  Change all callers.
7890         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7891         default version.
7892         (Versions::symbol_section_contents): If a symbol is undefined, or
7893         defined in a dynamic object, set the version index to
7894         VER_NDX_LOCAL.
7895         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7896         symbol_is_local.
7897         (Symbol_table::add_from_pluginobj): Likewise.
7898         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7899
7900 2010-01-11  Doug Kwan  <dougkwan@google.com>
7901
7902         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7903         (incremental_dump_LDADD): Add linking option for libintl.
7904         * Makefile.in: Regenerate.
7905
7906 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7907
7908         PR gold/11144
7909         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7910         instead of -Ds.
7911         * testsuite/Makefile.in: Regenerated.
7912
7913 2010-01-10  Doug Kwan  <dougkwan@google.com>
7914
7915         * options.h (DEFINE_var): Use parentheses around argument varname__
7916         in macro body to avoid any unintended subsequent substitutions.
7917
7918 2010-01-10  Ian Lance Taylor  <iant@google.com>
7919
7920         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7921         candidates before doing symbol resolution.
7922
7923         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7924         ODR candidates if only one is weak.
7925
7926 2010-01-08  Ian Lance Taylor  <iant@google.com>
7927
7928         * script.cc (Version_script_info::build_expression_list_lookup):
7929         Don't warn about ambiguous version, just record the ambiguity.
7930         (Version_script_info::get_symbol_version_helper): Give error if
7931         version is ambiguous.
7932
7933 2010-01-08  Doug Kwan  <dougkwan@google.com>
7934
7935         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7936         prev_data_size_ and prev_addralign_.  Remove initializer for
7937         deleted data member has_been_changed_.
7938         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7939         to determine if the table is empty.
7940         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7941         Remove.
7942         (Stub_table::add_reloc_stub): Define method in class definition
7943         instead of just declaring it there.
7944         (Stub_table::add_cortex_a8_stub): New method definition.
7945         (Stub_table::update_data_size_and_addralign): Ditto.
7946         (Stub_table::finalize_stubs): Ditto.
7947         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7948         (Stub_table::do_addralign_): Return address alignment in the
7949         (Stub_table::do_reset_address_and_file_offset): Define method in
7950         class definition instead of declaring it there.  Set current data
7951         size to be the data size of the previous pass.
7952         (Stub_table::set_final_data_size): Use current data size as the
7953         final data size.
7954         (Stub_table::relocate_stub): Change parameter type of stub from
7955         Reloc_stub pointer to Stub pointer.
7956         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7957         (Stub_table::Cortex_a8_stub_list): New typedef.
7958         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7959          Stub_table::prev_addralign_): New data member.
7960         (Arm_relobj::Arm_relobj): Initialize data member
7961         section_has_cortex_a8_workaround_.
7962         (Arm_relobj::section_has_cortex_a8_workaround,
7963          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7964          definitions.
7965         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7966         declarations.
7967         (Target_arm::relocate_stub): Change parameter type of stub from
7968         Reloc_stub pointer to Stub pointer.
7969         (Insn_template::size, Insn_template::alignment): Handle
7970         THUMB16_SPECIAL_TYPE.
7971         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7972          Stub_table::update_data_size_and_addralign,
7973          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7974         definitions.
7975         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7976         (Stub_table::do_write): Ditto.
7977         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7978
7979 2010-01-08  Ian Lance Taylor  <iant@google.com>
7980
7981         PR 11108
7982         * symtab.h (class Symbol): Remove fields is_target_special_ and
7983         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7984         (Symbol::is_defined_in_discarded_section): New function.
7985         (Symbol::set_is_defined_in_discarded_section): New function.
7986         (Symbol::has_plt_offset): Rewrite.
7987         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7988         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7989         Don't initialize is_target_special_ or has_plt_offset_.
7990         Initialize is_defined_in_discarded_section_.
7991         (Symbol_table::add_from_relobj): If appropriate, set
7992         is_defined_in_discarded_section.
7993         * resolve.cc (Symbol::override_base_with_special): Don't test
7994         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7995         * target-reloc.h (relocate_section): Do special handling for
7996         symbols defined in discarded sections for global symbols as well
7997         as local symbols.
7998
7999 2010-01-08  Ian Lance Taylor  <iant@google.com>
8000
8001         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8002         the SHT_SYMTAB case.
8003
8004 2010-01-08  Ian Lance Taylor  <iant@google.com>
8005
8006         * object.cc (Sized_relobj::do_layout): Don't get confused if
8007         layout_eh_frame returns NULL.
8008
8009 2010-01-08  Ian Lance Taylor  <iant@google.com>
8010
8011         PR 11084
8012         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8013         dynamic symbol table, use the normal symbol table.
8014         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8015         symbol table.
8016
8017 2010-01-08  Ian Lance Taylor  <iant@google.com>
8018
8019         PR 11072
8020         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8021         sections.
8022
8023 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8024
8025         * version.cc (print_version): Change to "Copyright 2010".
8026
8027 2010-01-08  Ian Lance Taylor  <iant@google.com>
8028
8029         PR 10287
8030         PR 11063
8031         * i386.cc (class Target_i386): Change return type of plt_section
8032         to be non-const.
8033         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8034         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8035         tls_desc_rel_ field.
8036         (Output_data_plt_i386::rel_tls_desc): New function.
8037         (Target_i386::rel_tls_desc_section): New function.
8038         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8039         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8040         R_386_TLS_DESC reloc in rel_tls_desc_section.
8041         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8042         Define struct Tlsdesc_info.
8043         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8044         (Target_x86_64::do_reloc_symbol_index): New function.
8045         (Target_x86_64::add_tlsdesc_info): New function.
8046         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8047         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8048         tlsdesc_rel_ field.
8049         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8050         all callers.
8051         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8052         (Target_x86_64::rela_tlsdesc_section): New function.
8053         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8054         handling.
8055         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8056         (Target_x86_64::do_reloc_addend): New function.
8057         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8058         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8059         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8060         (Output_reloc::type): New function.
8061         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8062         (Output_reloc::is_target_specific): New function.
8063         (Output_reloc::target_arg): New function.
8064         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8065         absolute relocs and target specific relocs.
8066         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8067         add_target_specific.
8068         (class Output_data_reloc) [SHT_RELA]: Likewise.
8069         * output.cc (Output_reloc::Output_reloc): Add four new versions
8070         for absolute relocs and target specific relocs.
8071         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8072         (Output_reloc::get_symbol_index): Likewise.
8073         (Output_reloc::local_section_offset): Check that local_sym_index_
8074         is not TARGET_CODE or 0.
8075         (Output_reloc::symbol_value): Likewise.
8076         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8077         reloc.
8078         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8079         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8080         functions.
8081         * layout.cc (add_target_dynamic_tags): Use output section for
8082         DT_PLTRELSZ and DT_JMPREL.
8083
8084 2010-01-07  Ian Lance Taylor  <iant@google.com>
8085
8086         PR 11061
8087         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8088         function.
8089         (class Output_data_reloc_generic): Define.
8090         (class Output_data_reloc_base): Change base class to
8091         Output_data_reloc_generic.  Change add() method to call
8092         bump_relative_reloc_count for a relative reloc.  Remove
8093         sort_relocs_ field.
8094         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8095         to sort_relocs().
8096         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8097         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8098         appropriate.
8099         * layout.h (class Layout): Update declaration.
8100
8101 2010-01-07  Ian Lance Taylor  <iant@google.com>
8102
8103         * output.h (class Output_data): Add const version of
8104         output_section and do_output_section.
8105         (class Output_section_data): Add const version of
8106         do_output_section.
8107         (class Output_section): Likewise.
8108         * layout.cc (Layout::add_target_dynamic_tags): New function.
8109         * layout.h (class Layout): Update declarations.
8110         * arm.cc (Target_arm::do_finalize_sections): Use
8111         add_target_dynamic_tags.
8112         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8113         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8114         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8115         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8116
8117 2010-01-07  Ian Lance Taylor  <iant@google.com>
8118
8119         PR 11042
8120         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8121         object as needed.
8122
8123 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8124             Ian Lance Taylor  <iant@google.com>
8125
8126         PR 11019
8127         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8128         Xindex::read_symtab_xindex.
8129
8130 2010-01-07  Doug Kwan  <dougkwan@google.com>
8131
8132         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8133         (Insn_template::thumb16_bcond_insn): New method declaration.
8134         (Insn_template): Fix spelling.
8135         (Stub::thumb16_special): New method declaration.
8136         (Stub::do_write): Define virtual method which was previously pure
8137         virtual.
8138         (Stub::do_thumb16_special): New method declaration.
8139         (Stub::do_fixed_endian_write): New template member.
8140         (Reloc_stub::do_write): Remove.
8141         (Reloc_stub::do_fixed_endian_write): Remove.
8142         (Cortex_a8_stub): New class definition.
8143         (Stub_factory::make_cortex_a8_stub): New method definition.
8144         (Stub_factory::Stub_factory): Add missing static storage class
8145         qualifier for elf32_arm_stub_a8_veneer_blx.
8146
8147 2010-01-07  Ian Lance Taylor  <iant@google.com>
8148
8149         PR 10980
8150         * options.h (class General_options): Add --warn-unresolved-symbols
8151         and --error-unresolved-symbols.
8152         * errors.cc (Errors::undefined_symbol): Implement
8153         --warn-unresolved-symbols.
8154
8155         * options.h (class General_options): Add -z text and -z textoff.
8156         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8157
8158 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8159
8160         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8161         (Garbage_collection::cident_sections): New function.
8162         (Garbage_collection::add_cident_section): New function.
8163         (Garbage_collection::cident_sections_): New member.
8164         (gc_process_relocs): Add references to sections whose names are C
8165         identifiers.
8166         * gold.h (cident_section_start_prefix): New constant.
8167         (cident_section_stop_prefix): New constant.
8168         (is_cident): New function.
8169         * layout.cc (Layout::define_section_symbols): Replace string constants
8170         with the newly defined constants.
8171         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8172         C identifiers.
8173         * testsuite/Makefile.am: Add gc_orphan_section_test.
8174         * testsuite/Makefile.in: Regenerate.
8175         * testsuite/gc_orphan_section_test.cc: New file.
8176         * testsuite/gc_orphan_section_test.sh: New file.
8177
8178 2010-01-06  Ian Lance Taylor  <iant@google.com>
8179
8180         PR 10980
8181         * options.h (class General_options): Add --warn-shared-textrel.
8182         * layout.cc (Layout::finish_dynamic_section): Implement
8183         --warn-shared-textrel.
8184
8185         PR 10980
8186         * options.h (class General_options): Add --warn-multiple-gp.
8187
8188 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8189
8190         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8191         $(THREADSLIB) and $(LIBDL).
8192         * Makefile.in: Rebuild.
8193
8194 2010-01-06  Ian Lance Taylor  <iant@google.com>
8195
8196         PR 10980
8197         * options.cc (General_options::parse_section_start): New function.
8198         (General_options::section_start): New function.
8199         (General_options::General_options): Initialize all members.
8200         * options.h: Include <map>
8201         (class General_options): Add --section-start.  Add section_starts_
8202         member.
8203         * layout.cc (Layout::attach_allocated_section_to_segment): If
8204         --section-start was used, set the address of the segment.  Remove
8205         local sort_sections.
8206         (Layout::relaxation_loop_body): If the address of the load segment
8207         has been set by --section-start, don't use it.
8208         * output.h (Output_segment::update_flags_for_output_section): New
8209         function.
8210         * output.cc (Output_segment::add_output_section): Call
8211         update_flags_for_output_section.
8212
8213 2010-01-05  Ian Lance Taylor  <iant@google.com>
8214
8215         PR 10980
8216         * options.h (class General_options): Add --undefined-version.
8217         * script.cc (struct Version_expression): Add was_matched_by_symbol
8218         field.
8219         (Version_script_info::matched_symbol): New function.
8220         (Version_script_info::get_symbol_version_helper): Call
8221         matched_symbol.
8222         (Version_script_info::check_unmatched_names): New function.
8223         * script.h (class Version_script_info): Update declarations.
8224         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8225
8226         * options.h (class General_options): Use DEFINE_bool_alias for
8227         allow_multiple_definition.
8228         * resolve.cc (Symbol_table::should_override): Don't test
8229         allow_multiple_definition.
8230
8231         PR 10980
8232         * options.h (class General_options): Add --cref.
8233         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8234         until after printing cref table.
8235         * cref.cc: Include "symtab.h".
8236         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8237         (Cref_table_compare::operator()): New function.
8238         (Cref_inputs::gather_cref): New function.
8239         (filecol): New static const.
8240         (Cref_inputs::print_cref): New function.
8241         (Cref::print_cref): New function.
8242         * cref.h: Include <cstdio>.
8243         (class Cref): Update declarations.
8244         * mapfile.h (Mapfile::file): New function.
8245         * object.h (class Object): Define Symbols.  Declare virtual
8246         do_get_global_symbols.
8247         (Object::get_global_symbols): New function.
8248         * object.cc (Input_objects::add_object): Pass object to cref_ if
8249         --cref.
8250         (Input_objects::archive_start): Likewise.
8251         (Input_objects::archive_stop): Likewise.
8252         (Input_objects::print_cref): New function.
8253         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8254         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8255         --cref.
8256         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8257         function.
8258         * plugin.h (class Sized_pluginobj): Update declarations.
8259
8260 2010-01-05  Ian Lance Taylor  <iant@google.com>
8261
8262         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8263         to is_default_version.  Rename insdef to insdefault.
8264         (Symbol_table::add_from_relobj): Rename def to is_default_version
8265         and local to is_forced_local.
8266         (Symbol_table::add_from_pluginobj): Likewise.
8267         (Symbol_table::add_from_dynobj): Likewise.
8268         (Symbol_table::define_special_symbol): Rename insdef to
8269         insdefault.
8270
8271 2010-01-04  Ian Lance Taylor  <iant@google.com>
8272
8273         PR 10980
8274         * options.h (class General_options): Add
8275         --allow-multiple-definition and -z muldefs.
8276         * resolve.cc (Symbol_table::should_override): Don't warn about a
8277         multiple symbol definition if --allow-multiple-definition or -z
8278         muldefs.
8279
8280         PR 10980
8281         * options.h (class General_options): Add --add-needed and
8282         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8283         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8284         error if --copy-dt-needed-entries aka --add-needed is used and
8285         would cause a change in behaviour.
8286
8287         PR 10980
8288         * options.h (class General_options): Add -G as a short version of
8289         --shared.  Add no-op options -assert, -g, and -i.
8290
8291 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8292
8293         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8294         check for .text or .gnu.linkonce.t sections.
8295         * icf.cc (Icf::find_identical_sections): Ditto.
8296         Change the detection for mangled function name within the section
8297         name.
8298         * icf.h (is_section_foldable_candidate): New function.
8299
8300 2009-12-30  Ian Lance Taylor  <iant@google.com>
8301
8302         PR 10980
8303         * options.h (class General_options): Permit two dashes with
8304         --retain-symbols-file.
8305
8306 2009-12-30  Ian Lance Taylor  <iant@google.com>
8307
8308         PR 10979
8309         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8310         don't put the file header and segment headers in the text
8311         segment.
8312
8313         PR 10979
8314         * common.cc (Sort_commons::operator()): Stabilize sort when both
8315         entries are NULL.
8316         (Symbol_table::do_allocate_commons_list): When allocating common
8317         symbols, skip a symbol which is no longer common.
8318         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8319         an object before checking its type.
8320         * testsuite/common_test_2.c: New file.
8321         * testsuite/common_test_3.c: New file.
8322         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8323         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8324         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8325         (common_test_2_pic.o, common_test_2.so): New targets.
8326         (common_test_3_pic.o, common_test_3.so): New targets.
8327         * testsuite/Makefile.in: Rebuild.
8328
8329         PR 10979
8330         * script.cc (read_input_script): If we see a new SECTIONS clause,
8331         and we have added an input section, give an error.
8332         * layout.h (class Layout): Add have_added_input_section function.
8333         Add have_added_input_section_ field.
8334         * layout.cc (Layout::Layout): Initialize
8335         have_added_input_section_.
8336         (Layout::layout): Set have_added_input_section_.
8337         (Layout::layout_eh_frame): Likewise.
8338
8339 2009-12-30  Ian Lance Taylor  <iant@google.com>
8340
8341         PR 10931
8342         * options.h (class General_options): Add --sort-common option.
8343         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8344         * common.cc (Sort_common): Add sort_order parameter to
8345         constructor.  Add sort_order_ field.
8346         (Sort_commons::operator): Check sort_order_.
8347         (Symbol_table::allocate_commons): Determine the sort order.
8348         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8349         Change all callers.
8350         (Symbol_table::do_allocate_commons_list): Likewise.
8351
8352 2009-12-30  Ian Lance Taylor  <iant@google.com>
8353
8354         PR 10916
8355         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8356         symbols from this object, don't change the visibility of an
8357         undefined symbol.
8358         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8359
8360 2009-12-30  Ian Lance Taylor  <iant@google.com>
8361
8362         PR 10861
8363         * script.h (class Version_script_info): Define Language enum.
8364         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8365         new fields globals_, locals_, and is_finalized_.
8366         * script.cc: Various formatting fixes.
8367         (class Parser_closure): Change language_stack_ from a vector of
8368         std::string to one of Version_script_info::Language.  Adjust all
8369         uses accordingly.
8370         (class Lazy_demangler): Remove.
8371         (struct Version_expression): Change language from std::string to
8372         Version_script_info::Language.
8373         (Version_script_info::Version_script_info): New function.
8374         (Version_script_info::~Version_script_info): Don't call clear.
8375         (Version_script_info::finalize): New function.
8376         (Version_script_info::build_lookup_tables): New function.
8377         (Version_script_info::build_expression_list_lookup): New
8378         function.
8379         (Version_script_info::get_symbol_version_helper): Rewrite to use
8380         lookup tables.
8381         (Version_script_info::print_expression_list): Adjust to use
8382         Version_script_info::Language.
8383         (script_push_lex_into_version_mode): Check that the version script
8384         has not been finalized.
8385         (version_script_push_lang): Change language string to
8386         Version_script_info::Language.
8387         * options.cc (Command_line::version_script): New function.
8388         * options.h (class General_options): Add finalize_dynamic_list
8389         function.  Change version_script from declaration to definition.
8390         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8391         * testsuite/version_script.map: Remove duplicate def of foo.
8392         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8393         version_script.map.
8394         * testsuite/Makefile.in: Rebuild.
8395
8396 2009-12-30  Ian Lance Taylor  <iant@google.com>
8397
8398         PR 10843
8399         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8400         if the input symbol index is 0, make the output symbol index 0.
8401
8402 2009-12-30  Ian Lance Taylor  <iant@google.com>
8403
8404         PR 10670
8405         * options.h (class General_options): Add -x/--discard-all.
8406         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8407         --discard-all.  If the local symbol needs a dynamic entry, check
8408         that before handling --discard-locals.
8409
8410 2009-12-30  Ian Lance Taylor  <iant@google.com>
8411
8412         PR 10450
8413         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8414         flags to PF_R.
8415         (Output_segment::add_output_section): Don't change the flags if
8416         the type is PT_TLS.
8417
8418         PR 10450
8419         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8420         GNU hash table if they need a dynamic value.  Otherwise, don't add
8421         them if they are defined in a dynamic object or are forced local.
8422
8423 2009-12-29  Ian Lance Taylor  <iant@google.com>
8424
8425         PR 10450
8426         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8427         .gnu.hash table for a 32-bit target.
8428
8429         PR 10450
8430         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8431         regular and a dynamic object only needs a dynamic symbol table
8432         entry if it is externally visible.
8433
8434         PR 10450
8435         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8436         constructor.  Add global_offset_table_ field.
8437         (Target_i386::got_section): Set global_offset_table_.
8438         (Target_i386::do_finalize_sections): Set global_offset_table_
8439         size.
8440         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8441         in constructor.  Add global_offset_table_ field.
8442         (Target_x86_64::got_section): Set global_offset_table_.
8443         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8444         size.
8445
8446         * layout.cc (Layout::Layout): Initialize increase_relro_.
8447         (Layout::get_output_section): Add is_relro, is_last_relro, and
8448         is_first_non_relro parameters.  Change all callers.
8449         (Layout::choose_output_section): Likewise.
8450         (Layout::add_output_section_data): Likewise.
8451         (Layout::make_output_section): Likewise.
8452         (Layout::set_segment_offsets): Clear increase_relro when using a
8453         linker script.
8454         * layout.h (class Layout): Add increase_relro method.  Add
8455         increase_relro_ field.  Update declarations.
8456         * output.cc (Output_section::Output_section): Initialize
8457         is_last_relro_ and is_first_non_relro_.
8458         (Output_segment::add_output_section): Group relro sections is
8459         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8460         (Output_segment::maximum_alignment): Remove relro handling.
8461         (Output_segment::set_section_addresses): Add increase_relro
8462         parameter.  Change all callers.  Add initial alignment to align
8463         relro sections on separate page.  Remove old relro handling.
8464         (Output_segment::set_section_list_addresses): Remove in_relro
8465         parameter.  Change all callers.
8466         (Output_segment::set_offset): Add increase parameter.  Change all
8467         callers.  Remove old relro handling.
8468         * output.h (class Output_section): Add new methods: is_last_relro,
8469         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8470         Add is_last_relro_ and is_first_non_relro_ fields.
8471         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8472         Create separate .got.plt section.  Call increase_relro.
8473         * x86_64.cc (Target_x86_64::got_section): Likewise.
8474         * testsuite/relro_script_test.t: Add .got.plt.
8475
8476         PR 10450
8477         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8478         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8479         (Layout::finalize): Call set_dynamic_symbol_size.
8480         (Layout::set_dynamic_symbol_size): New function.
8481         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8482         set_dynamic_symbol_size.
8483
8484         PR 10450
8485         * output.h (class Output_section): Add is_entsize_zero_ field.
8486         * output.cc (Output_section::Output_section): Initialize
8487         is_entsize_zero_.
8488         (Output_section::set_entsize): If two different entsizes are
8489         requested, force it to zero.
8490         (Output_section::add_input_section): Set flags for .debug_str
8491         before updating section flags.  Set entsize.
8492         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8493         and SHF_STRING if all input sections have those flags.
8494
8495 2009-12-29   Rafael Espindola  <espindola@google.com>
8496
8497         * main.cc (main): Fix the sys time reporting.
8498         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8499         reporting.
8500
8501 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8502
8503         * options.cc (General_options::parse_version): Allow -v to exit
8504         without an error if there is nothing to link.
8505
8506 2009-12-29  Ian Lance Taylor  <iant@google.com>
8507
8508         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8509         using a version of gcc before 4.1.
8510         * configure: Rebuild.
8511
8512 2009-12-28  Chris Demetriou  <cgd@google.com>
8513
8514         * attributes.cc (Output_attributes_section_data::do_write): Use
8515         std::vector::front rather than std::vector::data.
8516
8517 2009-12-28  Ian Lance Taylor  <iant@google.com>
8518
8519         * symtab.h (class Symbol_table): Add enum Defined.
8520         * resolve.cc (Symbol_table::should_override): Add defined
8521         parameter.  Change all callers.  Test whether object is NULL
8522         before calling a method on it.
8523         (Symbol_table::report_resolve_problem): Add defined parameter.
8524         Change all callers.
8525         (Symbol_table::should_override_with_special): Likewise.
8526         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8527         parameter.  Change all callers.
8528         (Symbol_table::do_define_in_output_data): Likewise.
8529         (Symbol_table::define_in_output_segment): Likewise.
8530         (Symbol_table::do_define_in_output_segment): Likewise.
8531         (Symbol_table::define_as_constant): Likewise.
8532         (Symbol_table::do_define_as_constant): Likewise.
8533         * script.h (class Symbol_assignment): Add is_defsym parameter to
8534         constructor; change all callers.
8535         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8536         parameter.  Change all callers.  Add is_defsym_ field.
8537         (class Parser_closure): Add parsing_defsym parameter to
8538         constructor; change all callers.  Add parsing_defsym accessor
8539         function.  Add parsing_defsym_ field.
8540
8541 2009-12-28  Ian Lance Taylor  <iant@google.com>
8542
8543         * gold.cc (queue_middle_tasks): Fix formatting.
8544         * object.cc (Relobj::is_section_name_included): Likewise.
8545
8546 2009-12-23  Ian Lance Taylor  <iant@google.com>
8547
8548         * i386.cc (Target_i386::do_calls_non_split): Recognize
8549         -fsplit-stack prologue for a function with a static chain.
8550         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8551         -fsplit-stack prologue when using %r11.
8552
8553 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8554
8555         * options.cc (General_options::parse_version): Make -v continue and do
8556         the link like GNU ld does.
8557
8558 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8559
8560         * Makefile.am (CCFILES): Add timer.cc.
8561         (HFILES): Add timer.h.
8562         * configure.ac: Check for sysconf and times.
8563         * main.cc: include timer.h.
8564         (main): Use Timer instead of get_run_time.
8565         * timer.cc: New.
8566         * timer.h: New.
8567         * workqueue.cc: include timer.h.
8568         (Workqueue::find_and_run_task):
8569         Report user, sys and wall time.
8570         * Makefile.in: Regenerate.
8571         * config.in: Regenerate.
8572         * configure: Regenerate.
8573
8574 2009-12-16  Doug Kwan  <dougkwan@google.com>
8575
8576         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8577         sections.
8578         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8579         relaxed input sections.
8580         * output.cc (Output_section::find_relaxed_input_section): Change
8581         return type to Output_relaxed_input_section pointer.  Adjust code
8582         for new type of relaxed_input_section_map_.
8583         * output.h (Output_section::find_relaxed_input_section): Change
8584         return type to Output_relaxed_input_section pointer.
8585         (Output_section::Output_relaxed_input_section_by_input_section_map):
8586         New type.
8587         (Output_section::relaxed_input_section_map_): Change type to
8588         Output_section::Output_relaxed_input_section_by_input_section_map.
8589         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8590         input section.
8591
8592 2009-12-15  Ian Lance Taylor  <iant@google.com>
8593
8594         * layout.cc (Layout::create_shstrtab): Only write out after input
8595         sections if we are compressing debug sections.
8596
8597 2009-12-15  Ian Lance Taylor  <iant@google.com>
8598
8599         * archive.cc (Archive::add_symbols): Only look up a symbol without
8600         a version if there is, in fact, a version.
8601
8602 2009-12-14  Ian Lance Taylor  <iant@google.com>
8603
8604         Revert -Wshadow changes, all changes from:
8605         2009-12-11  Doug Kwan  <dougkwan@google.com>
8606         2009-12-11  Nick Clifton  <nickc@redhat.com>
8607         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8608
8609 2009-12-11  Doug Kwan  <dougkwan@google.com>
8610
8611         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8612         due to -Wshadow.
8613         * attributes.cc (Object_attribute::size): Ditto.
8614         (Attributes_section_data::size): Ditto.
8615         (Attributes_section_data::Attributes_section_data): Ditto.
8616         (Output_attributes_section_data::do_write): Ditto.
8617         * attributes.h (Object_attribute::set_type): Ditto.
8618         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8619
8620 2009-12-11  Nick Clifton  <nickc@redhat.com>
8621
8622         * archive.cc: Fix shadowed variable warnings.
8623         * arm.cc: Likewise.
8624         * compressed_output.cc: Likewise.
8625         * compressed_output.h: Likewise.
8626         * configure: Likewise.
8627         * dwarf_reader.cc: Likewise.
8628         * dynobj.cc: Likewise.
8629         * dynobj.h: Likewise.
8630         * ehframe.cc: Likewise.
8631         * ehframe.h: Likewise.
8632         * errors.cc: Likewise.
8633         * expression.cc: Likewise.
8634         * fileread.cc: Likewise.
8635         * fileread.h: Likewise.
8636         * freebsd.h: Likewise.
8637         * i386.cc: Likewise.
8638         * icf.cc: Likewise.
8639         * incremental.h: Likewise.
8640         * layout.cc: Likewise.
8641         * layout.h: Likewise.
8642         * mapfile.cc: Likewise.
8643         * merge.cc: Likewise.
8644         * merge.h: Likewise.
8645         * object.cc: Likewise.
8646         * object.h: Likewise.
8647         * options.h: Likewise.
8648         * output.cc: Likewise.
8649         * output.h: Likewise.
8650         * parameters.cc: Likewise.
8651         * plugin.cc: Likewise.
8652         * powerpc.cc: Likewise.
8653         * reduced_debug_output.cc: Likewise.
8654         * reduced_debug_output.h: Likewise.
8655         * reloc.cc: Likewise.
8656         * reloc.h: Likewise.
8657         * resolve.cc: Likewise.
8658         * script-sections.cc: Likewise.
8659         * script.cc: Likewise.
8660         * script.h: Likewise.
8661         * sparc.cc: Likewise.
8662         * symtab.cc: Likewise.
8663         * symtab.h: Likewise.
8664         * target-select.cc: Likewise.
8665         * target-select.h: Likewise.
8666         * token.h: Likewise.
8667         * workqueue.cc: Likewise.
8668         * workqueue.h: Likewise.
8669         * x86_64.cc: Likewise.
8670
8671 2009-12-10  Doug Kwan  <dougkwan@google.com>
8672
8673         * arm.cc (attributes.h): New include.
8674         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8675         (Arm_relobj::~Arm_relobj): Delete object pointed by
8676         attributes_section_data_.
8677         (Arm_relobj::attributes_section_data): New method definition.
8678         (Arm_relobj::attributes_section_data_): New data member declaration.
8679         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8680         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8681         attributes_section_data_.
8682         (Arm_dynobj::attributes_section_data): New method definition.
8683         (Arm_dynobj::attributes_section_data_): New data member declaration.
8684         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8685         initialization value of may_use_blx_ to false.
8686         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8687         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8688         object attributes to compute results instead of hard-coding.
8689         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8690         Target_arm::get_secondary_compatible_arch,
8691         Target_arm::set_secondary_compatible_arch
8692         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8693         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8694         New method declarations.
8695         (Target_arm::get_aeabi_object_attribute): New method definition.
8696         (Target_arm::attributes_section_data_): New data member declaration.
8697         (read_arm_attributes_section): New template definition.
8698         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8699         (Arm_dynobj::do_read_symbols): Ditto.
8700         (Target_arm::do_finalize_sections): Merge attributes sections from
8701         input.  Check for BLX use after attributes section merging.
8702         Fix __exidx_start and __exidx_end visibility.  Create an
8703         .ARM.attributes section if necessary.
8704         (Target_arm::get_secondary_compatible_arch,
8705         Target_arm::set_secondary_compatible_arch,
8706         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8707         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8708         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8709         New method definitions.
8710
8711 2009-12-09  Ian Lance Taylor  <iant@google.com>
8712
8713         * plugin.cc (Plugin::load): Don't cast from void* to a function
8714         pointer.
8715
8716 2009-12-09  Ian Lance Taylor  <iant@google.com>
8717
8718         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8719         information fields.
8720
8721 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8722
8723         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8724         Replace two_file_shared_1.so with two_file_shared_2.so.
8725         * testsuite/Makefile.in: Regenerated.
8726
8727 2009-12-08  Doug Kwan  <dougkwan@google.com>
8728
8729         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8730         (HFILES): Add attributes.h and int_encoding.h.
8731         * Makefile.in: Regenerate.
8732         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8733         function definitions to int_encoding.cc
8734         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8735         prototypes to int_encoding.h
8736         * reduced_debug_output.cc (int_encoding.h): New include.
8737         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8738         function definitions to int_encoding.cc
8739         (insert_into_vector, read_from_pointer): Move template definitions to
8740         int_encoding.h
8741         * attributes.cc: New file.
8742         * attributes.h: New file.
8743         * int_encoding.cc: New file.
8744         * int_encoding.h: New file.
8745
8746 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8747
8748         PR gold/11055
8749         * incremental-dump.cc (dump_incremental_inputs): New.
8750         (main): Use dump_incremental_inputs.
8751
8752 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8753
8754         PR gold/10893
8755         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8756         checking elfcpp::STT_FUNC.
8757         (Target_i386::Relocate::relocate): Likewise.
8758         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8759
8760         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8761         symbols from shared libraries into normal FUNC symbols.
8762
8763         * symtab.h (Symbol): Add is_func and use it.
8764
8765 2009-12-05  Doug Kwan  <dougkwan@google.com>
8766
8767         * arm.cc (Target_arm::arm_info): Initialize new fields
8768         attributes_section and attributes_vendor.
8769         * i386.cc (Target_i386::i386_info): Same.
8770         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8771         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8772         fields attributes_section and attributes_vendor.
8773         * sparc.cc (Target_sparc::sparc_info): Same.
8774         * target.h (Target::attributes_section, Target::attributes_vendor,
8775         Target::is_attributes_section, Target::attribute_arg_type,
8776         Target::attributes_order): New method definitions.
8777         (Target::Target_info::attributes_section,
8778         Target::Target_info::attributes_vendor): New fields.
8779         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8780         virtual method definitions.
8781         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8782         attributes_section and attributes_vendor.
8783         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8784
8785 2009-12-05  Doug Kwan  <dougkwan@google.com>
8786
8787         * arm.cc: Update comments about interworking and stub generation.
8788         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8789         considered as non-PIC.
8790         (Arm_relocate_functions::base_abs): Fix formatting.
8791         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8792         of function to use GOT entry address instead of offset.
8793         (Target_arm::Scan::global): Issue an error if a symbol would need a
8794         PLT does not get one because it is untyped.  Remove code to create
8795         dynamic symbols for relative branches.
8796         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8797         takes unsigned integer instead of boolean.
8798
8799 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8800
8801         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8802         (two_file_test_LDADD): Likewise.
8803         (common_test_1_LDADD): Likewise.
8804         (exception_test_LDADD) Likewise.
8805         (weak_test_LDADD): Likewise.
8806         (many_sections_test_LDADD): Likewise.
8807         (initpri1_LDADD): Likewise.
8808         (script_test_1_LDADD): Likewise.
8809         (script_test_2_LDADD): Likewise.
8810         (justsyms_LDADD): Likewise.
8811         (binary_test_LDADD): Likewise.
8812         (large_LDADD): Likewise.
8813         * testsuite/Makefile.in: Regenerated.
8814
8815 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8816
8817         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8818         (Symbol_table::override_with_special): Likewise.
8819         (Symbol_table::add_from_object): Likewise.
8820
8821 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8822
8823         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8824         Don't set the data_offset twice.
8825
8826 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8827
8828         * testsuite/Makefile.in: Regenerate.
8829
8830 2009-12-03  Doug Kwan  <dougkwan@google.com>
8831
8832         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8833         (Target_arm::do_finalize_sections): Add parameter for symbol table
8834         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8835         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8836         parameter for symbol table pointer.
8837         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8838         an additional parameter for a pointer to symbol table.
8839         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8840         parameter for a symbol table pointer.
8841         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8842         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8843         Ditto.
8844         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8845         parameter for a symbol table pointer.
8846
8847 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8848
8849         * incremental.cc (Incremental_inputs_header)
8850         (Incremental_inputs_header_write, Incremental_inputs_entry)
8851         (Incremental_inputs_entry_write): Move ...
8852         * incremental.h (Incremental_inputs_header)
8853         (Incremental_inputs_header_write, Incremental_inputs_entry)
8854         (Incremental_inputs_entry_write): here.
8855
8856 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8857
8858         * incremental.cc (make_sized_incremental_binary): Set the target.
8859         Error if it is incompatible.
8860         * output.h (Output_file): Add filename method.
8861
8862 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8863
8864         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8865         from the get_* methods.
8866
8867 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8868
8869         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8870         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8871         Write 0 for the data_offset of scripts.
8872
8873 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8874
8875         * testsuite/Makefile.am: Add the incremental_test.sh test.
8876         * testsuite/incremental_test.sh: New.
8877         * testsuite/incremental_test_1.c: New.
8878         * testsuite/incremental_test_2.c: New.
8879
8880 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8881
8882         * incremental-dump.cc (main): Fix typos.
8883
8884 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8885
8886         PR gold/11025
8887         * incremental-dump.cc (main): Use llu to print 64 bit values.
8888
8889 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8890             H.J. Lu  <hongjiu.lu@intel.com>
8891
8892         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8893         $(LIBDL).
8894         (incremental_dump_LDADD): Likewise.
8895         * Makefile.in: Regenerated.
8896
8897 2009-11-25  Doug Kwan  <dougkwan@google.com>
8898
8899         Revert:
8900
8901         2009-11-25  Doug Kwan  <dougkwan@google.com>
8902
8903                 * arm.cc (Target_arm::Target_arm): Move method definition
8904                 outside of class definition.  Add code to handle
8905                 --target1-rel, --target1-abs and --target2= options.
8906                 (Target_arm::get_reloc_reloc_type): Change method to be
8907                 non-static and const.
8908                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8909                 New data member declaration.
8910                 (Target_arm::Scan::local, Target_arm::Scan::global,
8911                 Target_arm::Relocate::relocate,
8912                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8913                 Adjust call to Target_arm::get_real_reloc_type.
8914                 (Target_arm::get_real_reloc_type): Use command line options
8915                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8916                 * options.h (--target1-rel, --target1-abs, --target2): New
8917                 ARM-only options.
8918
8919 2009-11-25  Doug Kwan  <dougkwan@google.com>
8920
8921         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8922         class definition.  Add code to handle --target1-rel, --target1-abs
8923         and --target2= options.
8924         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8925         and const.
8926         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8927         member declaration.
8928         (Target_arm::Scan::local, Target_arm::Scan::global,
8929         Target_arm::Relocate::relocate,
8930         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8931         call to Target_arm::get_real_reloc_type.
8932         (Target_arm::get_real_reloc_type): Use command line options to
8933         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8934         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8935         options.
8936
8937 2009-11-25  Doug Kwan  <dougkwan@google.com>
8938
8939         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8940         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8941         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8942         formatting.
8943         (Arm_relocate_functions::thm_call): Replace body with a call to
8944         Arm_relocate_functions::thumb_branch_common.
8945         (Arm_relocate_functions::thm_jump24,
8946         Arm_relocate_functions::thm_xpc22): New method definitions.
8947         (Arm_relocate_functions::thumb_branch_common): New method definition.
8948         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8949         operator.
8950         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8951         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8952
8953 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8954
8955         * Makefile.am: Build incremental-dump
8956         * Makefile.in: Regenerate.
8957         * incremental-dump.cc: New.
8958         * incremental.cc (Incremental_inputs_header_data,
8959         Incremental_inputs_entry_data): Move to incremental.h
8960         * incremental.h: (Incremental_inputs_header_data,
8961         Incremental_inputs_entry_data): Move from incremental.cc
8962
8963 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8964
8965         * incremental.cc (Incremental_inputs_header,
8966         Incremental_inputs_header_write, Incremental_inputs_entry,
8967         Incremental_inputs_entry_write): Add a typedef with the data type.
8968
8969 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8970
8971         * incremental.cc (Incremental_inputs_header,
8972         Incremental_inputs_header_write, Incremental_inputs_entry,
8973         Incremental_inputs_entry_write): Update comment about which
8974         type has the filed descriptions.
8975
8976 2009-11-15  Doug Kwan  <dougkwan@google.com>
8977
8978         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8979         (Arm_relocate_functions::arm_branch_common): Change method defintion
8980         in class definition to a method declaration and update list of formal
8981         parameters.
8982         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8983         Arm_relocation_functions::jump24): Adjust call to
8984         Arm_relocate_functions::arm_branch_common.  Update list of formal
8985         parameters.
8986         (Arm_relocate_functions::xpc25): New method definition.
8987         (Arm_relocate_functions::arm_branch_common): Move method defintion
8988         out from class definition.  Use stubs for mode-switching and extending
8989         branch ranges.
8990         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8991         specially.  Change code to enable use of stubs in ARM branches.
8992
8993 2009-11-10  Doug Kwan  <dougkwan@google.com>
8994
8995         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8996         in method declaration.
8997         (Target_arm::relocate_stub): New method declaration.
8998         (Target_arm::default_target): Change to return a pointer instead of
8999         a const reference.
9000         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9001         Target_arm::default_target.
9002         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9003         method definition.
9004         (Target_arm::relocate_section): Adjust view.
9005         (Target_arm::relocate_stub): New method definition.
9006
9007 2009-11-10  Doug Kwan  <dougkwan@google.com>
9008
9009         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9010         a format warning.
9011         * incremental.cc (open_incremental_binary): Initialized local
9012         variables to avoid warnings.
9013         * object.cc (make_elf_object): Ditto.
9014         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9015         a format warning.
9016
9017 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9018
9019         PR gold/10930
9020         * testsuite/plugin_test.c: Include "config.h".
9021
9022 2009-11-09  Doug Kwan  <dougkwan@google.com>
9023
9024         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9025         (arm_symbol_value): Remove.
9026         (Arm_relocate_functions::arm_branch_common,
9027         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9028         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9029         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9030         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9031         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9032         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9033         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9034         Arm_relocate_functions::thm_mobw_abs_nc,
9035         Arm_relocate_functions::thm_mov_abs,
9036         Arm_relocate_functions::movw_prel_nc,
9037         Arm_relocate_functions::thm_movt_abs,
9038         Arm_relocate_functions::movt_prel,
9039         Arm_relocate_functions::thm_movw_prel_nc,
9040         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9041         (Target_arm::Relocate::relocate): Only decompose address into two
9042         parts if relocation type uses the thumb-bit and pass the actual
9043         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9044         calls to methods in Arm_relocate_functions for this change.
9045
9046 2009-11-08  Ian Lance Taylor  <iant@google.com>
9047
9048         PR 10925
9049         * reloc.cc: Instantiate
9050         Sized_relobj::initialize_input_to_output_maps and
9051         Sized_relobj:free_input_to_output_maps.
9052
9053 2009-11-06  Ian Lance Taylor  <iant@google.com>
9054
9055         PR 10876
9056         * defstd.cc (in_segment): Set only_if_ref true for "end".
9057
9058 2009-11-06  Doug Kwan  <dougkwan@google.com>
9059
9060         * arm.cc (class Reloc_stub): Correct a comment.
9061         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9062         (Target_arm::scan_section_for_stubs): New method declaration.
9063         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9064         Change methods from private to protected.
9065         (Target_arm::do_may_relax): New method definition.
9066         (Target_arm::do_relax, Target_arm::group_sections,
9067         Target_arm::scan_reloc_for_stub,
9068         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9069         (Target_arm::arm_input_section_map_): New data member declaration.
9070         (Target_arm::scan_reloc_for_stub,
9071         Target_arm::scan_reloc_section_for_stubs,
9072         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9073         Target_arm::do_relax): New method definitions.
9074
9075 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9076
9077         * configure.ac: Check for (struct stat)::st_mtim
9078         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9079         * config.in: Regenerate.
9080         * configure: Regenerate.
9081
9082 2009-11-05  Ian Lance Taylor  <iant@google.com>
9083
9084         PR 10910
9085         * output.cc (Output_segment::add_output_section): Add missing
9086         return statement.
9087
9088 2009-11-04  Ian Lance Taylor  <iant@google.com>
9089
9090         PR 10880
9091         * object.h (class Object): Add is_needed and set_is_needed
9092         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9093         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9094         defined in a dynamic object and referenced by a regular object,
9095         set is_needed for the dynamic object.
9096         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9097         if the file is marked with as_needed and it is not needed.
9098
9099 2009-11-04  Ian Lance Taylor  <iant@google.com>
9100
9101         PR 10887
9102         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9103         tags if data is discarded by linker script.
9104         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9105         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9106         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9107         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9108
9109 2009-11-04  Ian Lance Taylor  <iant@google.com>
9110
9111         * layout.cc (Layout::get_output_section): Add is_interp and
9112         is_dynamic_linker_section parameters.  Change all callers.
9113         (Layout::choose_output_section): Likewise.
9114         (Layout::make_output_section): Likewise.
9115         (Layout::add_output_section_data): Add is_dynamic_linker_section
9116         parameter.  Change all callers.
9117         * layout.h (class Layout): Update declarations.
9118         * output.h (class Output_section): Add is_interp, set_is_interp,
9119         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9120         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9121         generate_code_fills_at_write_ to a bitfield.
9122         * output.cc (Output_section::Output_sections): Initialize new
9123         fields.
9124         (Output_segment::add_output_section): Add do_sort parameter.
9125         Change all callers.
9126
9127 2009-11-03  Ian Lance Taylor  <iant@google.com>
9128
9129         PR 10860
9130         * options.h (class General_options): Add --warn-common.
9131         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9132         merging two common symbols.
9133         (Symbol_table::should_override): Handle --warn-common when merging
9134         a common symbol with a defined symbol.  Use report_resolve_problem
9135         for multiple definitions.
9136         (Symbol_table::report_resolve_problem): New function.
9137         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9138
9139 2009-11-03  Doug Kwan  <dougkwan@google.com>
9140
9141         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9142         stub_factory_.
9143         (Target_arm::stub_factory): New method definition.
9144         (Target_arm::new_arm_input_section,
9145         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9146         Target_arm::reloc_uses_thumb_bit): New method declarations.
9147         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9148         New type definitions.
9149         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9150         member declarations.
9151         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9152         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9153         New method definitions.
9154
9155 2009-11-03  Ian Lance Taylor  <iant@google.com>
9156
9157         * options.h (class General_options): Add --warn_constructors.
9158
9159 2009-11-03  Ian Lance Taylor  <iant@google.com>
9160
9161         PR 10893
9162         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9163         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9164
9165 2009-11-03  Ian Lance Taylor  <iant@google.com>
9166
9167         PR 10895
9168         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9169         --msgid-bugs-address.
9170         (install-pdf): New target.
9171         (install-data_yes): Look up one directory to find mkinstalldirs.
9172
9173 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9174
9175         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9176         tree.
9177
9178 2009-10-30  Doug Kwan  <dougkwan@google.com>
9179
9180         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9181
9182 2009-10-30  Doug Kwan  <dougkwan@google.com>
9183
9184         * arm.cc (Stub_addend_reader): New struct template definition
9185         and partial specializations.
9186         (Stub_addend_reader::operator()): New method definition for a
9187         partially specialized template.
9188
9189 2009-10-30  Doug Kwan  <dougkwan@google.com>
9190
9191         * arm.cc (Arm_relobj::processor_specific_flags): New method
9192         definition.
9193         (Arm_relobj::do_read_symbols): New method declaration.
9194         (Arm_relobj::processor_specific_flags_): New data member declaration.
9195         (Arm_dynobj): New class definition.
9196         (Target_arm::do_finalize_sections): Add input_objects parameter.
9197         (Target_arm::do_adjust_elf_header): New method declaration.
9198         (Target_arm::are_eabi_versions_compatible,
9199         (Target_arm::merge_processor_specific_flags): New method declaration.
9200         (Target_arm::do_make_elf_object): New overloaded method definitions
9201         and declaration.
9202         (Arm_relobj::do_read_symbols): New method definition.
9203         (Arm_dynobj::do_read_symbols): Ditto.
9204         (Target_arm::do_finalize_sections): Add input_objects parameters.
9205         Merge processor-specific flags from all input objects.
9206         (Target_arm::are_eabi_versions_compatible,
9207         Target_arm::merge_processor_specific_flags,
9208         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9209         New method definitions.
9210         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9211         Input_objects pointer type parameter.
9212         * layout.cc (Layout::finalize): Pass input objects to target's.
9213         finalize_sections function.
9214         * output.cc (Output_file_header::do_sized_write): Set ELF file
9215         header's processor-specific flags.
9216         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9217         Input_objects pointer type parameter.
9218         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9219         * target.h (Input_objects): New forward class declaration.
9220         (Target::processor_specific_flags,
9221         Target::are_processor_specific_flags_sect): New method definitions.
9222         (Target::finalize_sections): Add input_objects parameter.
9223         (Target::Target): Initialize processor_specific_flags_ and
9224         are_processor_specific_flags_set_.
9225         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9226         parameter.
9227         (Target::set_processor_specific_flags): New method definition.
9228         (Target::processor_specific_flags_,
9229         Target::are_processor_specific_flags_set_): New data member
9230         declarations.
9231         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9232         Input_objects pointer type parameter.
9233
9234 2009-10-30  Doug Kwan  <dougkwan@google.com>
9235
9236         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9237
9238 2009-10-28  Ian Lance Taylor  <iant@google.com>
9239
9240         * object.h (class Relobj): Drop options parameter from
9241         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9242         do_scan_relocs, do_relocate.  Change all callers.
9243         (class Sized_relobj): Drop options parameters from
9244         do_gc_process_relocs, do_scan_relocs, do_relocate,
9245         do_relocate_sections, relocate_sections, emit_relocs_scan,
9246         emit_relocs_scan_reltype.  Change all callers.
9247         (struct Relocate_info): Remove options field and all references to
9248         it.
9249         * reloc.h (class Read_relocs): Remove options constructor
9250         parameter and options_ field.  Change all callers.
9251         (class Gc_process_relocs, class Scan_relocs): Likewise.
9252         (class Relocate_task): Likewise.
9253         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9254         all callers.
9255         (scan_relocatable_relocs): Likewise.
9256         * target.h (class Sized_target): Remove options parameter from
9257         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9258         all callers.
9259         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9260         callers.
9261         * arm.cc: Update functions to remove options parameters.
9262         * i386.cc: Likewise.
9263         * powerpc.cc: Likewise.
9264         * sparc.cc: Likewise.
9265         * x86_64.cc: Likewise.
9266         * testsuite/testfile.cc: Likewise.
9267
9268 2009-10-28  Doug Kwan  <dougkwan@google.com>
9269
9270         * arm.cc (Arm_relobj): New class definition.
9271         (Arm_relobj::scan_sections_for_stubs,
9272         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9273         New method definitions.
9274
9275 2009-10-28  Cary Coutant  <ccoutant@google.com>
9276
9277         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9278         (Plugin::cleanup_done_): New member.
9279         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9280         (Plugin_manager::cleanup_done_): Remove.
9281         (Plugin_manager::add_input_file): Edit error message.
9282         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9283         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9284
9285 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9286
9287         * fileread.cc: (File_read::View::~View): Use the new
9288         data_ownership_ filed.
9289         (File_read::~File_read): Dispose the new whole_file_view_.
9290         (File_read::open): Mmap the whole file if needed.
9291         (File_read::open): Use whole_file_view_ instead of contents_.
9292         (File_read::find_view): Use whole_file_view_ if applicable.
9293         (File_read::do_read): Use whole_file_view_ instead of contents_.
9294         (File_read::make_view): Use whole_file_view_ instead of contents_,
9295         update File_read::View::View call.
9296         (File_read::find_or_make_view): Update File_read::View::View
9297         call.
9298         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9299         remove contents_
9300         (File_read::View::Data_ownership): New enum.
9301         (File_read::View::View): Replace bool mapped_ with Data_ownership
9302         argument.
9303         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9304         (File_read::View::data_ownership_): New field.
9305         (File_read::contents_): Remove (replaced by whole_file_view_).
9306         (File_read::whole_file_view_): New field.
9307         * options.h (class General_options): Add --keep-files-mapped.
9308
9309 2009-10-27  Cary Coutant  <ccoutant@google.com>
9310
9311         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9312         * testsuite/Makefile.am (plugin_test_5): New test case.
9313         * testsuite/Makefile.in: Regenerate.
9314
9315 2009-10-25  Doug Kwan  <dougkwan@google.com>
9316
9317         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9318         from private to protected to allow access by child class.
9319         (Sized_relobj::do_relocate_sections): New method declaration.
9320         (Sized_relobj::relocate_sections): Virtualize.
9321         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9322         Sized_relobj::relocate_sections.  Instantiate template explicitly
9323         for different target sizes and endianity.
9324
9325 2009-10-24  Doug Kwan  <dougkwan@google.com>
9326
9327         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9328         (Arm_input_section::as_arm_input_section): New method.
9329         (Arm_output_section): New class definition.
9330         (Arm_output_section::create_stub_group,
9331         Arm_output_section::group_sections): New method definitions.
9332
9333 2009-10-22  Doug Kwan  <dougkwan@google.com>
9334
9335         * arm.cc (Arm_input_section): New class definition.
9336         (Arm_input_section::init, Arm_input_section:do_write,
9337         Arm_input_section::set_final_data_size,
9338         Arm_input_section::do_reset_address_and_file_offset): New method
9339         definitions.
9340
9341 2009-10-21  Doug Kwan  <dougkwan@google.com>
9342
9343         * arm.cc (Stub_table, Arm_input_section): New forward class
9344         declarations.
9345         (Stub_table): New class defintion.
9346         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9347         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9348         New method definition.
9349
9350 2009-10-21  Doug Kwan  <dougkwan@google.com>
9351
9352         * arm.cc: Update copyright comments.
9353         (Target_arm): New forward class template declaration.
9354         (Arm_address): New type.
9355         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9356         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9357         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9358         constants.
9359         (Insn_template): Same.
9360         (DEF_STUBS): New macro.
9361         (Stub_type): New enum type.
9362         (Stub_template): New class definition.
9363         (Stub): Same.
9364         (Reloc_stub): Same.
9365         (Stub_factory): Same.
9366         (Target_arm::Target_arm): Initialize may_use_blx_ and
9367         should_force_pic_veneer_.
9368         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9369         Target_arm::should_force_pic_veneer,
9370         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9371         Target_arm::using_thumb_only, Target_arm:;default_target): New
9372         method defintions.
9373         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9374         New data member declarations.
9375         (Insn_template::size, Insn_template::alignment): New method defintions.
9376         (Stub_template::Stub_template): New method definition.
9377         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9378         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9379         (Stub_factory::Stub_factory): New method definition.
9380         * gold.h (string_hash): New template.
9381         * output.h (Input_section_specifier::hash_value): Use
9382         gold::string_hash.
9383         (Input_section_specifier::string_hash): Remove.
9384         * stringpool.cc (Stringpool_template::string_hash): Use
9385         gold::string_hash.
9386
9387 2009-10-20  Doug Kwan  <dougkwan@google.com>
9388
9389         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9390         symbols of relaxed input sections.
9391         * output.h (Output_section::find_relaxed_input_section): Make
9392         method public.
9393
9394 2009-10-16  Doug Kwan  <dougkwan@google.com>
9395
9396         * dynobj.cc (Versions::Versions): Initialize version_script_.
9397         Only insert base version symbol definition for a shared object
9398         if version script defines any version versions.
9399         (Versions::define_base_version): New method definition.
9400         (Versions::add_def): Check that base version is not needed.
9401         (Versions::add_need): Define base version lazily.
9402         * dynobj.h (Versions::define_base_version): New method declaration.
9403         (Versions::needs_base_version_): New data member declaration.
9404         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9405         (check_DATA): Add no_version_test.stdout.
9406         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9407         New make rules.
9408         * testsuite/Makefile.in: Regenerate.
9409         * testsuite/no_version_test.c: New file.
9410         * testsuite/no_version_test.sh: Ditto.
9411
9412 2009-10-16  Doug Kwan  <dougkwan@google.com>
9413
9414         * expression.cc (class Segment_start_expression): New class definition.
9415         (Segment_start_expression::value): New method definition.
9416         (script_exp_function_segment_start): Return a new
9417         Segment_start_expression.
9418         * gold/script-c.h (script_saw_segment_start_expression): New function
9419         prototype.
9420         * script-sections.cc (Script_sections::Script_sections): Initialize
9421         SAW_SEGMENT_START_EXPRESSION_ to false.
9422         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9423         and -Tbbs options to specify section addresses if given in
9424         command line and no SEGMENT_START expression is seen in a script.
9425         * script-sections.h (Script_sections::saw_segment_start_expression,
9426         Script_sections::set_saw_segment_start_expression): New method
9427         definition.
9428         (Script_sections::saw_segment_start_expression_): New data member
9429         declaration.
9430         * script.cc (script_saw_segment_start_expression): New function.
9431         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9432         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9433         script_test_7.sh and script_test_8.sh.
9434         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9435         script_test_8.stdout.
9436         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9437         (script_test_6, script_test_6.stdout, script_test_7,
9438         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9439         * Makefile.in: Regenerate.
9440         * testsuite/script_test_6.sh: New file.
9441         * testsuite/script_test_6.t: Same.
9442         * testsuite/script_test_7.sh: Same.
9443         * testsuite/script_test_7.t: Same.
9444         * testsuite/script_test_8.sh: Same.
9445
9446 2009-10-16  Doug Kwan  <dougkwan@google.com>
9447
9448         * output.cc (Output_segment::set_section_list_address): Cast
9449         expressions to unsigned long long type to avoid format warnings.
9450
9451 2009-10-15  Ian Lance Taylor  <iant@google.com>
9452
9453         * script.cc (Script_options::add_symbol_assignment): Always add a
9454         dot assignment to script_sections_.
9455         * script-sections.cc (Script_sections::add_dot_assignment):
9456         Initialize if necessary.
9457
9458         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9459         program headers with no load segment if there is a linker script.
9460
9461         * layout.cc (Layout::set_segment_offsets): Align the file offset
9462         to the segment aligment for -N or -n with no load segment.
9463         * output.cc (Output_segment::add_output_section): Don't crash if
9464         the first section is a TLS section.
9465         (Output_segment::set_section_list_addresses): Print an error
9466         message if the address moves backward in a linker script.
9467         * script-sections.cc
9468         (Output_section_element_input::set_section_addresses): Don't
9469         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9470         (Orphan_output_section::set_section_addresses): Likewise.
9471
9472 2009-10-15  Doug Kwan  <dougkwan@google.com>
9473
9474         * layout.cc (Layout::finish_dynamic_section): Generate tags
9475         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9476         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9477         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9478
9479 2009-10-14  Ian Lance Taylor  <iant@google.com>
9480
9481         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9482         fields.
9483         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9484         data_shdr fields of relinfo.
9485         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9486         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9487         R_386_TLS_LDO_32, adjust based on section flags.
9488         (Target_i386::Relocate::fix_up_ldo): Remove.
9489
9490 2009-10-13  Ian Lance Taylor  <iant@google.com>
9491
9492         Add support for -pie.
9493         * options.h (class General_options): Add -pie and
9494         --pic-executable.
9495         (General_options::output_is_position_independent): Test -pie.
9496         (General_options::output_is_executable): Return true if not shared
9497         and not relocatable.
9498         (General_options::output_is_pie): Remove.
9499         * options.cc (General_options::finalize): Reject incompatible uses
9500         of -pie.
9501         * gold.cc (queue_middle_tasks): A -pie link is not static.
9502         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9503         * symtab.cc (Symbol::final_value_is_known): Return false if
9504         output_is_position_independent.
9505         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9506         output_is_position_independent.
9507         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9508         output_is_position_independent.
9509         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9510         output_is_position_independent.
9511         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9512         two_file_pie_test.
9513         (basic_pie_test.o, basic_pie_test): New targets.
9514         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9515         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9516         (two_file_pie_test): New target.
9517         * testsuite/Makefile.in: Rebuild.
9518         * README: Remove note saying that -pie is not supported.
9519
9520 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9521
9522         * options.h (class General_options): Add -init and -fini.
9523         * layout.cc (Layout::finish_dynamic_section): Emit
9524         given init and fini functions.
9525
9526 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9527
9528         * gc.h (gc_process_relocs): Check if icf is enabled using new
9529         function.
9530         * gold.cc (queue_initial_tasks): Likewise.
9531         (queue_middle_tasks): Likewise.
9532         * object.cc (do_layout): Likewise.
9533         * symtab.cc (is_section_folded): Likewise.
9534         * main.cc (main): Likewise.
9535         * reloc.cc (Read_relocs::run): Likewise.
9536         (Sized_relobj::do_scan_relocs): Likewise.
9537         * icf.cc (is_function_ctor_or_dtor): New function.
9538         (Icf::find_identical_sections): Check if function is ctor or dtor when
9539         safe icf is chosen.
9540         * options.h (General_options::icf): Change option to be an enum.
9541         (Icf_status): New enum.
9542         (icf_enabled): New method.
9543         (icf_safe_folding): New method.
9544         (set_icf_status): New method.
9545         (icf_status_): New variable.
9546         * (options.cc) (General_options::finalize): Set icf_status_.
9547         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9548         icf_test and icf_keep_unique_test to use the --icf enum flag.
9549         * testsuite/icf_safe_test.sh: New file.
9550         * testsuite/icf_safe_test.cc: New file.
9551
9552 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9553
9554         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9555         includes to gc.h and icf.h.
9556         * arm.cc: Include gc.h.
9557         * gold.cc: Likewise.
9558         * i386.cc: Likewise.
9559         * powerpc.cc: Likewise.
9560         * sparc.cc: Likewise.
9561         * x86_64.cc: Likewise.
9562         * gc.h: Include icf.h.
9563
9564 2009-10-11  Ian Lance Taylor  <iant@google.com>
9565
9566         * plugin.cc: Include "gold.h" before other header files.
9567
9568 2009-10-10  Chris Demetriou  <cgd@google.com>
9569
9570         * options.h (Input_file_argument::Input_file_type): New enum.
9571         (Input_file_argument::is_lib_): Replace with...
9572         (Input_file_argument::type_): New member.
9573         (Input_file_argument::Input_file_argument): Take Input_file_type
9574         'type' rather than boolean 'is_lib' as second argument.
9575         (Input_file_argument::is_lib): Use type_.
9576         (Input_file_argument::is_searched_file): New function.
9577         (Input_file_argument::may_need_search): Handle is_searched_file.
9578         * options.cc (General_options::parse_library): Support -l:filename.
9579         (General_options::parse_just_symbols): Update for Input_file_argument
9580         changes.
9581         (Command_line::process): Likewise.
9582         * archive.cc (Archive::get_file_and_offset): Likewise.
9583         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9584         * script.cc (read_script_file, script_add_file): Likewise.
9585         * fileread.cc (Input_file::Input_file): Likewise.
9586         (Input_file::will_search_for): Handle is_searched_file.
9587         (Input_file::open): Likewise.
9588         * readsyms.cc (Read_symbols::get_name): Likewise.
9589         * testsuite/Makefile.am (searched_file_test): New test.
9590         * testsuite/Makefile.in: Regenerate.
9591         * testsuite/searched_file_test.cc: New file.
9592         * testsuite/searched_file_test_lib.cc: New file.
9593
9594 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9595             Ian Lance Taylor  <iant@google.com>
9596
9597         * descriptor.cc: Include <cstdio> and "binary-io.h".
9598         (Descriptors::open): Open the files in binary mode always.
9599         * script.cc (Lex::get_token): Treat \r as whitespace.
9600
9601 2009-10-09  Ian Lance Taylor  <iant@google.com>
9602
9603         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9604
9605 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9606             Ian Lance Taylor  <iant@google.com>
9607
9608         * configure.ac: Check for readv function also.
9609         * fileread.cc (readv): Define if not HAVE_READV.
9610         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9611         does not exist.
9612         * config.in: Regenerate.
9613         * configure: Regenerate.
9614
9615 2009-10-09  Doug Kwan  <dougkwan@google.com>
9616
9617         * layout.cc (Layout::make_output_section): Call target hook to make
9618         ordinary output section.
9619         (Layout::finalize): Adjust parameter list of call the
9620         Target::may_relax().
9621         * layout.h (class Layout::section_list): New method.
9622         * merge.h (Output_merge_base::entsize): Change visibility to public.
9623         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9624         New methods.
9625         (Output_merge_string::do_is_string): New method.
9626         * object.cc (Sized_relobj::do_setup): renamed from
9627         Sized_relobj::set_up.
9628         * object.h (Sized_relobj::adjust_shndx,
9629         Sized_relobj::initializ_input_to_output_maps,
9630         Sized_relobj::free_input_to_output_maps): Change visibilities to
9631         protected.
9632         (Sized_relobj::setup): Virtualize.
9633         (Sized_relobj::do_setup): New method declaration.
9634         (Sized_relobj::invalidate_section_offset,
9635         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9636         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9637         * options.cc (parse_int): New function.
9638         * options.h (parse_int): New declaration.
9639         (DEFINE_int): New macro.
9640         (stub_group_size): New option.
9641         * output.cc (Output_section::Output_section): Initialize memebers
9642         merge_section_map_, merge_section_by_properties_map_,
9643         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9644         (Output_section::add_input_section): Handled deferred code-fill
9645         generation and remove an old comment.
9646         (Output_section::add_relaxed_input_section): New method definition.
9647         (Output_section::add_merge_input_section): Use merge section by
9648         properties map to speed to search.  Update merge section maps
9649         as appropriate.
9650         (Output_section::build_relaxation_map): New method definition.
9651         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9652         Same.
9653         (Output_section::relax_input_section): Renamed to
9654         Output_section::convert_input_sections_to_relaxed_sections and change
9655         interface to take a vector of pointers to relaxed sections.
9656         (Output_section::find_merge_section,
9657         Output_section::find_relaxed_input_section): New method definitions.
9658         (Output_section::is_input_address_mapped,
9659         Output_section::output_offset, Output_section::output_address):
9660         Use output section data maps to speed up searching.
9661         (Output_section::find_starting_output_address): Add comments.
9662         (Output_section::do_write,
9663         Output_section::write_to_postprocessing_buffer): Do code-fill
9664         generation as appropriate.
9665         (Output_section::get_input_sections): Invalidate relaxed input section
9666         map.
9667         (Output_section::restore_states): Adjust type of checkpoint .
9668         Invalidate relaxed input section map.
9669         * output.h (Output_merge_base): New class declaration.
9670         (Input_section_specifier): New class defintion.
9671         (class Output_relaxed_input_section) Change base class to
9672         Output_section_data_build.
9673         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9674         base class initializer.
9675         (Output_section::add_relaxed_input_section): New method declaration.
9676         (Output_section::Input_section): Change visibility to protected.
9677         (Output_section::Input_section::relobj,
9678         Output_section::Input_section::shndx): Handle relaxed input sections.
9679         Output_section::input_sections) Change visibility to protected.  Also
9680         define overload to return a non-const pointer.
9681         (Output_section::Merge_section_properties): New class defintion.
9682         (Output_section::Merge_section_by_properties_map,
9683         Output_section::Output_section_data_by_input_section_map,
9684         Output_section::Relaxation_map): New types.
9685         (Output_section::relax_input_section): Rename method to
9686         Output_section::convert_input_sections_to_relaxed_sections and change
9687         interface to take a vector of relaxed section pointers.
9688         (Output_section::find_merge_section,
9689         Output_section::find_relaxed_input_section,
9690         Output_section::build_relaxation_map,
9691         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9692         New method declarations.
9693         (Output_section::merge_section_map_
9694         Output_section::merge_section_by_properties_map_,
9695         Output_section::relaxed_input_section_map_,
9696         Output_section::is_relaxed_input_section_map_valid_,
9697         Output_section::generate_code_fills_at_write_): New data members.
9698         * script-sections.cc
9699         (Output_section_element_input::set_section_addresses): Call
9700         current_data_size and addralign methods of relaxed input sections.
9701         (Orphan_output_section::set_section_addresses): Call current_data_size
9702         and addralign methods of relaxed input sections.
9703         * symtab.cc (Symbol_table::compute_final_value): Extract template
9704         from the body of Symbol_table::sized_finalize_symbol.
9705         (Symbol_table::sized_finalized_symbol): Call
9706         Symbol_table::compute_final_value.
9707         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9708         (Symbol_table::compute_final_value): New templated method declaration.
9709         * target.cc (Target::do_make_output_section): New method defintion.
9710         * target.h (Target::make_output_section): New method declaration.
9711         (Target::relax): Add more parameters for input objects, symbol table
9712         and layout.  Adjust call to do_relax.
9713         (Target::do_make_output_section): New method declaration.
9714         (Target::do_relax): Add parameters for input objects, symbol table
9715         and layout.
9716
9717 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9718
9719         * pread.c: Include stdio.h.
9720
9721 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9722
9723         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9724         defined.
9725
9726 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9727
9728         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9729         Change read_shndx type to unsigned int.
9730         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9731         int.
9732         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9733         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9734         Change read_shndx type to unsigned int.
9735         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9736         int.
9737         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9738         * layout.cc (Layout::create_symtab_sections): Cast the result of
9739         local_symcount * symsize to off_t in the gold_assert.
9740
9741 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9742
9743         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9744         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9745         R_ARM_BASE_ABS.
9746         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9747         (Arm_relocate_functions::thm_abs5): New function.
9748         (Arm_relocate_functions::abs12): New function.
9749         (Arm_relocate_functions::abs16): New function.
9750         (Arm_relocate_functions::base_abs): New function.
9751         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9752         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9753         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9754         R_ARM_BASE_ABS.
9755         (Scan::global): Likewise.
9756         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9757         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9758         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9759         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9760         R_ARM_BASE_ABS.
9761
9762 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9763
9764         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9765         (Arm_relocate_functions::movt_prel): New function.
9766         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9767         (Arm_relocate_functions::thm_movt_prel): New function.
9768         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9769         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9770         (Scan::global, Relocate::relocate): Likewise.
9771         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9772
9773 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9774
9775         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9776         Incremental_checker.
9777         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9778         unsigned int.
9779         (class Incremental_inputs_header): New class.
9780         (Incremental_inputs_header_writer): Edit comment.
9781         (Incremental_inputs_entry): New class.
9782         (Incremental_inputs_entry_writer): Edit comment.
9783         (Sized_incremental_binary::do_find_incremental_inputs_section):
9784         Add *strtab_shndx parameter, fill it.
9785         (Sized_incremental_binary::do_check_inputs): New method.
9786         (Incremental_checker::can_incrementally_link_output_file): Use
9787         Sized_incremental_binary::check_inputs.
9788         (Incremental_inputs::report_command_line): Save command line in
9789         command_line_.
9790         * incremental.h:
9791         (Incremental_binary::find_incremental_inputs_section): New
9792         method.
9793         (Incremental_binary::do_find_incremental_inputs_section): Add
9794         strtab_shndx parameter.
9795         (Incremental_binary::do_check_inputs): New pure virtual method.
9796         (Sized_incremental_binary::do_check_inputs): Declare.
9797         (Incremental_checker::Incremental_checker): Add incremental_inputs
9798         parameter, use it to initialize incremental_inputs_.
9799         (Incremental_checker::incremental_inputs_): New field.
9800         (Incremental_checker::command_line): New method.
9801         (Incremental_checker::inputs): New method.
9802         (Incremental_checker::command_line_): New field.
9803
9804 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9805
9806         * incremental.cc: Include <cstdarg> and "target-select.h".
9807         (vexplain_no_incremental): New function.
9808         (explain_no_incremental): New function.
9809         (Incremental_binary::error): New method.
9810         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9811         method.
9812         (make_sized_incremental_binary): New function.
9813         (open_incremental_binary): New function.
9814         (can_incrementally_link_file): Add checks if output is ELF and has
9815         inputs section.
9816         * incremental.h: Include "elfcpp_file.h" and "output.h".
9817         (Incremental_binary): New class.
9818         (Sized_incremental_binary): New class.
9819         (open_incremental_binary): Declare.
9820         * object.cc (is_elf_object): Use
9821         elfcpp::Elf_recognizer::is_elf_file.
9822         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9823         * output.h (Output_file::filesize): New method.
9824
9825 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9826
9827         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9828         New function.
9829         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9830         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9831         function.
9832         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9833         function.
9834         (Arm_relocate_functions::movw_abs_nc): New function.
9835         (Arm_relocate_functions::movt_abs): New function.
9836         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9837         (Arm_relocate_functions::thm_movt_abs): New function.
9838         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9839         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9840         (Scan::global): Likewise.
9841         (Relocate::relocate): Likewise.
9842         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9843
9844 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9845
9846         * arm.cc (Arm_relocate_functions::got_prel) New function.
9847         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9848         (Relocate::relocate): Likewise.
9849         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9850
9851 2009-10-06  Ian Lance Taylor  <iant@google.com>
9852
9853         * options.h (class General_options): Define
9854         split_stack_adjust_size parameter.
9855         * object.h (class Object): Add uses_split_stack_ and
9856         has_no_split_stack_ fields.  Add uses_split_stack and
9857         has_no_split_stack accessor functions.  Declare
9858         handle_split_stack_section.
9859         (class Reloc_symbol_changes): Define.
9860         (class Sized_relobj): Define Function_offsets.  Declare
9861         split_stack_adjust, split_stack_adjust_reltype, and
9862         find_functions.
9863         * object.cc (Object::handle_split_stack_section): New function.
9864         (Sized_relobj::do_layout): Call handle_split_stack_section.
9865         * dynobj.cc (Sized_dynobj::do_layout): Call
9866         handle_split_stack_section.
9867         * reloc.cc (Sized_relobj::relocate_sections): Call
9868         split_stack_adjust for executable sections in split_stack
9869         objects.  Pass reloc_map to relocate_section.
9870         (Sized_relobj::split_stack_adjust): New function.
9871         (Sized_relobj::split_stack_adjust_reltype): New function.
9872         (Sized_relobj::find_functions): New function.
9873         * target-reloc.h: Include "object.h".
9874         (relocate_section): Add reloc_symbol_changes parameter.  Change
9875         all callers.
9876         * target.h (class Target): Add calls_non_split method.  Declare
9877         do_calls_non_split virtual method.  Declare match_view and
9878         set_view_to_nop.
9879         * target.cc: Include "elfcpp.h".
9880         (Target::do_calls_non_split): New function.
9881         (Target::match_view): New function.
9882         (Target::set_view_to_nop): New function.
9883         * gold.cc (queue_middle_tasks): Give an error if mixing
9884         split-stack and non-split-stack objects with -r.
9885         * i386.cc (Target_i386::relocate_section): Add
9886         reloc_symbol_changes parameter.
9887         (Target_i386::do_calls_non_split): New function.
9888         * x86_64.cc (Target_x86_64::relocate_section): Add
9889         reloc_symbol_changes parameter.
9890         (Target_x86_64::do_calls_non_split): New function.
9891         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9892         parameter.
9893         * powerpc.cc (Target_powerpc::relocate_section): Add
9894         reloc_symbol_changes parameter.
9895         * sparc.cc (Target_sparc::relocate_section): Add
9896         reloc_symbol_changes parameter.
9897         * configure.ac: Call AM_CONDITIONAL for the default target.
9898         * configure: Rebuild.
9899         * testsuite/Makefile.am (TEST_AS): New variable.
9900         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9901         (check_DATA): Add split_i386 and split_x86_64 files.
9902         (SPLIT_DEFSYMS): Define.
9903         (split_i386_[1234n].o): New targets.
9904         (split_i386_[124]): New targets.
9905         (split_i386_[1234r].stdout): New targets.
9906         (split_x86_64_[1234n].o): New targets.
9907         (split_x86_64_[124]): New targets.
9908         (split_x86_64_[1234r].stdout): New targets.
9909         (MOSTLYCLEANFILES): Add new executables.
9910         * testsuite/split_i386.sh: New file.
9911         * testsuite/split_x86_64.sh: New file.
9912         * testsuite/split_i386_1.s: New file.
9913         * testsuite/split_i386_2.s: New file.
9914         * testsuite/split_i386_3.s: New file.
9915         * testsuite/split_i386_4.s: New file.
9916         * testsuite/split_i386_n.s: New file.
9917         * testsuite/split_x86_64_1.s: New file.
9918         * testsuite/split_x86_64_2.s: New file.
9919         * testsuite/split_x86_64_3.s: New file.
9920         * testsuite/split_x86_64_4.s: New file.
9921         * testsuite/split_x86_64_n.s: New file.
9922         * testsuite/testfile.cc (Target_test): Update relocation_section
9923         function.
9924         * testsuite/Makefile.in: Rebuild.
9925
9926 2009-10-06  Ian Lance Taylor  <iant@google.com>
9927
9928         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9929         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9930         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9931         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9932         the address on ldo_addrs_.
9933         (Target_i386::Relocate::fix_up_ldo): New function.
9934
9935 2009-10-06   Rafael Espindola  <espindola@google.com>
9936
9937         * plugin.cc (add_input_library): New.
9938         (Plugin::load): Add add_input_library to tv.
9939         (Plugin_manager::add_input_file): Add the is_lib argument.
9940         (add_input_file): Update call to Plugin_manager::add_input_file.
9941         (add_input_library): New.
9942         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9943
9944 2009-09-30  Doug Kwan  <dougkwan@google.com>
9945
9946         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9947         symbol and call Symbol::may_need_copy_reloc to determine if
9948         a copy reloc is needed.
9949         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9950         nocopyreloc is given in command line.
9951         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9952         given in command line.
9953         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9954         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9955         of the removed Target_i386::may_need_copy_reloc.
9956         * options.h (copyreloc): New option with default value false.
9957         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9958         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9959         instead of the removed Target_powerpc::may_need_copy_reloc.
9960         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9961         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9962         instead of the removed Target_sparc::may_need_copy_reloc.
9963         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9964         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9965         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9966         instead of the removed Target_x86_64::may_need_copy_reloc.
9967
9968 2009-09-30  Ian Lance Taylor  <iant@google.com>
9969
9970         * object.h (class Object): Remove target_ field, and target,
9971         sized_target, and set_target methods.
9972         (Object::sized_target): Remove.
9973         (class Sized_relobj): Update declarations.  Remove sized_target.
9974         * object.cc (Sized_relobj::setup): Remove target parameter.
9975         Change all callers.
9976         (Input_objects::add_object): Don't do anything with the target.
9977         (make_elf_sized_object): Add punconfigured parameter.  Change all
9978         callers.  Set or test parameter target.
9979         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9980         Change all callers.
9981         * parameters.cc (Parameters::set_target): Change parameter type to
9982         be non-const.
9983         (Parameters::default_target): Remove.
9984         (set_parameters_target): Change parameter type to be non-const.
9985         (parameters_force_valid_target): New function.
9986         (parameters_clear_target): New function.
9987         * parameters.h (class Parameters): Update declarations.  Remove
9988         default_target method.  Add sized_target and clear_target
9989         methods.  Change target_ to be non-const.
9990         (set_parameters_target): Update declaration.
9991         (parameters_force_valid_target): Declare.
9992         (parameters_clear_target): Declare.
9993         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9994         as NULL if we aren't searching.
9995         (Add_symbols::run): Don't check for compatible target.
9996         * fileread.cc (Input_file::open_binary): Call
9997         parameters_force_valid_target.
9998         * gold.cc (queue_middle_tasks): Likewise.
9999         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10000         set_target on object.
10001         * dynobj.h (class Sized_dynobj): Update declarations.
10002         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10003         make_elf_object returns NULL.
10004         (Archive::include_member): Don't check whether object target is
10005         compatible.
10006         * output.cc (Output_section::add_input_section): Get target from
10007         parameters.
10008         (Output_section::relax_input_section): Likewise.
10009         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10010         parameters.
10011         (Sized_relobj::do_scan_relocs): Likewise.
10012         (Sized_relobj::relocate_sections): Likewise.
10013         * resolve.cc (Symbol_table::resolve): Likewise.
10014         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10015         parameter.  Change all callers.
10016         (Symbol_table::add_from_object): Get target from parameters.
10017         (Symbol_table::add_from_relobj): Don't check object target.
10018         (Symbol_table::add_from_dynobj): Likewise.
10019         (Symbol_table::define_special_symbol): Get target from
10020         parameters.
10021         * symtab.h (class Symbol_table): Update declaration.
10022         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10023         parameter.  Change all callers.  Clear parameter target.
10024         (Binary_test): Test target here.
10025         * testsuite/object_unittest.cc (gold_testsuite): Remove
10026         target_test_pointer parameter.  Change all callers.
10027         (Object_test): Test target here.
10028
10029 2009-09-26  Ian Lance Taylor  <iant@google.com>
10030
10031         * testsuite/initpri1.c: Don't try to use constructor priorities if
10032         compiling with gcc before 4.3.
10033
10034 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10035
10036         * testsuite/retain_symbols_file_test.sh (check_present): Change
10037         output file name to retain_symbols_file_test.stdout.
10038         (check_absent): Likewise.
10039
10040 2009-09-18  Craig Silverstein  <csilvers@google.com>
10041
10042         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10043         * options.cc: Include <cerrno> and <fstream>.
10044         (General_options::finalize): Parse -retain-symbols-file tag.
10045         * options.h: New flag.
10046         (General_options): New method should_retain_symbol, new
10047         variable symbols_to_retain.
10048         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10049         should_retain_symbol map.
10050         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10051         * testsuite/Makefile.in: Regenerate.
10052         * testsuite/retain_symbols_file_test.sh: New file.
10053
10054 2009-09-18  Nick Clifton  <nickc@redhat.com>
10055
10056         * po/es.po: Updated Spanish translation.
10057
10058 2009-09-17  Doug Kwan  <dougkwan@google.com>
10059
10060         * debug.h (DEBUG_RELAXATION): New constant.
10061         (DEBUG_ALL): Add DEBUG_RELAXATION.
10062         (debug_string_to_enum): Add relaxation debug option.
10063         * layout.cc
10064         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10065         Layout::Relaxation_debug_check::read_sections,
10066         Layout::Relaxation_debug_check::read_sections): New method definitions.
10067         (Layout::Layout): Initialize data members
10068         record_output_section_data_from_scrips_,
10069         script_output_section_data_list_ and relaxation_debug_check_.
10070         (Layout::save_segments, Layout::restore_segments,
10071         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10072         Layout::relaxation_loop_body): New method definitions.
10073         (Layout::finalize): Support relaxation.  Move section layout code to
10074         Layout::relaxation_loop_body.
10075         (Layout::set_asection_address_from_script): Move code for orphan
10076         section placement out.
10077         (Layout::place_orphan_sections_in_script): New method definition.
10078         * layout.h (Output_segment_headers, Output_file_header):
10079         New forward class declarations.
10080         (Layout::~Layout): Define.
10081         (Layout::new_output_section_data_from_script): New method definition.
10082         (Layout::place_orphan_sections_in_script): New method declaration.
10083         (Layout::Segment_states): New type declaration.
10084         (Layout::save_segments, Layout::restore_segments,
10085         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10086         Layout::relaxation_loop_body): New method declarations.
10087         (Layout::Output_section_data_list): New type declaration.
10088         (Layout::Relaxation_debug_check): New class definition.
10089         (Layout::record_output_section_data_from_script_,
10090         Layout::script_output_section_data_list_, Layout::segment_states_,
10091         Layout::relaxation_debug_check_): New data members.
10092         * output.cc: (Output_section_headers::do_size): New method definition.
10093         (Output_section_headers::Output_section_headers): Move size
10094         computation to Output_section_headers::do_size.
10095         (Output_segment_headers::do_size): New method definition.
10096         (Output_file_header::Output_file_header): Move size computation to
10097         Output_file_header::do_size and call it.
10098         (Output_file_header::do_size): New method definition.
10099         (Output_data_group::Output_data_group): Adjust call to
10100         Output_section_data.
10101         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10102         (Output_symtab_xindex::do_write): Add array bound check.
10103         (Output_section::Input_section::print_to_mapfile): Handle
10104         RELAXED_INPUT_SECTION_CODE.
10105         (Output_section::Output_section): Initialize data member checkpoint_.
10106         (Output_section::~Output_section): Delete checkpoint object pointed
10107         by checkpoint_.
10108         (Output_section::add_input_section): Always add an Input_section if
10109         relaxing.
10110         (Output_section::add_merge_input_section): Add assert.
10111         (Output_section::relax_input_section): New method definition.
10112         (Output_section::set_final_data_size): Set load address to zero for
10113         an unallocated section.
10114         (Output_section::do_address_and_file_offset_have_reset_values):
10115         New method definition.
10116         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10117         Handle relaxed input section.
10118         (Output_section::sort_attached_input_sections): Checkpoint input
10119         section list lazily.
10120         (Output_section::get_input_sections): Change type of input_sections to
10121         list of Simple_input_section pointers.  Checkpoint input section list
10122         lazily.  Also handle relaxed input sections.
10123         (Output_section::add_input_section_for_script): Take a reference to
10124         a Simple_input_section object instead of Relobj pointer and section
10125         index as parameter.  Handle relaxed input sections.
10126         (Output_section::save_states, Output_section::restore_states): New
10127         method definitions.
10128         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10129         (Output_data::is_data_size_fixed): New method definition.
10130         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10131         if it is fixed.
10132         (Output_data::address_and_file_offset_have_reset_values): New method
10133         definition.
10134         (Output_data::do_address_and_file_offset_have_reset_values): New method
10135         definition.
10136         (Output_data::set_data_size): Check that data size is not fixed.
10137         (Output_data::fix_data_size): New method definition.
10138         (Output_data::is_data_size_fixed_): New data member.
10139         (Output_section_headers::set_final_data_size): New method definition.
10140         (Output_section_headers::do_size): New method declaration.
10141         (Output_segment_headers::set_final_data_size): New method definition.
10142         (Output_segment_headers::do_size): New method declaration.
10143         (Output_file_header::set_final_data_size)::New method definition.
10144         (Output_file_header::do_size)::New method declaration.
10145         (Output_section_data::Output_section_data): Add new parameter
10146         is_data_size_fixed and use it to fix data size.
10147         (Output_data_const::Output_data_const): Adjust call to base class
10148         constructor and fix data size.
10149         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10150         base class constructor and fix data size.
10151         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10152         base class constructor and fix data size.
10153         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10154         class constructor and fix data size.
10155         (Output_data_group::set_final_data_size): New method definition.
10156         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10157         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10158         class constructor and fix data size.
10159         (Output_relaxed_input_section): New class definition.
10160         (Output_section::Simple_input_section): New class definition.
10161         (Output_section::get_input_sections): Adjust parameter list.
10162         (Output_section::add_input_section_for_script): Same.
10163         (Output_section::save_states, Output_section::restore_states,
10164         Output_section::do_address_and_file_offset_have_reset_values,
10165         (Output_section::Input_section::Input_section): Handle
10166         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10167         Output_relaxed_input_section.
10168         (Output_section::Input_section::is_input_section,
10169         Output_section::Input_section::set_output_section): Handle relaxed
10170         input section.
10171         (Output_section::Input_section::is_relaxed_input_section,
10172         Output_section::Input_section::output_section_data,
10173         Output_section::Input_section::relaxed_input_section): New method
10174         definitions.
10175         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10176         value.
10177         (Output_section::Input_section::u1_): Update comments.
10178         (Output_section::Input_section::u2_): Add new union member poris.
10179         (Output_section::Checkpoint_output_section): New classs definition.
10180         (Output_section::relax_input_section): New method declaration.
10181         (Output_section::checkpoint_): New data member.
10182         (Output_segment): Update comments.
10183         (Output_segment::Output_segment): Un-privatize copy constructor.
10184         (Output_segment::operator=): Un-privatize.
10185         * script-sections.cc (Output_section_element::Input_section_list):
10186         Change element type to Output_section::Simple_input_section.
10187         (Output_section_element_dot_assignment::set_section_addresses):
10188         Register output section data for relaxation clean up.
10189         (Output_data_exression::Output_data_expression): Adjust call to base
10190         constructor to fix data size.
10191         (Output_section_element_data::set_section_addresses): Register
10192         Output_data_expression object for relaxation clean up.
10193         (struct Input_section_info): Replace Relobj pointer and section index
10194         pair with Output_section::Simple_input_section and Convert struct to a
10195         class.
10196         (Input_section_sorter::operator()): Adjust access to
10197         Input_section_info data member to use accessors.
10198         (Output_section_element_input::set_section_addresses): Use layout
10199         parameter.  Adjust code to use Output_section::Simple_input_section
10200         and Input_secction_info classes.  Register filler for relaxation
10201         clean up.
10202         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10203         and section index pair with Output_section::Simple_input_section
10204         class.  Adjust code accordingly.
10205         (Phdrs_element::release_segment): New method definition.
10206         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10207         segment list.
10208         (Script_sections::release_segments): New method definition.
10209         * gold/script-sections.h (Script_sections::release_segments): New
10210         method declaration.
10211         * gold/target.h (Target::may_relax, Target::relax,
10212         Target::do_may_relax, Target::do_relax): New method definitions.
10213
10214 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10215
10216         * arm.cc (has_signed_unsigned_overflow): New function.
10217         (Arm_relocate_functions::abs8): New function.
10218         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10219         (Target_arm::Scan::global): Likewise.
10220         (Target_arm::relocate::relocate): Likewise.
10221         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10222         Likewise.
10223
10224 2009-09-16  Cary Coutant  <ccoutant@google.com>
10225
10226         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10227         * testsuite/Makefile.in: Regenerate.
10228
10229 2009-09-11  Nick Clifton  <nickc@redhat.com>
10230
10231         * po/gold.pot: Updated by the Translation project.
10232
10233 2009-09-08  Cary Coutant  <ccoutant@google.com>
10234
10235         * output.cc (Output_file::open): Add execute permission to empty file.
10236         * testsuite/Makefile.am (permission_test): New test.
10237         * testsuite/Makefile.in: Regenerate.
10238
10239 2009-09-02  Ian Lance Taylor  <iant@google.com>
10240
10241         * output.cc (Output_file::resize): Call map_no_anonymous rather
10242         than map.
10243
10244 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10245
10246         * gold.cc: Include "incremental.h".
10247         (queue_initial_tasks): Call Incremental_checker methods.
10248         * incremental.cc: Include "output.h".
10249         (Incremental_checker::can_incrementally_link_output_file): New
10250         method.
10251         * incremental.h (Incremental_checker): New class.
10252
10253         * output.cc (Output_file::open_for_modification): New method.
10254         (Output_file::map_anonymous): Changed return type to bool.  Record
10255         map in base_ field.
10256         (Output_file::map_no_anonymous): New method, broken out of map.
10257         (Output_file::map): Use map_no_anonymous and map_anonymous.
10258         * output.h (class Output_file): Update declarations.
10259
10260 2009-08-24  Cary Coutant  <ccoutant@google.com>
10261
10262         * options.h (Command_line::Pre_options): New class.
10263         (Command_line::pre_options): New member.
10264         * options.cc (gold::options::ready_to_register): New variable.
10265         (One_option::register_option): Do nothing if not registering options.
10266         Assert if same short option registered twice.
10267         (General_options::General_options): Turn off option registration when
10268         done constructing.
10269         (Command_line::Pre_options::Pre_options): New constructor.
10270
10271 2009-08-24  Cary Coutant  <ccoutant@google.com>
10272
10273         * options.h (General_options::no_keep_memory): Remove incorrect
10274         short option.
10275
10276 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10277
10278         * Makefile.am (am__skiplex, am__skipyacc): New.
10279         * Makefile.in: Regenerate.
10280
10281 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10282
10283         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10284         (INCLUDES): ... this.
10285         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10286         (AM_CPPFLAGS): Renamed from ...
10287         (INCLUDE): ... this.
10288         * Makefile.in, testsuite/Makefile.in: Regenerate.
10289
10290         * Makefile.in: Regenerate.
10291         * aclocal.m4: Likewise.
10292         * config.in: Likewise.
10293         * configure: Likewise.
10294         * testsuite/Makefile.in: Likewise.
10295
10296         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10297         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10298         * Makefile.in: Regenerate.
10299         * testsuite/Makefile.in: Regenerate.
10300
10301 2009-08-19  Cary Coutant  <ccoutant@google.com>
10302
10303         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10304         symbols in shared libraries overridden by hidden or internal symbols
10305         in the main program.
10306
10307 2009-08-19  Chris Demetriou  <cgd@google.com>
10308
10309         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10310         checking source file names in error messages.
10311
10312 2009-08-18  Doug Kwan  <dougkwan@google.com>
10313
10314         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10315         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10316         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10317         an elfcpp::Ehdr as parameter.
10318         * object.cc (Object::set_target): Remove the version that looks up
10319         a target and sets it.
10320         (Sized_relobj::setup): Take a Target object instead of
10321         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10322         (make_elf_sized_object): Find target and ask target to
10323         make an ELF object.
10324         * object.h: (Object::set_target): Remove the version that looks up
10325         a target and sets it.
10326         (Sized_relobj::setup): Take a Target object instead of
10327         an elfcpp:Ehdr as parameter.
10328         * target.cc: Include dynobj.h.
10329         (Target::do_make_elf_object_implementation): New.
10330         (Target::do_make_elf_object): New.
10331         * target.h (Target::make_elf_object): New template declaration.
10332         (Target::do_make_elf_object): New method declarations.
10333         (Target::do_make_elf_object_implementation): New template declaration.
10334
10335 2009-08-14  Ian Lance Taylor  <iant@google.com>
10336
10337         * gold.h (FUNCTION_NAME): Define.
10338         (gold_unreachable): Use FUNCTION_NAME.
10339
10340 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10341
10342         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10343         symbol in the --keep-unique list is not found.
10344
10345 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10346
10347         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10348         been maked as --keep-unique.
10349         (Icf::unfold_section): New function.
10350         * icf.h (Icf::unfold_section): New function.
10351         * options.h (General_options::keep_unique): New option.
10352         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10353         * testsuite/Makefile.in: Regenerate.
10354         * testsuite/icf_keep_unique_test.sh: New file.
10355         * testsuite/icf_keep_unique_test.cc: New file.
10356
10357 2009-08-12  Cary Coutant  <ccoutant@google.com>
10358
10359         PR 10471
10360         * resolve.cc (Symbol_table::resolve): Check for references from
10361         dynamic objects to hidden and internal symbols.
10362         * testsuite/Makefile.am (hidden_test.sh): New test.
10363         * testsuite/Makefile.in: Regenerate.
10364         * testsuite/hidden_test.sh: New script.
10365         * testsuite/hidden_test_1.c: New test source.
10366         * testsuite/hidden_test_main.c: New test source.
10367
10368 2009-08-11  Doug Kwan  <dougkwan@google.com>
10369
10370         * arm.cc: Update comments.
10371         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10372         segment to locate the .ARM.exidx section if present.
10373
10374 2009-08-09  Doug Kwan  <dougkwan@google.com>
10375
10376         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10377         patch.
10378
10379 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10380         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10381         compiler warnings.
10382
10383 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10384
10385         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10386         valid tls_segment only for non-debug-section relocations.
10387         * testsuite/Makefile.am: Add gc_tls_test.
10388         * testsuite/Makefile.in: Regenerate.
10389         * testsuite/gc_tls_test.cc: New file.
10390         * testsuite/gc_tls_test.sh: New file.
10391
10392 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10393
10394         * icf.cc: New file.
10395         * icf.h: New file.
10396         * Makefile.am (CCFILES): Add icf.cc.
10397         (HFILES): Add icf.h
10398         * Makefile.in: Regenerate.
10399         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10400         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10401         section, symbol and addend information for the relocs.
10402         * gold.cc (queue_middle_tasks): Call identical code folding.
10403         * gold.h: Add defines for multimap.
10404         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10405         to the call of finalize_local_symbols.
10406         * main.cc (main): Create object of class Icf.
10407         * object.cc (Sized_relobj::do_layout): Allow this function to be
10408         called twice during icf.
10409         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10410         to sections marked as identical by icf.
10411         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10412         when available.
10413         (Sized_relobj::do_section_entsize): New function.
10414         * object.h (Object::section_entsize): New function.
10415         (Object::do_section_entsize): New pure virtual function.
10416         (Relobj::finalize_local_symbols): Add new parameter.
10417         (Relobj::do_section_entsize): New function.
10418         * options.h (General_options::icf): New option.
10419         (General_options::icf_iterations): New option.
10420         (General_options::print_icf_sections): New option.
10421         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10422         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10423         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10424         icf.
10425         * symtab.cc (Symbol_table::is_section_folded): New function.
10426         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10427         to sections marked as identical by icf.
10428         * symtab.h (Symbol_table::set_icf): New function.
10429         (Symbol_table::icf): New function.
10430         (Symbol_table::is_section_folded): New function.
10431         (Symbol_table::icf_): New data member.
10432         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10433         * testsuite/Makefile.am: Add commands to build icf_test.
10434         * testsuite/Makefile.in: Regenerate.
10435         * testsuite/icf_test.sh: New file.
10436         * testsuite/icf_test.cc: New file.
10437
10438 2009-07-24  Chris Demetriou  <cgd@google.com>
10439
10440         * layout.cc (is_compressible_debug_section): Fix incorrect
10441         comment about compressed section names.
10442
10443 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10444
10445         PR 10419
10446         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10447
10448 2009-07-16  Ian Lance Taylor  <iant@google.com>
10449
10450         PR 10400
10451         * layout.h: #include <map>.
10452         (class Kept_section): Change from struct to class.  Add accessors
10453         and setters.  Add section size to Comdat_group mapping.  Change
10454         Comdat_group to std::map.  Add is_comdat_ field.  Add
10455         linkonce_size field in union.
10456         (class Layout): Update declaration of find_or_add_kept_section.
10457         Don't declare find_kept_object.
10458         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10459         parameter.  Add object, shndx, is_comdat, and is_group_name
10460         parameters.  Change all callers.  Adjust for new Kept_section.
10461         (Layout::find_kept_object): Remove.
10462         * object.cc (Sized_relobj::include_section_group): Update use of
10463         Kept_section.  Rename secnum to shndx.  Only record
10464         Kept_comdat_section if sections are the same size.
10465         (Sized_relobj::include_linkonce_section): Update use of
10466         Kept_section.  Only record Kept_comdat_section if sections are the
10467         same size.  Set size of linkonce section.
10468         (Sized_relobj::map_to_kept_section): Update call to
10469         get_kept_comdat_section.
10470         * object.h (class Sized_relobj): Rename fields in
10471         Kept_comdat_section to drop trailing underscores; change object
10472         field to Relobj*.  Change Kept_comdat_section_table to store
10473         struct rather than pointer.
10474         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10475         Add kept_object and kept_shndx parameters.  Change all callers.
10476         (Sized_relobj::get_kept_comdat_section): Change return type to
10477         bool.  Add kept_object and kept_shndx parameters.  Change all
10478         callers.
10479         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10480         Layout::find_or_add_kept_section.
10481
10482 2009-07-09  Ian Lance Taylor  <iant@google.com>
10483
10484         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10485         Reserve space in the hash table.
10486
10487 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10488
10489         * fileread.cc (File_read::get_mtime): New method.
10490         * fileread.h (Timespec): New structure.
10491         (File_read::get_mtime): New method.
10492         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10493         Renamed from timestamp_nsec.
10494         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10495         Elf_Xword.
10496         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10497         timestamp_nsec.
10498         (Incremental_inputs::report_archive): Save mtime; style fix.
10499         (Incremental_inputs::report_obejct): Save mtime; style fix.
10500         (Incremental_inputs::report_script): Save mtime; style fix.
10501         (Incremental_inputs::finalize_inputs): Style fix.
10502         (Incremental_inputs::finalize): Style fix.
10503         (Incremental_inputs::create_input_section_data): Store inputs
10504         mtime.
10505         * incremental.h (Incremental_inputs::report_script): Add mtime
10506         argument.
10507         (Incremental_inputs::Input_info::Input_info): Intialize only one
10508         union member.
10509         (Incremental_inputs::Input_info::archive): Move to nameless
10510         union.
10511         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10512         (Incremental_inputs::Input_info::script): Move to nameless union.
10513         (Incremental_inputs::mtime): New field.
10514         * script.cc (read_input_script): Pass file mtime to
10515         Incremental_input.
10516         * script.h (Script_info::inputs): Style fix.
10517
10518 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10519
10520         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10521         instead of 32.
10522
10523 2009-06-24  Ian Lance Taylor  <iant@google.com>
10524
10525         PR 10156
10526         * layout.cc (Layout::choose_output_section): If we find an
10527         existing section, update the flags.
10528         (Layout::create_notes): New function, broken out of
10529         Layout::finalize.
10530         (Layout::finalize): Don't create note sections.
10531         (Layout::create_note): Don't crash if linker script discards
10532         section.
10533         (Layout::create_gold_note): Likewise.
10534         (Layout::create_build_id): Likewise.  Don't set
10535         after_input_sections on the section.
10536         (Layout::create_executable_stack_info): Remove target parameter.
10537         Change caller.
10538         * layout.h (class Layout): Declare create_notes.  Update
10539         declaration of create_executable_stack_info.
10540         * gold.cc (queue_middle_tasks): Call create_notes.
10541         * output.cc (Output_section::update_flags_for_input_section): Move
10542         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10543         invalid.
10544         * output.h (Output_data::mark_address_invalid): New function.
10545         (class Output_section): Only declare, not define,
10546         update_flags_for_input_section.  Remove set_flags.
10547
10548 2009-06-24  Ian Lance Taylor  <iant@google.com>
10549
10550         * script-sections.cc (Output_section_definition::
10551         set_section_addresses): Rename shadowing local load_address to
10552         laddr.
10553
10554 2009-06-24  Ian Lance Taylor  <iant@google.com>
10555
10556         PR 10244
10557         * reloc.cc (relocate_sections): Skip empty relocation sections.
10558
10559 2009-06-23  Ian Lance Taylor  <iant@google.com>
10560
10561         PR 10156
10562         * layout.cc (Layout::create_note): Use choose_output_section
10563         rather than make_output_section.
10564
10565 2009-06-23  Ian Lance Taylor  <iant@google.com>
10566
10567         PR 10237
10568         * options.cc (General_options::parse_V): Set printed_version_.
10569         (General_options::General_options): Initialize printed_version_.
10570         * options.h (class General_options): Add printed_version_ field.
10571         * gold.cc (queue_initial_tasks): If there are no input files,
10572         don't give a fatal error if we printed the version information.
10573         (queue_middle_tasks): If using -r with a shared object, give a
10574         fatal error rather than an ordinary error.
10575
10576 2009-06-23  Ian Lance Taylor  <iant@google.com>
10577
10578         PR 10219
10579         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10580         (Layout::make_output_section): Set have_stabstr_section_ if we see
10581         a .stab*str section.
10582         (Layout::finalize): Call link_stabs_sections.
10583         (Layout::link_stabs_sections): New file.
10584         * layout.h (class Layout): Add have_stabstr_section_ field.
10585         Declare link_stabs_sections.
10586
10587 2009-06-23  Doug Kwan  <dougkwan@google.com>
10588
10589         * Makefile.am (libgold_a_LIBADD): New.
10590         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10591         * Makefile.in: Regenerate.
10592         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10593         * configure: Regenerate.
10594         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10595         * fileread.cc: Include sys/state.h
10596         * gold.h: Declare memmem and strndup if found missing.
10597         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10598
10599 2009-06-23  Ian Lance Taylor  <iant@google.com>
10600
10601         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10602         * configure: Rebuild.
10603
10604 2009-06-23  Ian Lance Taylor  <iant@google.com>
10605
10606         PR 10147
10607         * object.cc (Object::section_contents): Don't try to get a view if
10608         the section has length zero.
10609         (Object::handle_gnu_warning_section): If the section is empty, use
10610         the name of the section as the warning.
10611
10612 2009-06-23  Ian Lance Taylor  <iant@google.com>
10613
10614         PR 10133
10615         * stringpool.h (class Stringpool_template): Add optimize_ field.
10616         (Stringpool_template::set_optimize): New function.
10617         * stringpool.cc (Stringpool_template::Stringpool_template):
10618         Initialize optimize_ field.
10619         (Stringpool_template::set_string_offsets): Test local optimize
10620         fild rather than parameter.
10621         * layout.cc (Layout::Layout): Call set_optimize on the section
10622         name stringpool.
10623
10624 2009-06-22  Ian Lance Taylor  <iant@google.com>
10625
10626         PR 10030
10627         * yyscript.y: Parse TARGET.
10628         * script.cc (script_set_target): New function.
10629         * script-c.h (script_set_target): Declare.
10630         * options.cc (General_options::string_to_object_format): Rename
10631         from string_to_object_format in anonymous namespace.  Change
10632         callers.
10633         * options.h (class General_options): Declare
10634         string_to_object_format.
10635
10636 2009-06-22  Ian Lance Taylor  <iant@google.com>
10637
10638         * script-sections.cc (Script_sections::create_segments): Don't put
10639         program headers in a PT_LOAD segment if -n or -N.
10640
10641 2009-06-22  Ian Lance Taylor  <iant@google.com>
10642
10643         PR 10141
10644         * options.h (class General_options): Add -z lazy and -z now.  Sort
10645         -z options into alphabetical order.
10646         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10647
10648 2009-06-21  Ian Lance Taylor  <iant@google.com>
10649
10650         * layout.cc (Layout::make_output_section): Call
10651         Target::new_output_section.
10652         (Layout::attach_allocated_section_to_segment): Put large section
10653         sections in a separate load segment with the large segment flag
10654         set.
10655         (Layout::segment_precedes): Sort large data segments after other
10656         load segments.
10657         (align_file_offset): New static function.
10658         (Layout::set_segment_offsets): Use align_file_offset.
10659         * output.h (class Output_section): Add is_small_section_ and
10660         is_large_section_ fields.
10661         (Output_section::is_small_section): New function.
10662         (Output_section::set_is_small_section):  New function.
10663         (Output_section::is_large_section): New function.
10664         (Output_section::set_is_large_section): New function.
10665         (Output_section::is_large_data_section): New function.
10666         (class Output_segment): Add is_large_data_segment_ field.
10667         (Output_segment::is_large_data_segment): New function.
10668         (Output_segment::set_is_large_data_segment): New function.
10669         * output.cc (Output_section::Output_section): Initialize new
10670         fields.
10671         (Output_segment::Output_segment): Likewise.
10672         (Output_segment::add_output_section): Add assertion that large
10673         data sections always go in large data segments.  Force small data
10674         sections to the end of the list of data sections.  Force small BSS
10675         sections to the start of the list of BSS sections.  For large BSS
10676         sections to the end of the list of BSS sections.
10677         * symtab.h (class Symbol): Declare is_common_shndx.
10678         (Symbol::is_defined): Check Symbol::is_common_shndx.
10679         (Symbol::is_common): Likewise.
10680         (class Symbol_table): Define enum Commons_section_type.  Update
10681         declarations.  Add small_commons_ and large_commons_ fields.
10682         * symtab.cc (Symbol::is_common_shndx): New function.
10683         (Symbol_table::Symbol_table): Initialize new fields.
10684         (Symbol_table::add_from_object): Put small and large common
10685         symbols in the right list.
10686         (Symbol_table::sized_finalized_symbol): Check
10687         Symbol::is_common_shndx.
10688         (Symbol_table::sized_write_globals): Likewise.
10689         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10690         common symbol lists.  Don't call do_allocate_commons_list if the
10691         list is empty.
10692         (Symbol_table::do_allocate_commons_list): Remove is_tls
10693         parameter.  Add comons_section_type parameter.  Change all
10694         callers.  Handle small and large common symbols.
10695         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10696         Symbol::is_common_shndx.
10697         * resolve.cc (symbol_to_bits): Likewise.
10698         * target.h (Target::small_common_shndx): New function.
10699         (Target::small_common_section_flags): New function.
10700         (Target::large_common_shndx): New function.
10701         (Target::large_common_section_flags): New function.
10702         (Target::new_output_section): New function.
10703         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10704         small_common_section_flags, and large_common_section_flags
10705         fields.
10706         (Target::do_new_output_section): New virtual function.
10707         * arm.cc (Target_arm::arm_info): Initialize new fields.
10708         * i386.cc (Target_i386::i386_info): Likewise.
10709         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10710         Likewise.
10711         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10712         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10713         (Target_x86_64::do_new_output_section): New function.
10714         * configure.ac: Define conditional MCMODEL_MEDIUM.
10715         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10716         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10717         (large_LDFLAGS): Define.
10718         * testsuite/large.c: New file.
10719         * testsuite/testfile.cc (Target_test::test_target_info):
10720         Initialize new fields.
10721         * configure, testsuite/Makefile.in: Rebuild.
10722
10723 2009-06-05  Doug Kwan  <dougkwan@google.com>
10724
10725         * Makefile.am (CCFILES): Add target.cc.
10726         * Makefile.in: Regenerate.
10727         * i386.cc (class Target_i386): Define new virtual method to
10728         override do_is_local_label_name in parent.
10729         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10730         local symbols if --discard-locals or -X is given.
10731         * options.h (class General_options): Declare new options
10732         '--discard-locals' and '-X' for discarding locals.
10733         * target.h (class Target): Define new methods is_local_label_name.
10734         Declare new virtual method do_is_local_label_name.
10735         * target.cc: New file.
10736         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10737         (check_SCRIPTS): Add discard_locals_test.sh.
10738         (check_DATA): Add discard_local_tests.syms.
10739         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10740         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10741         * testsuite/Makefile.in: Regenerate.
10742         * testsuite/discard_locals_test.c: New file.
10743         * testsuite/discard_locals_test.sh: Same.
10744
10745 2009-06-05  Doug Kwan  <dougkwan@google.com>
10746
10747         * object.cc (Sized_relobj::Sized_relobj): Initialize
10748         discarded_eh_frame_shndx_ to -1U.
10749         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10750         section.
10751         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10752         a discarded .eh_frame section.
10753         (Sized_relobj::do_finalize_local_symbols): Ditto.
10754         * object.h (class Sized_relobj): Declare new member
10755         discarded_eh_frame_shndx_.
10756         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10757         (local_labels_test.o, local_labels_test): New rules.
10758         * testsuite/Makefile.in: Regenerate.
10759
10760 2009-06-04  Doug Kwan  <dougkwan@google.com>
10761
10762         * layout.cc (Layout::section_name_mapping): Add mapping for
10763         special ARM sections.
10764
10765 2009-06-03  Doug Kwan  <dougkwan@google.com>
10766
10767         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10768         (utils::has_overflow): Same.
10769
10770 2009-06-03  Ian Lance Taylor  <iant@google.com>
10771
10772         * layout.cc (Layout::section_name_mapping): New array, replacing
10773         Layout::linkonce_mapping.
10774         (Layout::section_name_mapping_count): New variable, replacing
10775         Layout::linkonce_mapping_count.
10776         (Layout::linkonce_output_name): Remove.
10777         (Layout::output_section_name): Rewrite.
10778         * layout.h (class Layout): Rename Linkonce_mapping to
10779         Section_name_mapping, linkonce_mapping to section_name_mapping,
10780         linkonce_mapping_count to section_name_mapping_count.  Don't
10781         declare linkonce_output_name.
10782
10783 2009-06-03  Doug Kwan  <dougkwan@google.com>
10784
10785         * gold/arm.cc (namespace utils): New.
10786         (Target_arm::reloc_is_non_pic): Define new method.
10787         (class Arm_relocate_functions): New.
10788         (Target_arm::Relocate::relocate): Handle relocation types used by
10789         Android.
10790
10791 2009-06-03  Ian Lance Taylor  <iant@google.com>
10792
10793         * arm.cc (Target_arm::scan::global): Use || instead of |.
10794
10795 2009-06-02  Doug Kwan  <dougkwan@google.com>
10796
10797         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10798         issued_non_pic_error_.
10799         (class Target_arm::Scan): Declare new method check_non_pic.
10800         Define new method symbol_needs_plt_entry.
10801         Declare new data member issued_non_pic_error_.
10802         (class Target_arm::Relocate): Declare new method
10803         should_apply_static_reloc.
10804         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10805         (Target_arm::Scan::check_non_pic): Define new method.
10806         (Target_arm::Scan::local): Handle a small subset of reloc types used
10807         by Android.
10808         (Target_arm::Scan::local): Same.
10809         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10810
10811 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10812
10813         * incremental.cc (Incremental_inputs::report_command_line): Filter
10814         out --incremental-* options.
10815
10816 2009-05-29  Doug Kwan  <dougkwan@google.com>
10817
10818         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10819         template class.
10820         (class Target_arm): Update comment.
10821         (Target_arm::Target_arm): Initialize new data members GOT_,
10822         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10823         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10824         and Target_arm::rel_dyn_section.
10825         Declare new_enum Target_arm::Got_type.
10826         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10827         and DYNBSS_.
10828         Update commments for member do_dynsym_value.
10829         (Target_arm::got_size, Target_arm::plt_section,
10830         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10831         new methods inside class defintion.
10832         (Target_arm::got_section): Define new method.
10833         (Target_arm::rel_dyn_section): Same.
10834         (Output_data_plt_arm): New template class.
10835         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10836         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10837         (Output_data_plt_arm::add_entry): Same.
10838         (Output_data_plt_arm::first_plt_entry): Define new
10839         static data member for PLT instruction template.
10840         (Output_data_plt_arm::plt_entry): Same.
10841         (Output_data_plt_arm::do_write): Define new method.
10842         (Target_arm::make_plt_entry): Same.
10843         (Target_arm::do_finalize_sections): Same.
10844         (Target_arm::do_dynsym_value): Same.
10845
10846 2009-05-28  Doug Kwan  <dougkwan@google.com>
10847
10848         * Makefile.am (TARGETSOURCES): Add arm.cc.
10849         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10850         * Makefile.in: Regenerate.
10851         * arm.cc: New file.
10852         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10853
10854 2009-05-26  Doug Kwan  <dougkwan@google.com>
10855
10856         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10857         (General_options::check_excluded_libs): Strip off directories in
10858         archive name before matching like GNU ld does.
10859         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10860         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10861         (exclude_libs_test_LDFLAGS): Add linker option
10862         -Wl,--exclude-libs,libexclude_libs_test_3
10863         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10864         an explicit archive without using -l.
10865         (alt/libexclude_libs_test_3.a): New make rule.
10866         * testsuite/Makefile.in: Regenerate.
10867         * testsuite/exclude_libs_test.c : Declare lib3_default().
10868         (main): Call it.
10869         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10870         * exclude_libs_test_3.c: New file.
10871
10872 2009-05-26  Nick Clifton  <nickc@redhat.com>
10873
10874         * po/id.po: New Indonesian translation.
10875         * po/gold.pot: Updated template file.
10876
10877 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10878
10879         * testsuite/Makefile.am: Add -ffunction-sections to compile
10880         gc_comdat_test files.  Add -Wl,--gc-sections to build
10881         gc_comdat_test.
10882         * testsuite/Makefile.in: Regenerate.
10883         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10884
10885 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10886
10887         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10888         kept comdat section was garbage collected.
10889         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10890         * testsuite/Makefile.in: Regenerate.
10891         * testsuite/gc_comdat_test.sh: New file.
10892         * testsuite/gc_comdat_test_1.cc: New file.
10893         * testsuite/gc_comdat_test_2.cc: New file.
10894
10895 2009-05-19  Doug Kwan  <dougkwan@google.com>
10896
10897         * archive.cc (Archive::Archive): Move constructor from archive.h
10898         to here.  Initialize no_export_.
10899         (Archive::get_elf_object_for_member): Set no_export flag of object.
10900         * archive.h (Archive::Archive): Move constructor body to
10901         archive.cc.
10902         (Archive::no_export): New method.
10903         (Archive::no_export_): New field.
10904         * object.h (Object::Object): Initialize no_export_ to false.
10905         (Object::no_export, Object::set_no_export): New methods.
10906         (Object::no_export_): New field.
10907         * options.cc (General_options::parse_exclude_libs): New method.
10908         (General_options::check_excluded_libs) Same.
10909         * options.h (exclude_libs): New option.
10910         (General_options::check_excluded_libs): New method declaration.
10911         (General_options::excluded_libs_): New field.
10912         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10913         default or protected visibility if an object has no-export flag set.
10914         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10915         (check_SCRIPTS): Add exclude_libs_test.sh.
10916         (check_DATA): Add exclude_libs_test.syms.
10917         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10918         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10919         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10920         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10921         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10922         libexclude_libs_test_2.a): New rules.
10923         * testsuite/Makefile.in: Regenerate.
10924         * testsuite/exclude_libs_test.c: New file.
10925         * testsuite/exclude_libs_test.sh: Ditto.
10926         * testsuite/exclude_libs_test_1.c: Ditto.
10927         * testsuite/exclude_libs_test_2.c: Ditto.
10928
10929 2009-05-15  Ian Lance Taylor  <iant@google.com>
10930
10931         * configure.ac: Check for declarations for cases where libiberty.h
10932         checks HAVE_DECL_xxx.
10933         * configure, config.in: Rebuild.
10934
10935 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10936
10937         * gold.h (Incremental_argument_list): Remove (invalid) forward
10938         declaration.
10939         * incremental.cc (Incremental_inputs::report_achive): New method.
10940         (Incremental_inputs::report_object): New method.
10941         (Incremental_inputs::report_script): New method.
10942         (Incremental_inputs::finalize_inputs): New method.
10943         (Incremental_inputs::finalize): Call finalize_inputs().
10944         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10945         Create inputs entries.
10946         * incremental.h (Incremental_input_type): New enum.
10947         (Incremental_inputs::Incremental_input): Initialize new fields.
10948         (Incremental_inputs::report_inputs): New method.
10949         (Incremental_inputs::report_achive): New method.
10950         (Incremental_inputs::report_object): New method.
10951         (Incremental_inputs::report_script): New method.
10952         (Incremental_inputs::finalize_inputs): New method.
10953         (Incremental_inputs::Input_info): New struct.
10954         (Incremental_inputs::Input_info_map): New typedef.
10955         (Incremental_inputs::lock_): New field.
10956         (Incremental_inputs::Inputs_): New field.
10957         (Incremental_inputs::Inputs_map): New field.
10958         * main.cc (main): Call Incremental_input::report_inputs.
10959         * options.h (Input_argument_list): Typedef moved from
10960         Input_arguments.
10961         (Input_file_group::Files): Remove, use ::Input_argument_list.
10962         (Input_file_group::Input_argument_list): Remove, use
10963         ::Input_argument_list.
10964         * plugin.cc (Plugin_manager::add_input_file): Add error in
10965         incremental build.
10966         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10967         functions.
10968         * script.cc (read_input_script): Call
10969         Incremental_input::report_script.
10970         * script.h (Script_info): New class.
10971
10972 2009-04-27  Ian Lance Taylor  <iant@google.com>
10973
10974         * x86_64.cc (do_adjust_output_section): Set entsize to
10975         plt_entry_size.
10976
10977 2009-04-23  Elliott Hughes  <enh@google.com>
10978
10979         * output.cc (Output_file::close): After short writes, continue
10980         writing from the correct offset in the buffer being written.
10981
10982 2009-04-23  Chris Demetriou  <cgd@google.com>
10983
10984         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10985         * configure: Regenerate.
10986         * config.in: Regenerate.
10987         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10988         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10989
10990 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10991
10992         * incremental.cc (Incremental_inputs_header_data): Renamed from
10993         Incremental_input_header_data.
10994         (Incremental_inputs_header_data::data_size): New field.
10995         (Incremental_inputs_header_data::put_input_file_count): Renamed
10996         from input_file_count.
10997         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10998         from command_line_offset.
10999         (Incremental_inputs_header_data::put_reserved): Renamed from
11000         put_reserved.
11001         (Incremental_inputs_entry_data): Renamed from
11002         Incremental_input_entry_data.
11003         (Incremental_inputs_entry_data::data_size): New field.
11004         (Incremental_inputs::report_command_line): New method.
11005         (Incremental_inputs::finalize): New method.
11006         (Incremental_inputs::create_incremental_inputs_data): New method.
11007         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11008         * incremental.h: New file.
11009         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11010         (Layout::finalize): Create incremental inputs section in
11011         incremental builds.
11012         (Layout::create_incremental_info_sections): New method.
11013         * layout.h (Layout::incremental_inputs): New method.
11014         (Layout::create_incremental_info_sections): New method.
11015         (Layout::incremental_inputs_): New field.
11016         * main.cc (main): Notify Incremental_input of the command line.
11017
11018 2009-04-01  Ian Lance Taylor  <iant@google.com>
11019             Mikolaj Zalewski  <mikolajz@google.com>
11020
11021         * gold.h (reserve_unordered_map): Define, three versions, one for
11022         each version of Unordered_map.
11023         * layout.cc (Layout::Layout): Remove options parameter.  Add
11024         number_of_input_files parameter.  Don't initialize options_.
11025         Initialize number_of_input_files_ and resized_signatures_.  Move
11026         sections_are_attached_.
11027         (Layout::layout_group): Reserve space for group_signatures_.
11028         (Layout::find_or_add_kept_section): Change name parameter to be a
11029         reference.  Resize signatures_ map when it gets large enough.
11030         (Layout::layout_eh_frame): Use parameters->options() instead of
11031         this->options_.
11032         (Layout::make_output_section): Likewise.
11033         (Layout::attach_allocated_section_to_segment): Likewise.
11034         (Layout::finalize, Layout::create_executable_stack): Likewise.
11035         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11036         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11037         * layout.h (class Layout): Update declarations.  Remove options_
11038         field.  Add number_of_input_files_ and resized_signatures_
11039         fields.  Move sections_are_attached_ field.
11040         * main.cc (main): Pass number of input files to Layout
11041         constructor.  Don't pass options.
11042
11043 2009-03-30  Ian Lance Taylor  <iant@google.com>
11044
11045         * ffsll.c (ffsll): Correct implementation.
11046
11047 2009-03-27  Ian Lance Taylor  <iant@google.com>
11048
11049         * ffsll.c: New file.
11050         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11051         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11052         * ftruncate.c (ftruncate): Declare before definition.
11053         * mremap.c (mremap): Likewise.
11054         * pread.c (pread): Likewise.
11055         * configure, Makefile.in, config.in: Rebuild.
11056
11057         * mremap.c: New file.
11058         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11059         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11060         (mremap): Declare if HAVE_MREMAP is not defined.
11061         * configure, Makefile.in, config.in: Rebuild.
11062
11063 2009-03-27  Cary Coutant  <ccoutant@google.com>
11064
11065         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11066         position independent.
11067         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11068         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11069
11070 2009-03-24  Cary Coutant  <ccoutant@google.com>
11071
11072         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11073         an executable.
11074         (needs_dynamic_reloc): Likewise.
11075
11076 2009-03-24  Ian Lance Taylor  <iant@google.com>
11077
11078         * yyscript.y (file_cmd): Recognize EXTERN.
11079         (extern_name_list, extern_name_list_body): New nonterminals.
11080         * script.cc (script_add_extern): Define.
11081         * script-c.h (script_add_extern): Declare.
11082
11083 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11084
11085         * object.cc (is_elf_object): Define.
11086         * object.h (is_elf_object): Declare.
11087         * archive.cc (Archive::get_elf_object_for_member): Call
11088         is_elf_object.
11089         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11090
11091 2009-03-24  Elliott Hughes  <enh@google.com>
11092
11093         * output.cc (Output_file::map_anonymous): Define.
11094         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11095         try an anonymous one.  Report the size if the mmap fails.
11096         * output.h (class Output_file): Declare map_anonymous.
11097
11098 2009-03-24  Ian Lance Taylor  <iant@google.com>
11099
11100         * target-select.cc (instantiate_target): Don't acquire the lock if
11101         the instantiated_target_ field has already been set.
11102
11103 2009-03-23  Ian Lance Taylor  <iant@google.com>
11104
11105         * gold-threads.h (class Initialize_lock): Define.
11106         * gold-threads.cc (class Initialize_lock_once): Define.
11107         (initialize_lock_control): New static variable.
11108         (initialize_lock_pointer): New static variable.
11109         (initialize_lock_once): New static function.
11110         (Initialize_lock::Initialize_lock): Define.
11111         (Initialize_lock::initialize): Define.
11112         * target-select.h: Include "gold-threads.h".
11113         (class Target_selector): Add lock_ and initialize_lock_ fields.
11114         Don't define instantiate_target, just declare it.
11115         * target-select.cc (Target_selector::Target_selector): Initialize
11116         new fields.
11117         (Target_selector::instantiate_target): Define.
11118         * descriptors.h: Include "gold-threads.h".
11119         (class Descriptors): Add initialize_lock_ field.
11120         * descriptors.cc (Descriptors::Descriptors): Initialize new
11121         field.
11122         (Descriptors::open): Use initialize_lock_ field
11123         * errors.h (class Errors): Add initialize_lock_ field.
11124         * errors.cc (Errors::Errors): Initialize new field.
11125         (Errors::initialize_lock): Use initialize_lock_ field.
11126         * powerpc.cc (class Target_selector_powerpc): Remove
11127         instantiated_target_ field.  In do_recognize call
11128         instantiate_target rather than do_instantiate_target.  In
11129         do_instantiate_target just allocate a new target.
11130         * sparc.cc (class Target_selector_sparc): Likewise.
11131
11132         * freebsd.h: New file.
11133         * i386.cc: Include "freebsd.h".
11134         (Target_i386): Derive from Target_freebsd rather than
11135         Sized_target.
11136         (Target_selector_i386): Derive from Target_selector_freebsd rather
11137         than Target_selector.
11138         * x86_64.cc: Include "freebsd.h".
11139         (Target_x86_64): Derive from Target_freebsd rather than
11140         Sized_target.
11141         (Target_selector_x86_64): Derive from Target_selector_freebsd
11142         rather than Target_selector.
11143         * target.h (class Target): Add adjust_elf_header and
11144         do_adjust_elf_header.
11145         * output.cc (Output_file_header:: do_sized_write): Call target
11146         adjust_elf_header routine.
11147         * configure.tgt: Set targ_osabi.
11148         * configure.ac: Define GOLD_DEFAULT_OSABI.
11149         * parameters.cc (Parameters::default_target): Pass
11150         GOLD_DEFAULT_OSABI to select_target.
11151         * target-select.h (class Target_selector): Make instantiate_target
11152         protected rather than private.
11153         * Makefile.am (HFILES): Add freebsd.h.
11154         * configure, Makefile.in, config.in: Rebuild.
11155
11156         * merge.cc (do_add_input_section): Correct pend value.  Change
11157         message about last entry not being null terminated from error to
11158         warning.
11159
11160 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11161
11162         * incremental.cc: New file.
11163         * Makefile.am (CCFILES): Add incremental.cc.
11164         * Makefile.in: Rebuild.
11165
11166 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11167
11168         * layout.cc (Layout::output_section_name): Preserve names
11169         of '.note.' sections.
11170
11171 2009-03-19  Ian Lance Taylor  <iant@google.com>
11172
11173         * descriptors.cc (Descriptors::open): Check that the options are
11174         valid before using them.
11175
11176 2009-03-18  Ian Lance Taylor  <iant@google.com>
11177
11178         * script-sections.h: Include <list>.
11179         (class Script_sections): Change Sections_elements from std::vector
11180         to std::list.  Typedef public Elements_iterator.  Add
11181         orphan_section_placement_, data_segment_align_start_, and
11182         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11183         field.
11184         * script-sections.cc (class Orphan_section_placement): New class.
11185         (class Sections_element): Add virtual functions is_relro and
11186         orphan_section_init.  Remove virtual function place_orphan_here.
11187         (class Output_section_definition): Add is_relro and
11188         orphan_section_init.  Remove place_orphan_here.
11189         (class Orphan_output_section): Likewise.
11190         (Script_sections::Script_sections): Update for field changes.
11191         (Script_sections::data_segment_align): Set saw_data_segment_align_
11192         and data_segment_align_start_, not data_segment_align_index.
11193         (Script_sections::data_segment_relro_end): Check
11194         saw_data_segment_align_.  Use data_segment_align_start_ rather
11195         than data_segment_align_index_.
11196         (Script_sections::place_orphan): Rewrite to use
11197         Orphan_section_placement.
11198
11199 2009-03-17  Ian Lance Taylor  <iant@google.com>
11200
11201         * archive.cc (Archive::add_symbols): Check for a version attached
11202         to the symbol name in the archive map.
11203         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11204         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11205         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11206         (ver_test_11.a): New target.
11207         * testsuite/Makefile.in: Rebuild.
11208
11209         * configure.ac: Check for chsize and posix_fallocate.  Replace
11210         ftruncate.
11211         * ftruncate.c: New file, from gnulib.
11212         * output.cc (posix_fallocate): Define dummy version if not
11213         HAVE_POSIX_FALLOCATE.
11214         (Output_file::map): Call posix_fallocate rather than lseek and
11215         write.
11216         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11217         * configure, Makefile.in, config.in: Rebuild.
11218
11219 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11220
11221         * layout.h (Layout::create_note): Add section_name parameter.
11222         * layout.cc (Layout::create_note): Likewise.
11223         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11224
11225 2009-03-17  Ian Lance Taylor  <iant@google.com>
11226
11227         * descriptors.cc: Include "options.h".
11228         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11229         (Descriptors::open): Always use O_CLOEXEC when opening a new
11230         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11231         then set FD_CLOEXEC.
11232
11233         * sparc.cc (class Target_sparc): Add has_got_section.
11234         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11235         make sure we have a GOT section.
11236
11237         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11238         (Target_sparc::Scan::local): Likewise.
11239         (Target_sparc::Scan::global): Likewise.
11240         (Target_sparc::Relocate::relocate): Likewise.
11241         (Target_sparc::Relocate::relocate_tls): Likewise.
11242
11243         * symtab.cc (Symbol_table::define_default_version): New function,
11244         broken out of add_from_object.
11245         (Symbol_table::add_from_object): Call define_default_version.
11246         (Symbol_table::define_special_symbol): Add resolve_oldsym
11247         parameter.  Change all callers.  If the version for a symbol comes
11248         from a version script, resolve it with the symbol with the same
11249         name with no version.  Also add the symbol without a version if
11250         appropriate.
11251         (do_define_in_output_data): If resolving with oldsym, don't delete
11252         sym.
11253         (do_define_in_output_segment): Likewise.
11254         (do_define_as_constant): Likewise.
11255         * symtab.h (class Symbol_table): Update declarations.
11256
11257 2009-03-13  Ian Lance Taylor  <iant@google.com>
11258
11259         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11260         (Read_symbols::requeue): New function.
11261         (Read_symbols::do_read_symbols): If make_elf_object fails because
11262         the target type is not configured, and the file was searched for,
11263         issue a warning and retry with the next directory.
11264         (Add_symbols::run): If the file has an incompatible format, and
11265         it was searched for, requeue the Read_symbols task.  On error,
11266         release the object.
11267         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11268         dirindex parameter to constructor.  Change all callers.  Declare
11269         incompatible_warning and requeue.
11270         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11271         input_argument_ and input_group_ fields.  Add them to
11272         constructor.  Change all callers.
11273         (class Read_script): Add dirindex_ field.  Add it to constructor.
11274         Change all callers.
11275         * archive.cc (Archive::setup): Remove input_objects parameter.
11276         Change all callers.
11277         (Archive::get_file_and_offset): Likewise.
11278         (Archive::read_all_symbols): Likewise.
11279         (Archive::read_symbols): Likewise.
11280         (Archive::get_elf_object_for_member): Remove input_objects
11281         parameter.  Add punconfigured parameter.  Change all callers.
11282         (Archive::add_symbols): Change return type to bool.  Check return
11283         value of include_member.
11284         (Archive::include_all_members): Likewise.
11285         (Archive::include_member): Change return type to bool.  Return
11286         false if first included object has incompatible target.  Set
11287         included_member_ field.
11288         (Add_archive_symbols::run): If add_symbols returns false, requeue
11289         Read_symbols task.
11290         * archive.h (class Archive): Add included_member_ field.
11291         Initialize it in constructor.  Add input_file and searched_for
11292         methods.  Update declarations.
11293         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11294         input_argument_ fields.  Add them to constructor.  Change all
11295         callers.
11296         * script.cc: Include "target-select.h".
11297         (class Parser_closure): Add skip_on_incompatible_target_ and
11298         found_incompatible_target_ fields.  Add
11299         skip_on_incompatible_target parameter to constructor.  Change all
11300         callers.  Add methods skip_on_incompatible_target,
11301         clear_skip_on_incompatible_target, found_incompatible_target, and
11302         set_found_incompatible_target.
11303         (read_input_script): Add dirindex parameter.  Change all callers.
11304         If parser finds an incompatible target, requeue Read_symbols
11305         task.
11306         (script_set_symbol): Clear skip_on_incompatible_target in
11307         closure.
11308         (script_add_assertion, script_parse_option): Likewise.
11309         (script_start_sections, script_add_phdr): Likewise.
11310         (script_check_output_format): New function.
11311         * script.h (read_input_script): Update declaration.
11312         * script-c.h (script_check_output_format): Declare.
11313         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11314         (ignore_cmd): Remove OUTPUT_FORMAT.
11315         * fileread.cc (Input_file::Input_file): Add explicit this.
11316         (Input_file::will_search_for): New function.
11317         (Input_file::open): Add pindex parameter.  Change all callers.
11318         * fileread.h (class Input_file): Add input_file_argument method.
11319         Declare will_search_for.  Update declarations.
11320         * object.cc (make_elf_object): Add punconfigured parameter.
11321         Change all callers.
11322         * object.h (class Object): Make input_file public.  Add
11323         searched_for method.
11324         (make_elf_object): Update declaration.
11325         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11326         restart search.
11327         * dirsearch.h (class Dirsearch): Update declaration.
11328         * options.h (class General_options): Add --warn-search-mismatch.
11329         * parameters.cc (Parameters::is_compatible_target): New function.
11330         * parameters.h (class Parameters): Declare is_compatible_target.
11331         * workqueue.cc (Workqueue::add_blocker): New function.
11332         * workqueue.h (class Workqueue): Declare add_blocker.
11333
11334         * fileread.cc (Input_file::open): Remove options parameter.
11335         Change all callers.
11336         (Input_file::open_binary): Likewise.
11337         * script.cc (read_input_script): Likewise.
11338         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11339         options parameter from constructor.  Change all callers.
11340         (class Read_script): Likewise.
11341         * fileread.h (class Input_file): Update declarations.
11342         * script.h (read_input_script): Update declaration.
11343
11344 2009-03-10  Nick Clifton  <nickc@redhat.com>
11345
11346         * po/es.po: New Spanish translation.
11347
11348 2009-03-06  Cary Coutant  <ccoutant@google.com>
11349
11350         * options.cc (parse_short_option): Keep dash_z from registering itself.
11351
11352 2009-03-03  Ian Lance Taylor  <iant@google.com>
11353
11354         PR 9918
11355         * target-reloc.h (relocate_section): Pass output_section to
11356         relocate.
11357         * i386.cc (Target_i386::should_apply_static_reloc): Add
11358         output_section parameter.  Change all callers.
11359         (Target_i386::Relocate::relocate): Add output_section parameter.
11360         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11361         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11362         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11363         * testsuite/two_file_shared.sh: New script.
11364         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11365         (check_DATA): Add two_file_shared.dbg.
11366         (two_file_shared.dbg): New target.
11367         * testsuite/Makefile.in: Rebuild.
11368
11369 2009-03-01  Ian Lance Taylor  <iant@google.com>
11370
11371         * configure.ac: Check for byteswap.h.
11372         * configure: Rebuild.
11373         * config.in: Rebuild.
11374
11375 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11376
11377         * layout.cc (Layout::find_or_add_kept_section): New function.
11378         (Layout::add_comdat): Removed.
11379         * layout.h (struct Kept_section): Move out of class Layout.
11380         Remove trailing underscores from field names.  Add group_sections
11381         field.  Rename group_ field to is_group.  Change all uses.
11382         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11383         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11384         comdat_groups_ field.
11385         (Sized_relobj::include_section_group): Use
11386         find_or_add_kept_section and Kept_section::group_sections.
11387         (Sized_relobj::include_linkonce_section): Likewise.
11388         * object.cc (class Sized_relobj): Don't define Comdat_group or
11389         Comdat_group_table.  Remove find_comdat_group and
11390         add_comdat_group.  Remove comdat_groups_ field.
11391         * plugin.cc (include_comdat_group): Use
11392         Layout::find_or_add_kept_section.
11393
11394 2009-02-28  Ian Lance Taylor  <iant@google.com>
11395
11396         * README: --gc-sections and map files are now supported.  Document
11397         some build requirements.
11398
11399         PR 6992
11400         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11401         relocatable link set the value of the section symbol to zero.
11402         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11403         relocatable link don't include the section address in the local
11404         symbol value.
11405
11406 2009-02-27  Ian Lance Taylor  <iant@google.com>
11407
11408         PR 6811
11409         * options.h (class Search_directory): Add is_system_directory.
11410         (class General_options): Declare is_in_system_directory.
11411         * options.cc (get_relative_sysroot): Make static.
11412         (get_default_sysroot): Make static.
11413         (General_optoins::is_in_system_directory): New function.
11414         * fileread.cc (Input_file::is_in_system_directory): New function.
11415         * fileread.h (class Input_file): Declare is_in_system_directory.
11416         * object.h (class Object): Add is_in_system_directory.
11417         (class Input_objects): Remove system_library_directory_ field.
11418         * object.cc (Input_objects::add_object): Don't set
11419         system_library_directory_.
11420         (input_objects::found_in_system_library_directory): Remove.
11421         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11422         parameter.  Change all callers.
11423         (Symbol_table::sized_write_globals): Likewise.
11424         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11425         Call Object::is_in_system_directory.
11426         * symtab.h (class Symbol_table): Update declarations.
11427
11428         PR 5990
11429         * descriptors.h (Open_descriptor): Add is_on_stack field.
11430         * descriptors.cc (Descriptors::open): If the descriptor is on the
11431         top of the stack, remove it.  Initialize is_on_stack field.
11432         (Descriptors::release): Only add pod to stack if it is not on the
11433         stack already.
11434         (Descriptors::close_some_descriptor): Clear stack_next and
11435         is_on_stack fields.
11436
11437         PR 7091
11438         * output.cc (Output_section::find_starting_output_address): Rename
11439         from starting_output_address; add PADDR parameter; change return
11440         type.
11441         * output.h (class Output_section): Declare
11442         find_starting_output_address instead of starting_output_address.
11443         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11444         section symbol for which we can't find a merge section.
11445
11446         PR 9836
11447         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11448         hidden or internal, force the symbol to be local.
11449         * resolve.cc (Symbol::override_visibility): Define.
11450         (Symbol::override_base): Use override_visibility.
11451         (Symbol_table::resolve): Likewise.
11452         (Symbol::override_base_with_special): Likewise.
11453         (Symbol_table::override_with_special): If the visibility is hidden
11454         or internal, force the symbol to be local.
11455         * symtab.h (class Symbol): Add set_visibility and
11456         override_visibility.
11457         * testsuite/ver_test_1.sh: New file.
11458         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11459         (check_DATA): Add ver_test_1.syms.
11460         (ver_test_1.syms): New target.
11461         * testsuite/Makefile.in: Rebuild.
11462
11463 2009-02-25  Cary Coutant  <ccoutant@google.com>
11464
11465         * layout.cc (Layout::choose_output_section): Don't rename sections
11466         when using a linker script that has a SECTIONS clause.
11467         * Makefile.in: Regenerate.
11468
11469         * testsuite/Makefile.am (script_test_5.sh): New test case.
11470         * testsuite/Makefile.in: Regenerate.
11471         * testsuite/script_test_5.cc: New file.
11472         * testsuite/script_test_5.sh: New file.
11473         * testsuite/script_test_5.t: New file.
11474
11475 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11476
11477         * archive.cc (Archive::include_member): Update calls to add_symbols.
11478         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11479         the Layout argument.
11480         * dynobj.h (do_add_symbols): Add the Layout argument.
11481         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11482         Layout argument.
11483         * object.h (Object::add_symbols): Add the Layout argument.
11484         (Object::do_add_symbols): Add the Layout argument.
11485         (Sized_relobj::do_add_symbols): Add the Layout argument.
11486         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11487         Unify the two versions.
11488         (Add_plugin_symbols): Remove.
11489         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11490         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11491         (Add_plugin_symbols): Remove.
11492         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11493         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11494         (Add_symbols::run): Make it work with Pulginobj.
11495
11496 2009-02-06  Ian Lance Taylor  <iant@google.com>
11497
11498         * object.cc (Sized_relobj::do_layout): Make info message start
11499         with lower case letter.
11500
11501 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11502
11503         * binary.cc: Fix file comment.
11504
11505         * options.h (enum Incremental_disposition): Define.
11506         (class General_options): Add new options: --incremental,
11507         --incremental_changed, --incremental_unchanged,
11508         --incremental_unknown.  Add incremental_disposition_ and
11509         implicit_incremental_ fields.
11510         (General_options::incremental_disposition): New function.
11511         (class Position_dependent_options): Add incremental_disposition
11512         option.
11513         (Position_dependent_options::copy_from_options): Set incremental
11514         dispositions.
11515         * options.cc (General_options::parse_incremental_changed): New
11516         function.
11517         (General_options::parse_incremental_unchanged): New function.
11518         (General_options::parse_incremental_unknown): New function.
11519         (General_options::General_options): Initialize new fields
11520         incremental_disposition_ and implicit_incremental_.
11521         (General_options::finalize): Check for uasge of --incremental-*
11522         without --incremental.
11523
11524 2009-02-06  Chris Demetriou  <cgd@google.com>
11525
11526         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11527         pointer and to report location as the file name associated with
11528         the symbol.
11529         (gold_undefined_symbol_at_location): New function to replace the
11530         old gold_undefined_symbol functionality.
11531         * target-reloc.h (relocate_section): Update to use
11532         gold_undefined_symbol_at_location.
11533         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11534         Call gold_undefined_symbol function rather than gold_error.
11535         * errors.h (Errors::undefined_symbol): Take location as a
11536         string, rather than calculating it from a relocation.
11537         * errors.cc (Errors::fatal): Print "fatal error:" before the
11538         formatted message.
11539         (Errors::error, Errors::error_at_location): Print "error: "
11540         before the formatted message.
11541         (Errors::undefined_symbol): Take location as a string, rather
11542         than calculating it from a relocation.
11543         (gold_undefined_symbol_at_location): New function akin to
11544         old gold_undefined_symbol, calculates location from relocation.
11545         (gold_undefined_symbol): Change to take only a Symbol pointer
11546         and to report location as the file name associated with the symbol.
11547         * testsuite/debug_msg.sh: Update for changed error messages.
11548         * testsuite/undef_symbol.sh: Likewise.
11549
11550 2009-02-04  Duncan Sands  <baldrick@free.fr>
11551
11552         PR 9812
11553         * reduced_debug_output.h
11554         (Output_reduced_debug_abbrev_section::failed): Use format for
11555         gold_warning.
11556         (Output_reduced_debug_info_section::faild): Likewise.
11557
11558 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11559
11560         * script.cc (Lazy_demangler): New class.
11561         (Version_script_info::get_symbol_version_helper): Demangle a
11562         symbol only once.
11563
11564 2009-01-29  Cary Coutant  <ccoutant@google.com>
11565
11566         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11567         to __tls_get_addr.
11568         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11569
11570 2009-01-28  Ian Lance Taylor  <iant@google.com>
11571
11572         * version.cc (version_string): Bump to 1.9.
11573
11574         * gold.h: Include <cstring> and <stdint.h>.
11575         * version.cc: Include <cstdio>.
11576         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11577         warning.
11578         * reduced_debug_output.cc (insert_into_vector): Rename from
11579         Insert_into_vector; change all callers.  Use Swap_unaligned to
11580         avoid aliasing issue; remove union since it is unnecessary.
11581
11582 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11583
11584         * Makefile.am (CCFILES): Add gc.cc.
11585         (HFILES): Add gc.h.
11586         * Makefile.in: Regenerate.
11587         * gold.cc (Gc_runner): New class.
11588         (queue_initial_tasks): Call garbage collection related tasks
11589         when corresponding options are invoked.
11590         (queue_middle_gc_tasks): New function.
11591         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11592         processed early before laying out sections during garbage collection.
11593         * gold.h (queue_middle_gc_tasks): New function.
11594         (is_prefix_of): Move from "layout.cc".
11595         * i386.cc (Target_i386::gc_process_relocs): New function.
11596         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11597         * main.cc (main): Create object of class "Garbage_collection".
11598         * object.cc (Relobj::copy_symbols_data): New function.
11599         (Relobj::is_section_name_included): New function.
11600         (Sized_relobj::do_layout): Allow this function to be called twice
11601         during garbage collection and defer layout of section during the
11602         first call.
11603         * object.h (Relobj::get_symbols_data): New function.
11604         (Relobj::is_section_name_included): New function.
11605         (Relobj::copy_symbols_data): New function.
11606         (Relobj::set_symbols_data): New function.
11607         (Relobj::get_relocs_data): New function.
11608         (Relobj::set_relocs_data): New function.
11609         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11610         (Relobj::gc_process_relocs): New function.
11611         (Relobj::do_gc_process_relocs): New pure virtual function.
11612         (Relobj::sd_): New data member.
11613         (Sized_relobj::is_output_section_offset_invalid): New function.
11614         (Sized_relobj::do_gc_process_relocs): New function.
11615         * options.h (General_options::gc_sections): Modify to not be a no-op.
11616         (General_options::print_gc_sections): New option.
11617         * plugin.cc (Plugin_finish::run): Remove function call to
11618         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11619         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11620         * reloc.cc (Read_relocs::run): Add task to process relocs and
11621         determine unreferenced sections when doing garbage collection.
11622         (Gc_process_relocs): New class.
11623         (Sized_relobj::do_gc_process_relocs): New function.
11624         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11625         sections that are garbage collected.
11626         * reloc.h (Gc_process_relocs): New class.
11627         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11628         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11629         symbols whose corresponding sections are garbage collected.
11630         (Symbol_table::Symbol_table): Add new parameter for the garbage
11631         collection object.
11632         (Symbol_table::gc_mark_undef_symbols): New function.
11633         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11634         (Symbol_table::gc_mark_dyn_syms): New function.
11635         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11636         as garbage.
11637         (Symbol_table::add_from_object): Likewise.
11638         (Symbol_table::add_from_relobj): When building shared objects, do not
11639         treat externally visible symbols as garbage.
11640         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11641         table information for static and relocatable links.
11642         * symtab.h (Symbol_table::set_gc): New function.
11643         (Symbol_table::gc): New function.
11644         (Symbol_table::gc_mark_undef_symbols): New function.
11645         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11646         (Symbol_table::gc_mark_dyn_syms): New function.
11647         (Symbol_table::gc_): New data member.
11648         * target.h (Sized_target::gc_process_relocs): New pure virtual
11649         function.
11650         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11651         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11652
11653 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11654
11655         * options.h (General_options::gc_sections): Define as a no-op for now.
11656         (General_options::no_keep_memory): Ditto.
11657         (General_options::Bshareable): Define.
11658         * options.cc (General_options::finalize): Honor -Bshareable.
11659
11660 2009-01-20  Andreas Schwab  <schwab@suse.de>
11661
11662         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11663         read the value in the contents, since we don't use it.  Use the
11664         template endianness when writing.
11665         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11666
11667 2009-01-19  Andreas Schwab  <schwab@suse.de>
11668
11669         * configure.tgt (powerpc64-*): Fix targ_obj.
11670
11671 2009-01-15  Ian Lance Taylor  <iant@google.com>
11672
11673         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11674         local symbols when stripping all symbols.
11675
11676 2009-01-14  Cary Coutant  <ccoutant@google.com>
11677
11678         * output.cc (Output_reloc): Add explicit instantiations.
11679
11680 2009-01-14  Cary Coutant  <ccoutant@google.com>
11681
11682         * archive.cc (Archive::get_elf_object_for_member): Remove call
11683         to File_read::claim_for_plugin.
11684         * descriptors.cc (Descriptors::open): Remove reference to
11685         is_claimed.
11686         (Descriptors::claim_for_plugin): Remove.
11687         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11688         (Descriptors::is_claimed): Remove.
11689         (claim_descriptor_for_plugin): Remove.
11690         * fileread.cc (File_read::claim_for_plugin): Remove.
11691         * fileread.h (File_read::claim_for_plugin): Remove.
11692         (File_read::descriptor): Reopen descriptor if necessary.
11693         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11694         (Plugin_manager::all_symbols_read): Add task parameter. Change
11695         all callers.
11696         (Plugin_manager::get_input_file): New function.
11697         (Plugin_manager::release_input_file): New function.
11698         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11699         corresponding data member.
11700         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11701         and pass to base constructor. Change all callers.
11702         (get_input_file, release_input_file): New functions.
11703         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11704         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11705         (Plugin_manager::all_symbols_read): Add task parameter.
11706         (Plugin_manager::get_input_file): New function.
11707         (Plugin_manager::release_input_file): New function.
11708         (Plugin_manager::task_): New data member.
11709         (Pluginobj::Pluginobj): Add filesize parameter.
11710         (Pluginobj::filename): New function.
11711         (Pluginobj::descriptor): New function.
11712         (Pluginobj::filesize): New function.
11713         (Pluginobj::filesize_): New data member.
11714         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11715         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11716         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11717
11718         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11719         with archive libraries.
11720         * testsuite/Makefile.in: Regenerate.
11721         * testsuite/plugin_test.c (struct sym_info): New type.
11722         (get_input_file, release_input_file): New static variables.
11723         (onload): Capture new transfer vector entries.
11724         (claim_file_hook): Stop reading at end of file according to filesize.
11725         Factor out parsing of readelf output into separate function.
11726         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11727         APIs and get the source file name from the symbol table.  Convert
11728         source file name to corresponding object file name.  Print info
11729         message when adding new input files.
11730         (parse_readelf_line): New function.
11731         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11732         * testsuite/plugin_test_2.sh: Likewise.
11733         * testsuite/plugin_test_3.sh: Likewise.
11734         * testsuite/plugin_test_4.sh: New test case.
11735
11736 2009-01-07  Ian Lance Taylor  <iant@google.com>
11737
11738         * version.cc (version_string): Bump to 1.8.
11739
11740 2008-12-23  Cary Coutant  <ccoutant@google.com>
11741
11742         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11743         * plugin.cc (Plugin_manager::finish): Rename as
11744         layout_deferred_objects.  Move cleanup to separate function.
11745         (Plugin_manager::cleanup): New function.
11746         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11747         separately.
11748         * plugin.h (Plugin_manager::finish): Rename as
11749         layout_deferred_objects.
11750         (Plugin_manager::cleanup): New function.
11751         (Plugin_manager::cleanup_done): New field.
11752
11753 2008-12-23  Cary Coutant  <ccoutant@google.com>
11754
11755         * plugin.cc (is_visible_from_outside): New function.
11756         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11757         so we don't return "IR only" status for exported symbols or -r links.
11758
11759         * testsuite/Makefile.am (plugin_test_3): New test case.
11760         * testsuite/Makefile.in: Regenerate.
11761         * testsuite/plugin_test_3.sh: New file.
11762
11763 2008-12-22  Cary Coutant  <ccoutant@google.com>
11764
11765         * object.cc (Sized_relobj::layout_section): New function.
11766         (Sized_relobj::do_layout): Defer layout of input sections until after
11767         plugin has provided replacement files.
11768         (Sized_relobj::do_layout_deferred_sections): New function.
11769         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11770         (Relobj::layout_deferred_sections): New function.
11771         (Relobj::do_layout_deferred_sections): New function.
11772         (Sized_relobj::do_layout_deferred_sections): New function.
11773         (Sized_relobj::layout_section): New function.
11774         (Sized_relobj::Deferred_layout): New structure.
11775         (Sized_relobj::deferred_layout_): New field.
11776         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11777         Change all callers.  Layout deferred sections.
11778         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11779         references.
11780         (Plugin_hook::run): Move code from do_plugin_hook inline.
11781         (Plugin_hook::do_plugin_hook): Remove.
11782         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11783         (Plugin_manager::finish): Renamed, was cleanup.
11784         (Plugin_manager::should_defer_layout): New function.
11785         (Plugin_manager::add_deferred_layout_object): New function.
11786         (Plugin_manager::Deferred_layout_list): New type.
11787         (Plugin_manager::deferred_layout_objects_): New field.
11788         (Plugin_hook::do_plugin_hook): Remove.
11789
11790 2008-12-17  Ian Lance Taylor  <iant@google.com>
11791
11792         * options.h (class General_options): Add --no case for
11793         --export-dynamic.
11794
11795 2008-12-16  Cary Coutant  <ccoutant@google.com>
11796
11797         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11798         vector.
11799         (Plugin_manager::claim_file): Create plugin object even if
11800         plugin did not call the add_symbols callback.
11801         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11802         asking for more symbols than were added.
11803         * testsuite/Makefile.am (plugin_test_1): Add test case with
11804         no global symbols.
11805         (empty.syms): New target.
11806         * testsuite/Makefile.in: Regenerate.
11807         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11808         message. Don't call add_symbols if no globals.
11809         (all_symbols_read_hook): Don't provide replacement for empty
11810         claimed file.
11811
11812 2008-12-12  Ian Lance Taylor  <iant@google.com>
11813
11814         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11815         r_type == 0 for a local symbol with r_sym == 0.
11816         (scan_relocatable_relocs): Pass r_sym to
11817         local_non_section_strategy.
11818         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11819         r_sym parameter.
11820
11821         * configure.ac: Update test for TLS descriptors: they are
11822         supported as of glibc 2.9.
11823         * configure: Rebuild.
11824
11825 2008-12-11  Ian Lance Taylor  <iant@google.com>
11826
11827         PR 7091
11828         * target-reloc.h (Default_scan_relocatable_relocs): For each
11829         function, map r_type == 0 to RELOC_DISCARD.
11830
11831 2008-12-10  Cary Coutant  <ccoutant@google.com>
11832
11833         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11834         object to override a kept COMDAT group from a plugin object.
11835
11836 2008-12-09  Ian Lance Taylor  <iant@google.com>
11837
11838         PR 7088
11839         * yyscript.y (file_cmd): Handle INPUT.
11840
11841         * testsuite/initpri1.c: Change all declarations to be full
11842         prototypes by adding void, to avoid compiler warnings.
11843
11844 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11845
11846         * options.cc (General_options::parse_plugin_opt): New.
11847         (General_options::add_plugin): The argument now is just the filename.
11848         (General_options::add_plugin_option): New.
11849         * options.h (plugin_opt): New.
11850         (add_plugin): Change argument name.
11851         (add_plugin_option): New.
11852         * plugin.cc (Plugin::load): Don't parse the plugin option.
11853         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11854         (Plugin::add_option): New.
11855         (Plugin::args_): Change type.
11856         (Plugin::filename_): New.
11857         (Plugin_manager::add_plugin_option): New.
11858         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11859         * testsuite/Makefile.in: Regenerate.
11860
11861 2008-12-05  Cary Coutant  <ccoutant@google.com>
11862
11863         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11864         Handle --strip-lto-sections option.
11865         * options.h (strip_lto_sections): New option.
11866
11867 2008-12-01  Cary Coutant  <ccoutant@google.com>
11868
11869         * plugin.cc (ld_plugin_message): Change format parameter to const.
11870         Fix mismatch between new[] and delete.
11871
11872 2008-11-14  Cary Coutant  <ccoutant@google.com>
11873
11874         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11875         instead of -1U.
11876
11877 2008-11-05  Craig Silverstein  <csilvers@google.com>
11878
11879         * options.cc (General_options::parse_dynamic_list): New function.
11880         * options.h (General_options): New flags dynamic_list,
11881         dynamic_list_data, dynamic_list_cpp_new, and
11882         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11883         (General_options::in_dynamic_list): New function.
11884         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11885         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11886         (Lex::can_continue_name): Likewise.
11887         (yylex): Likewise.
11888         (read_script_file): New parameter script_options.
11889         (read_dynamic_list): New function.
11890         (Script_options::define_dynamic_list): New function.
11891         (dynamic_list_keyword_parsecodes): New variable.
11892         (dynamic_list_keywords): New variable.
11893         * script.h (Script_options::define_dynamic_list): New function
11894         prototype.
11895         (read_dynamic_list): New function prototype.
11896         * symtab.cc (strprefix): New macro.
11897         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11898         dynamic_list_data, dynamic_list_cpp_new, and
11899         dynamic_list_cpp_typeinfo.
11900         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11901         (dynamic_list_expr): New rule.
11902         (dynamic_list_nodes): Likewise.
11903         (dynamic_list_node): Likewise.
11904         * testsuite/Makefile.am (dynamic_list): New test.
11905         * testsuite/Makefile.in: Regenerated.
11906         * testsuite/dynamic_list.t: New file.
11907         * testsuite/dynamic_list.sh: New file.
11908
11909 2008-11-05  Craig Silverstein  <csilvers@google.com>
11910
11911         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11912         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11913         (t11_last): Likewise.
11914         * testsuite/ver_test_6.c (main): Likewise.
11915
11916 2008-10-07  Cary Coutant  <ccoutant@google.com>
11917
11918         * options.c (General_options::finalize): Add check for -static and
11919         -shared.
11920         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11921         is not empty.
11922
11923 2008-10-02  Cary Coutant  <ccoutant@google.com>
11924
11925         * plugin.cc (make_sized_plugin_object): Fix conditional
11926         compilation to work when not all targets are enabled.
11927
11928 2008-09-29  Cary Coutant  <ccoutant@google.com>
11929
11930         * archive.cc (Archive::get_file_and_offset): Use filename instead
11931         of name to get library path.
11932         (Archive::include_member): Unlock external member of a thin archive.
11933
11934         * testsuite/Makefile.am (TEST_AR): New variable.
11935         (thin_archive_test_1): New test.
11936         (thin_archive_test_2): New test.
11937         * testsuite/Makefile.in: Regenerate.
11938         * testsuite/thin_archive_main.cc: New file.
11939         * testsuite/thin_archive_test_1.cc: New file.
11940         * testsuite/thin_archive_test_2.cc: New file.
11941         * testsuite/thin_archive_test_3.cc: New file.
11942         * testsuite/thin_archive_test_4.cc: New file.
11943
11944 2008-09-29  Cary Coutant  <ccoutant@google.com>
11945
11946         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11947         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11948         instead of -1U.
11949         (Sized_relobj::do_finalize_local_symbols): Likewise.
11950         (Sized_relobj::map_to_kept_section): Likewise.
11951         * object.h (Sized_relobj::invalid_address): New constant.
11952         (Sized_relobj::do_output_section_offset): Check for invalid_address
11953         and return -1ULL.
11954         * output.cc (Output_reloc::local_section_offset): Use constant
11955         invalid_address instead of -1U.
11956         (Output_reloc::get_address): Likewise.
11957         (Output_section::output_address): Change -1U to -1ULL.
11958         * output.h (Output_reloc::invalid_address): New constant.
11959         * reloc.cc (Sized_relobj::write_sections): Use constant
11960         invalid_address instead of -1U.
11961         (Sized_relobj::relocate_sections): Likewise.
11962         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11963         values for merge sections.
11964         * target-reloc.h (relocate_for_relocatable): Use constant
11965         invalid_address instead of -1U.
11966
11967 2008-09-19  Cary Coutant  <ccoutant@google.com>
11968
11969         Add plugin functionality for link-time optimization (LTO).
11970         * configure.ac (plugins): Add --enable-plugins option.
11971         * configure: Regenerate.
11972         * config.in: Regenerate.
11973         * Makefile.am (LIBDL): New variable.
11974         (CCFILES): Add plugin.cc.
11975         (HFILES): Add plugin.h.
11976         (ldadd_var): Add LIBDL.
11977         * Makefile.in: Regenerate.
11978
11979         * archive.cc: Include "plugin.h".
11980         (Archive::setup): Don't preread archive symbols when using a plugin.
11981         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11982         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11983         files.
11984         (Archive::include_member): Add symbols from plugin objects.
11985         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11986         * descriptors.cc (Descriptors::open): Check for file descriptors
11987         abandoned by plugins.
11988         (Descriptors::claim_for_plugin): New function.
11989         * descriptors.h (Descriptors::claim_for_plugin): New function.
11990         (Open_descriptor::is_claimed): New field.
11991         (claim_descriptor_for_plugin): New function.
11992         * fileread.cc (File_read::claim_for_plugin): New function.
11993         * fileread.h (File_read::claim_for_plugin): New function.
11994         (File_read::descriptor): New function.
11995         * gold.cc: Include "plugin.h".
11996         (queue_initial_tasks): Add task to call plugin hooks for generating
11997         new object files.
11998         * main.cc: Include "plugin.h".
11999         (main): Load plugin libraries.
12000         * object.h (Pluginobj): Declare.
12001         (Object::pluginobj): New function.
12002         (Object::do_pluginobj): New function.
12003         (Object::set_target): New function.
12004         * options.cc: Include "plugin.h".
12005         (General_options::parse_plugin): New function.
12006         (General_options::General_options): Initialize plugins_ field.
12007         (General_options::add_plugin): New function.
12008         * options.h (Plugin_manager): Declare.
12009         (General_options): Add --plugin option.
12010         (General_options::has_plugins): New function.
12011         (General_options::plugins): New function.
12012         (General_options::add_plugin): New function.
12013         (General_options::plugins_): New field.
12014         * plugin.cc: New file.
12015         * plugin.h: New file.
12016         * readsyms.cc: Include "plugin.h".
12017         (Read_symbols::do_read_symbols): Check for archive before checking
12018         for ELF file.  Call plugin hooks to claim files.
12019         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12020         from a real object file; force override when processing replacement
12021         files.
12022         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12023         (Symbol::init_base_object): Likewise.
12024         (Symbol::init_base_output_data): Likewise.
12025         (Symbol::init_base_output_segment): Likewise.
12026         (Symbol::init_base_constant): Likewise.
12027         (Symbol::init_base_undefined): Likewise.
12028         (Symbol::output_section): Assert that object is not a plugin.
12029         (Symbol_table::add_from_pluginobj): New function.
12030         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12031         undefined.
12032         (Symbol_table::sized_write_globals): Likewise.
12033         (Symbol_table::add_from_pluginobj): Instantiate template.
12034         * symtab.h (Sized_pluginobj): Declare.
12035         (Symbol::in_real_elf): New function.
12036         (Symbol::set_in_real_elf): New function.
12037         (Symbol::in_real_elf_): New field.
12038         (Symbol_table::add_from_pluginobj): New function.
12039
12040         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12041         (LIBDL): New variable.
12042         (LDADD): Add LIBDL.
12043         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12044         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12045         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12046         (MOSTLYCLEANFILES): Likewise.
12047         * testsuite/Makefile.in: Regenerate.
12048         * testsuite/plugin_test.c: New file.
12049         * testsuite/plugin_test_1.sh: New file.
12050         * testsuite/plugin_test_2.sh: New file.
12051
12052 2008-09-16  Ian Lance Taylor  <iant@google.com>
12053
12054         * target-reloc.h (relocate_section): Check whether a symbol is
12055         defined by the ABI before reporting an undefined symbol error.
12056         * target.h (Target::is_defined_by_abi): Make parameter const.
12057         (Target::do_is_defined_by_abi): Likewise.
12058         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12059         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12060         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12061         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12062         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12063         * testsuite/Makefile.in: Rebuild.
12064
12065         * fileread.cc (make_view): Add casts to avoid warning.
12066
12067 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12068
12069         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12070         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12071
12072 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12073
12074         * options.h (General_options::output_is_executable): New.
12075         (General_options::output_is_pie): New.
12076         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12077         for shared libraries.
12078         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12079
12080 2008-09-11  Chris Demetriou  <cgd@google.com>
12081
12082         * options.h (origin): New -z option.
12083         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12084         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12085         in DT_FLAGS_1.
12086
12087 2008-09-05  Cary Coutant  <ccoutant@google.com>
12088
12089         * fileread.cc (File_read::make_view): Add check for attempt to map
12090         beyond end of file.
12091
12092 2008-09-05  Cary Coutant  <ccoutant@google.com>
12093
12094         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12095         explicit instantiations.
12096
12097 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12098
12099         PR gold/6858
12100         * options.cc (General_options::finalize): Allow undefined symbols
12101         in shlibs if linking -shared.
12102
12103         PR gold/6859
12104         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12105         symbols as not needing a dynsym entry.
12106
12107 2008-08-20  Craig Silverstein  <csilvers@google.com>
12108
12109         * fileread.cc (File_read::open): Do not lock the file unless it
12110         was successfully opened.
12111
12112 2008-08-14  Cary Coutant  <ccoutant@google.com>
12113
12114         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12115         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12116         * testsuite/tls_test.cc (struct int128): 128-bit struct
12117         for testing TLS relocs with non-zero addend.
12118         (v12): New TLS variable.
12119         (t12): New test.
12120         (t_last): Add check for v12.
12121         * testsuite/tls_test.h (t12): New function.
12122         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12123
12124 2008-08-13  Ian Lance Taylor  <iant@google.com>
12125
12126         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12127         set tls_segment_ or relro_segment_.
12128         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12129         when appropriate.
12130         * output.h (Output_section::clear_is_relro): New function.
12131         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12132         sections specially even when output_data_ is empty.
12133         (Output_segment::maximum_alignment): When first section is relro,
12134         only force alignment for PT_LOAD segments.
12135         * script.cc (script_data_segment_align): New function.
12136         (script_data_segment_relro_end): New function.
12137         * script-c.h (script_data_segment_align): Declare.
12138         (script_data_segment_relro_end): Declare.
12139         * script-sections.h (class Script_sections): Declare
12140         data_segment_align and data_segment_relro_end.  Add fields
12141         segment_align_index_ and saw_relro_end_.
12142         * script-sections.cc (class Sections_element): Add set_is_relro
12143         virtual function.  Add new bool* parameter to place_orphan_here.
12144         Add get_output_section virtual function.
12145         (class Output_section_definition): Add set_is_relro.  Add new
12146         bool* parameter to place_orphan_here.  Add get_output_section.
12147         Add is_relro_ field.
12148         (Output_section_definition::Output_section_definition): Initialize
12149         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12150         and is_relro_ fields.
12151         (Output_section_definition::place_orphan_here): Add is_relro
12152         parameter.
12153         (Output_section_definition::set_section_addresses): Set relro for
12154         output section.
12155         (Output_section_definition::alternate_constraint): Likewise.
12156         (class Orphan_output_section): Add new bool* parameter to
12157         place_orphan_here.  Add get_output_section.
12158         (Orphan_output_section::place_orphan_here): Add is_relro
12159         parameter.
12160         (Script_sections::Script_sections): Initialize
12161         data_segment_align_index_ and saw_relro_end_.
12162         (Script_sections::data_segment_align): New function.
12163         (Script_sections::data_segment_relro_end): New function.
12164         (Script_sections::place_orphan): Set or clear is_relro.
12165         (Script_sections::set_section_addresses): Force alignment of first
12166         TLS section.
12167         * yyscript.y (exp): Call script_data_segment_align and
12168         script_data_segment_relro_end.
12169         * testsuite/relro_script_test.t: New file.
12170         * testsuite/relro_test.cc (using_script): Declare.
12171         (t1, t2): Test using_script.
12172         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12173         (relro_script_test_SOURCES): Define.
12174         (relro_script_test_DEPENDENCIES): Define.
12175         (relro_script_test_LDFLAGS): Define.
12176         (relro_script_test_LDADD): Define.
12177         (relro_script_test.so): New target.
12178         * testsuite/Makefile.in: Rebuild.
12179
12180 2008-08-06  Cary Coutant <ccoutant@google.com>
12181
12182         * archive.cc (Archive::total_archives, Archive::total_members)
12183         (Archive::total_members_loaded): New variables.
12184         (Archive::setup): Add parameter.  Add option to preread
12185         archive symbols.
12186         (Archive::read_armap): Add counter.
12187         (Archive::get_file_and_offset): New function.
12188         (Archive::get_elf_object_for_member): New function.
12189         (Archive::read_all_symbols): New function.
12190         (Archive::read_symbols): New function.
12191         (Archive::add_symbols): Add counters.
12192         (Archive::include_all_members): Use armap to find members if it's
12193         already built.
12194         (Archive::include_member): Skip reading symbols if already read.
12195         Factored code into Archive::get_file_and_offset and
12196         Archive::get_elf_object_for_member.  Changed call to
12197         Mapfile::report_include_archive_member.
12198         (Archive::print_stats): New function.
12199         * archive.h: Declare Object and Read_symbols_data classes.
12200         (Archive::Archive): Add initializers for new members.
12201         (Archive::setup): Add parameter.
12202         (Archive::print_stats): New function.
12203         (Archive::total_archives, Archive::total_members)
12204         (Archive::total_members_loaded): New variables.
12205         (Archive::get_file_and_offset): New function.
12206         (Archive::get_elf_object_for_member): New function.
12207         (Archive::read_all_symbols): New function.
12208         (Archive::read_symbols): New function.
12209         (Archive::Archive_member): New class.
12210         (Archive::members_): New member.
12211         (Archive::num_members_): New member.
12212         * main.cc: Include archive.h.
12213         (main): Call Archive::print_stats.
12214         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12215         archive parameter; member_name is now the fully-decorated name.
12216         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12217         * options.h: (General_options): Add --preread-archive-symbols option.
12218         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12219         Archive::setup.
12220
12221 2008-08-04  Ian Lance Taylor  <iant@google.com>
12222
12223         * symtab.h (Symbol::use_plt_offset): New function.
12224         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12225         * powerpc.cc (Relocate::relocate): Likewise.
12226         * sparc.cc (Relocate::relocate): Likewise.
12227         * x86_64.cc (Relocate::relocate): Likewise.
12228         * testsuite/weak_plt.sh: New test.
12229         * testsuite/weak_plt_main.cc: New test.
12230         * testsuite/weak_plt_shared.cc: New test.
12231         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12232         (check_PROGRAMS): Add weak_plt.
12233         (check_DATA): Add weak_plt_shared.so.
12234         (weak_plt_main_pic.o, weak_plt): New targets.
12235         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12236         * testsuite/Makefile.in: Rebuild.
12237
12238         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12239         gcctestdir/ld.
12240         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12241         * testsuite/Makefile.in: Rebuild.
12242
12243 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12244
12245         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12246         * Makefile.in: Regenerate.
12247         * po/POTFILES.in: Regenerate.
12248
12249 2008-07-29  Ian Lance Taylor  <iant@google.com>
12250
12251         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12252         symbols before other symbols.
12253         * testsuite/script_test_2.cc (test_addr): Declare.
12254         (test_addr_alias): Declare.
12255         (main): Check that test_addr and test_addr_alias have the right
12256         values.
12257         * testsuite/script_test_2.t: Define test_addr_alias and
12258         test_addr.
12259
12260 2008-07-24  Ian Lance Taylor  <iant@google.com>
12261
12262         PR 5990
12263         * descriptors.cc: New file.
12264         * descriptors.h: New file.
12265         * gold-threads.h (class Hold_optional_lock): New class.
12266         * fileread.cc: Include "descriptors.h".
12267         (File_read::~File_read): Release descriptor rather than closing
12268         it.
12269         (File_read::open) [file]: Call open_descriptor rather than open.
12270         Set is_descriptor_opened_.
12271         (File_read::open) [memory]: Assert that descriptor is not open.
12272         (File_read::reopen_descriptor): New function.
12273         (File_read::release): Release descriptor.
12274         (File_read::do_read): Make non-const.  Reopen descriptor.
12275         (File_read::read): Make non-const.
12276         (File_read::make_view): Reopen descriptor.
12277         (File_read::do_readv): Likewise.
12278         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12279         Update declarations.
12280         * layout.cc: Include "descriptors.h".
12281         (Layout::create_build_id): Use open_descriptor rather than open.
12282         * output.cc: Include "descriptors.h".
12283         (Output_file::open): Use open_descriptor rather than open.
12284         * archive.cc (Archive::const_iterator): Change Archive to be
12285         non-const.
12286         (Archive::begin, Archive::end): Make non-const.
12287         (Archive::count_members): Likewise.
12288         * archive.h (class Archive): Update declarations.
12289         * object.h (Object::read): Make non-const.
12290         * Makefile.am (CCFILES): Add descriptors.cc.
12291         (HFILES): Add descriptors.h.
12292         * Makefile.in: Rebuild.
12293
12294         PR 6716
12295         * gold.h: Always include <clocale>.  Add Solaris workarounds
12296         following code in binutils/sysdep.h.
12297
12298         PR 6048
12299         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12300         this->eh_frame_hdr_ is NULL before using it.
12301
12302         * dynobj.cc (Versions::Versions): Update comment.
12303
12304         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12305         the base version name.
12306
12307         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12308         array size plus one.
12309         (Stringpool_template::set_string_offsets): Subtract one from key
12310         before using it as an array index.
12311         (Stringpool_template::get_offset_with_length): Likewise.
12312         (Stringpool_template::write_to_buffer): Likewise.
12313         * stringpool.h (Stringpool_template::get_offset_from_key):
12314         Likewise.
12315
12316 2008-07-23  Ian Lance Taylor  <iant@google.com>
12317
12318         PR 6658
12319         * object.h (Merged_symbol_value::value): Do our best to handle a
12320         negative addend.
12321
12322         PR 6647
12323         * script.cc (Version_script_info::get_versions): Don't add empty
12324         version tag to return value.
12325         (Version_script_info::get_symbol_version_helper): Change return
12326         type to bool.  Add pversion parameter.  Change all callers.
12327         (script_register_vers_node): Don't require a non-NULL tag.
12328         * script.h (class Version_script_info): Update declarations.
12329         (Version_script_info::get_symbol_version): Change return type to
12330         bool.  Add version parameter.  Change all callers.
12331         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12332         handling.  Handle an empty version from a version script.
12333         (Symbol_table::define_special_symbol): Likewise.
12334         * testsuite/ver_test_10.script: New file.
12335         * testsuite/ver_test_10.sh: New file.
12336         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12337         (check_DATA): Add ver_test_10.syms.
12338         (ver_test_10.syms, ver_test_10.so): New target.
12339         * testsuite/Makefile.in: Rebuild.
12340
12341 2008-07-23  Simon Baldwin  <simonb@google.com>
12342
12343         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12344         to zero for undefined symbols from dynamic libraries.
12345
12346 2008-07-23  Ian Lance Taylor  <iant@google.com>
12347
12348         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12349         Change all callers.
12350         * symtab.h (class Symbol_table): Update declaration.
12351         * testsuite/ver_test_9.cc: New file.
12352         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12353         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12354         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12355         (ver_test_9.so, ver_test_9.o): New targets.
12356         * testsuite/Makefile.in: Rebuild.
12357
12358 2008-07-22  Ian Lance Taylor  <iant@google.com>
12359
12360         * options.h (class General_options): Define --check-sections.
12361         * layout.cc (Layout::set_segment_offsets): Handle
12362         --check-sections.
12363
12364         * options.h (class General_options): Define -n/--nmagic and
12365         -N/--omagic.
12366         * options.cc (General_options::finalize): For -n/--nmagic or
12367         -N/--omagic, set -static.
12368         * layout.cc (Layout::attach_allocated_section_to_segment): If
12369         -N/--omagic, don't put read-only and read-write sections in
12370         different segments.
12371         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12372         finding a read-only segment.
12373         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12374         don't set the minimum segment alignment to the common page size,
12375         and don't set the file offset to the address modulo the page size.
12376         * script-sections.cc (Script_sections::create_segments): If
12377         -n/--omagic, don't put read-only and read-write sections in
12378         different segments.
12379
12380         * cref.cc: New file.
12381         * cref.h: New file.
12382         * options.h (class General_options): Add --print-symbol-counts.
12383         * main.cc (main): Issue defined symbol report if requested.
12384         * archive.cc (Archive::interpret_header): Make into a const member
12385         function.
12386         (Archive::add_symbols): Call Input_objects::archive_start and
12387         archive_stop.
12388         (Archive::const_iterator): Define new class.
12389         (Archive::begin, Archive::end): New functions.
12390         (Archive::include_all_members): Rewrite to use iterator.
12391         (Archive::count_members): New function.
12392         * archive.h (class Archive): Update declarations.
12393         (Archive::filename): New function.
12394         * object.cc: Include "cref.h".
12395         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12396         (Sized_relobj::do_get_global_symbol_counts): New function.
12397         (Input_objects::add_object): Add object to cross-referencer.
12398         (Input_objects::archive_start): New function.
12399         (Input_objects::archive_stop): New function.
12400         (Input_objects::print_symbol_counts): New function.
12401         * object.h: Declare Cref and Archive.
12402         (Object::get_global_symbol_counts): New function.
12403         (Object::do_get_global_symbol_counts): New pure virtual function.
12404         (class Sized_relobj): Add defined_count_ field.  Update
12405         declarations.
12406         (class Input_objects): Add cref_ field.  Update constructor.
12407         Update declarations.
12408         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12409         defined_count_.
12410         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12411         symbol counts.
12412         (Sized_dynobj::do_get_global_symbol_counts): New function.
12413         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12414         defined_count_.  Update declarations.  Define Symbols typedef.
12415         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12416         parameter.  Change all callers.
12417         (Symbol_table::add_from_dynobj): Add sympointers and defined
12418         parameters.  Change all callers.
12419         * symtab.h (class Symbol_table): Update declarations.
12420         * Makefile.am (CCFILES): Add cref.cc.
12421         (HFILES): Add cref.h.
12422         * Makefile.in: Rebuild.
12423
12424 2008-07-22  Simon Baldwin  <simonb@google.com>
12425
12426         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12427         to zero when writing undefined symbols.
12428
12429 2008-07-22  Ian Lance Taylor  <iant@google.com>
12430
12431         * output.cc (Output_section::add_input_section): Don't try to
12432         merge empty merge sections.
12433
12434 2008-07-21  Craig Silverstein  <csilvers@google.com>
12435
12436         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12437         Include symbol version in error message.
12438
12439 2008-07-20  Chris Demetriou  <cgd@google.com>
12440
12441         * configure.ac (gold_cv_c_random_seed): New configured variable.
12442         (RANDOM_SEED_CFLAGS): New substituted variable.
12443         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12444         * configure: Rebuild.
12445         * Makefile.in: Likewise.
12446         * testsuite/Makefile.in: Likewise.
12447
12448 2008-07-18  Ian Lance Taylor  <iant@google.com>
12449
12450         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12451         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12452         * testsuite/ver_test_main.cc (main): Call t4.
12453         (t4, t4_2a): Define.
12454         * testsuite/ver_test_2.cc (t4_2): Define.
12455         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12456         * testsuite/ver_test_4.cc (t4_2a): Define.
12457         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12458         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12459
12460 2008-07-17  Ian Lance Taylor  <iant@google.com>
12461
12462         * dynobj.cc (Versions::add_def): If we give an error about a
12463         missing version, go ahead and create the version anyhow.
12464
12465 2008-07-10  Ian Lance Taylor  <iant@google.com>
12466
12467         Handle output sections with more than 0x7fffffff bytes.
12468         * object.h (class Relobj): Change map_to_output_ to
12469         output_sections_, and just keep a section pointer.  Change all
12470         uses.  Move comdat group support to Sized_relobj.
12471         (Relobj::is_section_specially_mapped): Remove.
12472         (Relobj::output_section): Remove poff parameter.  Change all
12473         callers.
12474         (Relobj::output_section_offset): New function.
12475         (Relobj::set_section_offset): Rewrite.
12476         (Relobj::map_to_output): Remove.
12477         (Relobj::output_sections): New function.
12478         (Relobj::do_output_section_offset): New pure virtual function.
12479         (Relobj::do_set_section_offset): Likewise.
12480         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12481         group support from Relobj.  Update declarations.
12482         (Sized_relobj::get_output_section_offset): New function.
12483         (Sized_relobj::do_output_section_offset): New function.
12484         (Sized_relobj::do_set_section_offset): New function.
12485         * object.cc (Relobj::output_section_address): Remove.
12486         (Sized_relobj::Sized_relobj): Initialize new fields.
12487         (Sized_relobj::include_section_group): Cast find_kept_object to
12488         Sized_relobj.
12489         (Sized_relobj::include_linkonce_section): Likewise.
12490         (Sized_relobj::do_layout): Use separate arrays for output section
12491         and output offset.
12492         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12493         output_sections.
12494         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12495         output_sections and section_offsets.
12496         (Sized_relobj::write_local_symbols): Likewise.
12497         (map_to_kept_section): Compute output address directly.
12498         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12499         output_sections and section_offsets.
12500         (Sized_relobj::write_sections): Likewise.
12501         (Sized_relobj::relocate_sections): Likewise.
12502         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12503         * output.h (class Output_reloc): Update declarations.  Change
12504         u2_.relobj to Sized_relobj*.
12505         (class Output_data_reloc): Change add functions to use
12506         Sized_relobj*.
12507         * output.cc (Output_reloc::Output_reloc): Change relobj to
12508         Sized_relobj*.
12509         (Output_reloc::local_section_offset): Change return type to
12510         Elf_Addr.  Use get_output_section_offset.
12511         (Output_reloc::get_address): Likewise.
12512         (Output_section::is_input_address_mapped): Don't call
12513         is_section_specially_mapped.
12514         (Output_section::output_offset): Likewise.
12515         (Output_section::output_address): Likewise.
12516         (Output_section::starting_output_address): Likewise.
12517         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12518         parameter to Sized_relobj*.
12519         (Copy_relocs::need_copy_reloc): Likewise.
12520         (Copy_relocs::save): Likewise.
12521         * copy-relocs.h (class Copy_relocs): Update declarations.
12522         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12523         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12524         * target-reloc.h (relocate_for_relocatable): Change
12525         offset_in_output_section type to Elf_Addr.  Change code that uses
12526         it as well.
12527         * layout.cc (Layout::layout): Always set *off.
12528         * mapfile.cc (Mapfile::print_input_section): Use
12529         output_section_offset.
12530         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12531         Sized_relobj*.
12532         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12533         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12534         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12535
12536 2008-07-03  Ian Lance Taylor  <iant@google.com>
12537
12538         * layout.cc (Layout::include_section): Do not discard unrecognized
12539         SHT_STRTAB sections.
12540
12541 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12542
12543         * script.cc (Lex::can_continue_name): Make '?' allowable in
12544         version-script names.
12545         * testsuite/version_script.map: Change glob pattern to use '?'
12546
12547 2008-06-30  Manish Singh  <yosh@gimp.org>
12548
12549         PR 6585
12550         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12551         Correct typo.
12552
12553 2008-06-30  Ian Lance Taylor  <iant@google.com>
12554
12555         PR 6660
12556         PR 6682
12557         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12558         versions]: Don't try to read the value in the contents, since we
12559         don't use it.  Use the template endianness when writing.
12560
12561 2008-06-25  Cary Coutant  <ccoutant@google.com>
12562
12563         * fileread.cc (File_read::make_view): Assert on zero-length view.
12564         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12565         symbol table when there are no symbols to read.
12566
12567 2008-06-23  Craig Silverstein  <csilvers@google.com>
12568
12569         * version.cc (version_string): Bump to 1.7
12570
12571 2008-06-18  Craig Silverstein  <csilvers@google.com>
12572
12573         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12574         constant 0xFFFF to type Valtype.
12575         (Powerpc_relocate_functions::rel16_ha): Likewise.
12576
12577 2008-06-17  Ian Lance Taylor  <iant@google.com>
12578
12579         * output.h (Output_section::Input_section): Initialize p2align_ to
12580         zero for Output_section_data constructors.
12581         (Output_section::Input_section::addralign): If not an input
12582         section, return the alignment of the Output_section_data.
12583         * testsuite/copy_test.cc: New file.
12584         * testsuite/copy_test_1.cc: New file.
12585         * testsuite/copy_test_2.cc: New file.
12586         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12587         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12588         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12589         (copy_test_1_pic.o, copy_test_1.so): New targets.
12590         (copy_test_2_pic.o, copy_test_2.so): New targets.
12591         * testsuite/Makefile.in: Rebuild.
12592
12593         * script-sections.cc (Script_sections::place_orphan): Initialize
12594         local variable exact.
12595
12596 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12597
12598         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12599
12600 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12601             David S. Miller  <davem@davemloft.net>
12602
12603         * powerpc.cc: New file.
12604         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12605         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12606         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12607         * Makefile.in: Rebuild.
12608
12609 2008-06-09  Ian Lance Taylor  <iant@google.com>
12610
12611         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12612         <exception>.
12613         (throwing, orig_terminate): New static variables.
12614         (terminate_handler): New static function.
12615         (t2): Set terminate handler.
12616
12617 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12618
12619         PR 6584
12620         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12621         alignment.
12622
12623 2008-05-30  Cary Coutant  <ccoutant@google.com>
12624
12625         * archive.cc (Archive::include_all_members) Correct to step
12626         over symbol table and extended name table in thin archives.
12627
12628 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12629
12630         PR 6407
12631         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12632         calculation.
12633
12634 2008-05-28  Caleb Howe  <cshowe@google.com>
12635
12636         * reduced_debug_output.cc: New file.
12637         * reduced_debug_output.h: New file.
12638         * options.h (class General_options): Add --strip-debug-non-line.
12639         * options.cc (General_options::finalize): Add strip_debug_non_line
12640         to the strip heirarchy.
12641         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12642         fields.
12643         * layout.cc: Include "reduced_debug_output.h".
12644         (Layout::Layout): Initialize new fields.
12645         (line_only_debug_sections): New static array.
12646         (is_lines_only_debug_sections): New static inline function.
12647         (Layout::include_section): Handle --strip-debug-non-line.
12648         (Layout::make_output_section): If --strip-debug-non-line, build
12649         new output sections for .debug_abbrev and .debug_info.
12650         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12651         gold.  Warn about possible overflow.
12652         (read_signed_LEB_128): Likewise.
12653         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12654         (read_signed_LEB_128): Declare.
12655         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12656         (HFILES): Add reduced_debug_output.h.
12657         * Makefile.in: Rebuild.
12658
12659 2008-05-21  Ian Lance Taylor  <iant@google.com>
12660
12661         * mapfile.cc: New file.
12662         * mapfile.h: New file.
12663         * options.h (class General_options): Add -M/--print-map and -Map.
12664         * options.cc (General_options::finalize): Make -M equivalent to
12665         -Map -.
12666         * main.cc: Include <cstdio> and "mapfile.h".
12667         (main): Open mapfile if requested.
12668         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12669         constructor.  Change caller.
12670         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12671         (queue_middle_tasks): Likewise.
12672         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12673         declarations.
12674         * archive.cc: Include "mapfile.h".
12675         (Archive::add_symbols): Add mapfile parameter.  Change all
12676         callers.  Pass mapfile, symbol, and reason to include_member.
12677         (Archive::include_all_members): Add mapfile parameter.  Change all
12678         callers.
12679         (Archive::include_member): Add mapfile, sym, and why parameters.
12680         Change all callers.  Report inclusion to map file.
12681         * archive.h: Include "fileread.h".
12682         (class Archive): Update declarations.
12683         (Archive::file): New const method.
12684         (class Add_archive_symbols): Add mapfile_ field.  Update
12685         constructor.  Change all callers.
12686         * readsyms.h (class Read_symbols): Likewise.
12687         (class Finish_group): Likewise.
12688         (class Read_script): Likewise.
12689         * common.cc: Include "mapfile.h".
12690         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12691         all callers.
12692         (Symbol_table::do_allocate_commons): Likewise.
12693         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12694         symbol allocation to mapfile.
12695         * common.h (class Allocate_commons_task): Add mapfile_ field.
12696         Update constructor.  Change all callers.
12697         * symtab.h (class Symbol_table): Update declarations.
12698         * layout.cc: Include "mapfile.h".
12699         (Layout_task_runner::run): Print information to mapfile.
12700         (Layout::create_gold_note): Change Output_data_fixed_space to
12701         Output_data_zero_fill.
12702         (Layout::create_build_id): Likewise.
12703         (Layout::print_to_mapfile): New function.
12704         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12705         constructor.  Change caller.
12706         (class Layout): Declare print_to_mapfile.
12707         * output.cc (Output_section::Input_section::print_to_mapfile): New
12708         function.
12709         (Output_section::add_input_section): If producing a map, always
12710         add to input_sections_ list.
12711         (Output_section::do_print_to_mapfile): New function.
12712         (Output_segment::print_sections_to_mapfile): New function.
12713         (Output_segment::print_section_list_to_mapfile): New function.
12714         * output.h: Include "mapfile.h".
12715         (Output_data::print_to_mapfile): New function.
12716         (Output_data::do_print_to_mapfile): New virtual function.
12717         (Output_segment_headers::do_print_to_mapfile): New function.
12718         (Output_file_header::do_print_to_mapfile): New function.
12719         (Output_data_const::do_print_to_mapfile): New function.
12720         (class Output_data_const_buffer): Add map_name_ field.  Update
12721         constructor.  Change all callers.  Add do_print_to_mapfile
12722         function.
12723         (class Output_data_fixed_space): Likewise.
12724         (class Output_data_space): Likewise.
12725         (class Output_data_zero_fill): New class.
12726         (Output_data_strtab::do_print_to_mapfile): New function.
12727         (Output_data_reloc_base::do_print_to_mapfile): New function.
12728         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12729         (Output_data_group::do_print_to_mapfile): New function.
12730         (Output_data_got::do_print_to_mapfile): New function.
12731         (Output_data_dynamic::do_print_to_mapfile): New function.
12732         (Output_symtab_xindex::do_print_to_mapfile): New function.
12733         (class Output_section): Declare do_print_to_mapflie.  Declare
12734         print_to_mapfile in Input_section.
12735         (class Output_segment): Declare new functions.
12736         * object.h (Sized_relobj::symbol_count): New function.
12737         * script-sections.cc
12738         (Output_section_element_dot_assignment::set_section_addresses):
12739         Change Output_data_fixed_space to Output_data_zero_fill.
12740         (Output_data_expression::do_print_to_mapfile): New function.
12741         * script.cc (read_input_script): Add mapfile parameter.  Change
12742         all callers.
12743         * script.h (read_input_script): Update declaration.
12744         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12745         (Eh_frame::do_print_to_mapfile): New function.
12746         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12747         (Output_merge_string::do_print_to_mapfile): New function.
12748         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12749         function.
12750         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12751         function.
12752         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12753         function.
12754         * Makefile.am (CCFILES): Add mapfile.cc.
12755         (HFILES): Add mapfile.h.
12756         * Makefile.in: Rebuild.
12757
12758 2008-05-19  Ian Lance Taylor  <iant@google.com>
12759
12760         * options.h (class General_options): Add -z relro.
12761         * layout.cc (Layout::Layout): Initialize relro_segment_.
12762         (Layout::add_output_section_data): Return the output section.
12763         (Layout::make_output_section): Rcognize relro sections and mark
12764         them appropriately.
12765         (Layout::attach_allocated_section_to_segment): Put relro sections
12766         in a PT_GNU_RELRO segment.
12767         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12768         section as relro.
12769         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12770         PT_TLS segments.
12771         (Layout::linkonce_mapping): Map d.rel.ro.local to
12772         .data.rel.ro.local.
12773         (Layout::output_section_name): Us .data.rel.ro.local for any
12774         section which begins with that.
12775         * layout.h (class Layout): Update add_output_section_data
12776         declaration.  Add relro_segment_ field.
12777         * output.cc (Output_section::Output_section): Initialize is_relro_
12778         and is_relro_local_ fields.
12779         (Output_segment::add_output_section): Group relro sections.
12780         (Output_segment::is_first_section_relro): New function.
12781         (Output_segment::maximum_alignment): If there is a relro section,
12782         align the segment to the common page size.
12783         (Output_segment::set_section_addresses): Track whether we are
12784         looking at relro sections.  If the last section is a relro
12785         section, align to the common page size.
12786         (Output_segment::set_section_list_addresses): Add in_relro
12787         parameter.  Change all callers.  Align to the page size when
12788         moving from relro to non-relro section.
12789         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12790         segment.
12791         * output.h (class Output_section): Add is_relro_ and
12792         is_relro_local_ fields.
12793         (Output_section::is_relro): New function.
12794         (Output_section::set_is_relro): New function.
12795         (Output_section::is_relro_local): New function.
12796         (Output_section::set_is_relro_local): New function.
12797         (class Output_segment): Update declarations.
12798         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12799         * sparc.cc (Target_sparc::got_section): Likewise.
12800         * x86_64.cc (Target_x86_64::got_section): Likewise.
12801         * testsuite/relro_test_main.cc: New file.
12802         * testsuite/relro_test.cc: New file.
12803         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12804         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12805         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12806         (relro_test.so, relro_test_pic.o): New targets.
12807         * testsuite/Makefile.in: Rebuild.
12808
12809 2008-05-16  Ian Lance Taylor  <iant@google.com>
12810
12811         * output.cc (Output_segment::add_output_section): Remove front
12812         parameter.
12813         * output.h (class Output_segment): Remove
12814         add_initial_output_section and overloaded add_output_section.
12815         Update declaration of remaining add_output_section.
12816         * layout.cc (Layout::create_interp): Call add_output_section
12817         rather than add_initial_output_section.
12818         (Layout::finish_dynamic_section): Likewise.
12819
12820         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12821         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12822         know the dynamic type.
12823         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12824         field.  Initialize it in constructor.
12825         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12826         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12827         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12828         reloc.
12829
12830         * output.cc (Output_reloc::get_address): Change return type to
12831         Elf_Addr.
12832         * output.h (class Output_reloc): Update get_address declaration.
12833         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12834         for section addresses.
12835
12836 2008-05-09  Ian Lance Taylor  <iant@google.com>
12837
12838         PR 6493
12839         * gold.cc (gold_nomem): Use return value of write.
12840
12841 2008-05-08  Ian Lance Taylor  <iant@google.com>
12842
12843         * symtab.c (Symbol::init_base_output_data): Add version
12844         parameter.  Change all callers.
12845         (Symbol::init_base_output_segment): Likewise.
12846         (Symbol::init_base_constant): Likewise.
12847         (Symbol::init_base_undefined): Likewise.
12848         (Sized_symbol::init_output_data): Likewise.
12849         (Sized_symbol::init_output_segment): Likewise.
12850         (Sized_symbol::init_constant): Likewise.
12851         (Sized_symbol::init_undefined): Likewise.
12852         (Symbol_table::do_define_in_output_data): If the new symbol has a
12853         version, mark it as the default.
12854         (Symbol_table::do_define_in_output_segment): Likewise.
12855         (Symbol_table::do_define_as_constant): Likewise.
12856         * symtab.h (class Symbol): Update declarations.
12857         (class Sized_symbol): Likewise.
12858         * resolve.cc (Symbol::override_version): New function.
12859         (Symbol::override_base): Call override_version.
12860         (Symbol::override_base_with_special): Likewise.
12861         * testsuite/ver_script_8.script: New file.
12862         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12863         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12864         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12865         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12866
12867 2008-05-06  Ian Lance Taylor  <iant@google.com>
12868
12869         PR 6049
12870         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12871         functions.
12872         (class General_options): Remove existing --undefined, and add
12873         --no-undefined instead.  Add new --undefined as synonym for -u.
12874         * archive.cc (Archive::add_symbols): Check whether symbol was
12875         named with -u.
12876         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12877         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12878         all uses.  Add IS_UNDEFINED.  Update declarations to split
12879         different versions of init_base.  Declare init_base_undefined.
12880         (Symbol::is_defined): Handle IS_UNDEFINED.
12881         (Symbol::is_undefined): Likewise.
12882         (Symbol::is_weak_undefined): Call is_undefined.
12883         (Symbol::is_absolute): Handle IS_CONSTANT.
12884         (class Sized_symbol): Update declarations to split different
12885         versions of init.  Declare init_undefined.
12886         (class Symbol_table): Declare new functions.
12887         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12888         Change all callers.
12889         (Symbol::init_base_output_data): Likewise.
12890         (Symbol::init_base_output_segment): Likewise.
12891         (Symbol::init_base_constant): Likewise.
12892         (Symbol::init_base_undefined): New function.
12893         (Sized_symbol::init_object): Rename from init.  Change all
12894         callers.
12895         (Sized_symbol::init_output_data): Likewise.
12896         (Sized_symbol::init_output_segment): Likewise.
12897         (Sized_symbol::init_constant): Likewise.
12898         (Sized_symbol::init_undefined): New function.
12899         (Symbol_table::add_undefined_symbols_from_command_line): New
12900         function.
12901         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12902         function.
12903         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12904         (Symbol::output_section): Likewise.
12905         (Symbol::set_output_section): Likewise.
12906         (Symbol_table::sized_finalize_symbol): Likewise.
12907         (Symbol_table::sized_write_globals): Likewise.
12908         * resolve.cc (Symbol_table::should_override): Likewise.
12909         (Symbol::override_base_with_special): Likewise.
12910
12911         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12912         symbol, change it to have default visibility.
12913         * testsuite/protected_1.cc: New file.
12914         * testsuite/protected_2.cc: New file.
12915         * testsuite/protected_3.cc: New file.
12916         * testsuite/protected_main_1.cc: New file.
12917         * testsuite/protected_main_2.cc: New file.
12918         * testsuite/protected_main_3.cc: New file.
12919         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12920         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12921         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12922         (protected_1.so): New target.
12923         (protected_1_pic.o, protected_2_pic.o): New targets.
12924         (protected_3_pic.o): New target.
12925         (check_PROGRAMS): Add protected_2.
12926         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12927         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12928         * testsuite/Makefile.in: Rebuild.
12929
12930         * options.h (DEFINE_var): Add set_user_set_##varname__.
12931         (DEFINE_bool_alias): New macro.
12932         (class General_options): Define -Bstatic using DEFINE_bool_alias
12933         rather than DEFINE_special.  Add --undefined as an alias for -z
12934         defs.
12935         * options.cc (General_options::parse_Bstatic): Remove.
12936
12937         * options.h (class General_options): Add --fatal-warnings.
12938         * main.cc (main): Implement --fatal-warnings.
12939         * errors.h (Errors::warning_count): New function.
12940
12941         * options.h (class General_options): Add -Bsymbolic-functions.
12942         * symtab.h (Symbol::is_preemptible): Check for
12943         -Bsymbolic-functions.
12944
12945 2008-05-05  Ian Lance Taylor  <iant@google.com>
12946
12947         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12948         as noVARNAME rather than no-VARNAME.
12949         (class General_options): Add option -z combreloc.
12950         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12951         get_address.
12952         (Output_reloc::sort_before) [SHT_REL]: New function.
12953         (Output_reloc::sort_before) [SHT_RELA]: New function.
12954         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12955         Sort_relocs_comparison.
12956         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12957         parameter.  Change all callers.
12958         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12959         sort_relocs parameter.  Change all callers.
12960         * output.cc (Output_reloc::get_address): New function, broken out
12961         of write_rel.
12962         (Output_reloc::write_rel): Call it.
12963         (Output_reloc::compare): New function.
12964         (Output_data_reloc_base::do_write): Optionally sort relocs.
12965
12966         * configure.ac: If targ_extra_obj is set, link it in.
12967         * configure.tgt: Initialize all variables.
12968         (x86_64*): Set targ_extra_obj and targ_extra_size.
12969         * configure: Rebuild.
12970
12971         * object.cc (Sized_relobj::include_section_group): Adjust section
12972         indexes read from group data.  Build vector to pass to
12973         layout_group.
12974         * layout.cc (Layout::layout_group): Add flags and shndxes
12975         parameters.  Remove contents parameter.  Change caller.  Update
12976         explicit instantiations.
12977         * layout.h (class Layout): Update layout_group declaration.
12978         * output.cc (Output_data_group::Output_data_group): Add flags and
12979         input_shndxes parameters.  Remove contents parameter.  Change
12980         caller.
12981         (Output_data_group::do_write): Change input_sections_ to
12982         input_shndxes_.
12983         * output.h (class Output_data_group): Update constructor
12984         declaration.  Rename input_sections_ to input_shndxes_.
12985         * testsuite/many_sections_test.cc: Add template.
12986
12987 2008-04-30  Cary Coutant  <ccoutant@google.com>
12988
12989         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12990
12991         * layout.cc (Layout::include_section): Refactored check for debug
12992         info section.
12993         (Layout::add_comdat): Add new parameters.  Change type
12994         of signature parameter.  Add object and shndx to signatures table.
12995         (Layout::find_kept_object): New function.
12996         * layout.h: Include <cstring>.
12997         (Layout::is_debug_info_section): New function.
12998         (Layout::add_comdat): Add new parameters.
12999         (Layout::find_kept_object): New function.
13000         (Layout::Kept_section): New struct.
13001         (Layout::Signatures): Change type of map range.
13002         * object.cc (Relobj::output_section_address): New function.
13003         (Sized_relobj::include_section_group): Add new parameters.  Change
13004         calls to Layout::add_comdat.  Change to build table of kept comdat
13005         groups and table mapping discarded sections to kept sections.
13006         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13007         (Sized_relobj::do_layout): Change calls to include_section_group and
13008         include_linkonce_section.
13009         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13010         value to zero when section is discarded.
13011         (Sized_relobj::map_to_kept_section): New function.
13012         * object.h (Relobj::output_section_address): New function.
13013         (Relobj::Comdat_group): New type.
13014         (Relobj::find_comdat_group): New function.
13015         (Relobj::Comdat_group_table): New type.
13016         (Relobj::Kept_comdat_section): New type.
13017         (Relobj::Kept_comdat_section_table): New type.
13018         (Relobj::add_comdat_group): New function.
13019         (Relobj::set_kept_comdat_section): New function.
13020         (Relobj::get_kept_comdat_section): New function.
13021         (Relobj::comdat_groups_): New field.
13022         (Relobj::kept_comdat_sections_): New field.
13023         (Symbol_value::input_value): Update comment.
13024         (Sized_relobj::map_to_kept_section) New function.
13025         (Sized_relobj::include_linkonce_section): Add new parameter.
13026         * target-reloc.h (Comdat_behavior): New type.
13027         (get_comdat_behavior): New function.
13028         (relocate_section): Add code to map a discarded section to the
13029         corresponding kept section when applying a relocation.
13030
13031 2008-04-30  Craig Silverstein  <csilvers@google.com>
13032
13033         * dwarf_reader.cc (next_generation_count): New static var.
13034         (Addr2line_cache_entry): New struct.
13035         (addr2line_cache): New static var.
13036         (Dwarf_line_info::one_addr2line): Added caching.
13037         (Dwarf_line_info::clear_addr2line_cache): New function.
13038         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13039         cache-size parameter.
13040         (Dwarf_line_info::one_addr2line_cache): New function.
13041         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13042         new cache-size argument to one_addr2line(), and clear cache.
13043
13044 2008-04-28  Cary Coutant  <ccoutant@google.com>
13045
13046         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13047         R_386_PC8 relocations.
13048
13049 2008-04-23  Ian Lance Taylor  <iant@google.com>
13050
13051         * object.cc (Sized_relobj::include_section_group): Check for
13052         invalid section group.
13053
13054         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13055         header size.
13056
13057         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13058         than read for file header.
13059         * archive.cc (Archive::include_member): Likewise.
13060
13061 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13062
13063         * aclocal.m4: Regenerate.
13064         * configure: Regenerate.
13065
13066 2008-04-19  Ian Lance Taylor  <iant@google.com>
13067
13068         * version.cc (version_string): Bump to 1.6.
13069
13070         * testsuite/Makefile.am (many_sections_r_test): New target.
13071         (many_sections_r_test_SOURCES): Remove.
13072         (many_sections_r_test_DEPENDENCIES): Remove.
13073         (many_sections_r_test_LDFLAGS): Remove.
13074         (many_sections_r_test_LDADD): Remove.
13075
13076         * object.cc (Sized_relobj::do_add_symbols): Always pass
13077         local_symbol_count_ to add_from_relobj.
13078
13079         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13080         every thousand variables.
13081         * testsuite/Makefile.in: Rebuild.
13082
13083         * object.cc (Xindex::initialize_symtab_xindex): New function.
13084         (Xindex::read_symtab_xindex): New function.
13085         (Xindex::sym_xindex_to_shndx): New function.
13086         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13087         available.
13088         (Sized_relobj::do_initialize_xindex): New function.
13089         (Sized_relobj::do_read_symbols): Adjust section links.
13090         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13091         parameter.  Change all callers.
13092         (Sized_relobj::include_section_group): Adjust section links and
13093         symbol section indexes.
13094         (Sized_relobj::do_layout): Adjust section links.
13095         (Sized_relobj::do_count_local_symbols): Adjust section links and
13096         symbol section indexes.
13097         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13098         ordinary and special symbols.
13099         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13100         dynsym_xindex parameters.  Change all callers.  Adjust section
13101         links.  Use SHN_XINDEX when needed.
13102         (Sized_relobj::get_symbol_location_info): Adjust section links.
13103         Don't get fooled by special symbols.
13104         * object.h (class Xindex): Define.
13105         (class Object): Add xindex_ parameter.  Declare virtual functoin
13106         do_initialize_xindex.
13107         (Object::adjust_sym_shndx): New function.
13108         (Object::set_xindex): New protected function.
13109         (class Symbol_value): Add is_ordinary_shndx_ field.
13110         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13111         (Symbol_value::value): Assert ordinary section.
13112         (Symbol_value::initialize_input_to_output_map): Likewise.
13113         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13114         Change all callers.
13115         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13116         all callers.
13117         (class Sized_relobj): Update declarations.
13118         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13119         parameter.  Change all callers.
13120         (Sized_relobj::adjust_shndx): New function.
13121         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13122         field.
13123         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13124         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13125         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13126         (Sized_dynobj::read_dynsym_section): Adjust section links.
13127         (Sized_dynobj::read_dynamic): Likewise.
13128         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13129         section links.
13130         (Sized_dynobj::do_initialize_xindex): New function.
13131         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13132         do_initialize_xindex.
13133         (Sized_dynobj::adjust_shndx): New function.
13134         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13135         dynsym_xindex_ fields.
13136         (Layout::finalize): Add a call to set_section_indexes before
13137         creating the symtab sections.
13138         (Layout::set_section_indexes): Don't do anything if the section
13139         already has a section index.
13140         (Layout::create_symtab_sections): Add shnum parameter.  Change
13141         caller.  Create .symtab_shndx section if needed.
13142         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13143         caller.
13144         (Layout::allocated_output_section_count): New function.
13145         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13146         needed.
13147         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13148         fields.  Update declarations.
13149         (Layout::symtab_xindex): New function.
13150         (Layout::dynsym_xindex): New function.
13151         (class Write_symbols_task): Add layout_ field.
13152         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13153         Change caller.
13154         * output.cc (Output_section_headers::Output_section_headers): Add
13155         shstrtab_section parameter.  Change all callers.
13156         (Output_section_headers::do_sized_write): Store overflow values
13157         for section count and section string table section index in
13158         section header zero.
13159         (Output_file_header::do_sized_write): Check for overflow of
13160         section count and section string table section index.
13161         (Output_symtab_xindex::do_write): New function.
13162         (Output_symtab_xindex::endian_do_write): New function.
13163         * output.h (class Output_section_headers): Add shstrtab_section_.
13164         Update declarations.
13165         (class Output_symtab_xindex): Define.
13166         (Output_section::has_out_shndx): New function.
13167         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13168         field.
13169         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13170         Change all callers.
13171         (Sized_symbol::init): Likewise.
13172         (Symbol::output_section): Check for ordinary symbol.
13173         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13174         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13175         callers.
13176         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13177         Change all callers.  Simplify handling of symbols from sections
13178         not included in the link.
13179         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13180         distinction.
13181         (Weak_alias_sorter::operator()): Assert that symbols are
13182         ordinary.
13183         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13184         distinction.
13185         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13186         parameters.  Change all callers.
13187         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13188         symbol distinction.  Use SHN_XINDEX when needed.
13189         (Symbol_table::write_section_symbol): Add symtab_xindex
13190         parameter.  Change all callers.
13191         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13192         SHN_XINDEX when needed.
13193         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13194         declarations.
13195         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13196         (Symbol::is_defined): Check is_ordinary.
13197         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13198         (Symbol::is_absolute, Symbol::is_common): Likewise.
13199         (class Sized_symbol): Update declarations.
13200         (class Symbol_table): Update declarations.
13201         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13202         parameters.  Change all callers.
13203         (Sized_symbol::override): Likewise.
13204         (Symbol_table::override): Likewise.
13205         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13206         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13207         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13208         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13209         to be in an ordinary section.
13210         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13211         object and is_ordinary parameters.  Change all callers.
13212         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13213         Change all callers.  Don't add undefined or non-ordinary symbols
13214         to reloc_map_.
13215         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13216         Change all callers.
13217         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13218         declarations.
13219         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13220         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13221         (Sized_relobj::relocate_sections): Likewise.
13222         * target-reloc.h (scan_relocs): Adjust section symbol index.
13223         (scan_relocatable_relocs): Likewise.
13224         * i386.cc (Scan::local): Check for ordinary symbols.
13225         * sparc.cc (Scan::local): Likewise.
13226         * x86_64.cc (Scan::local): Likewise.
13227         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13228         to symbol_section_and_value.
13229         * testsuite/many_sections_test.cc: New file.
13230         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13231         (check_PROGRAMS): Add many_sections_test.
13232         (many_sections_test_SOURCES): Define.
13233         (many_sections_test_DEPENDENCIES): Define.
13234         (many_sections_test_LDFLAGS): Define.
13235         (BUILT_SOURCES): Add many_sections_define.h.
13236         (many_sections_define.h): New target.
13237         (BUILT_SOURCES): Add many_sections_check.h.
13238         (many_sections_check.h): New target.
13239         (check_PROGRAMS): Add many_sections_r_test.
13240         (many_sections_r_test_SOURCES): Define.
13241         (many_sections_r_test_DEPENDENCIES): Define.
13242         (many_sections_r_test_LDFLAGS): Define.
13243         (many_sections_r_test_LDADD): Define.
13244         (many_sections_r_test.o): New target.
13245         * testsuite/Makefile.in: Rebuild.
13246
13247 2008-04-17  Cary Coutant  <ccoutant@google.com>
13248
13249         * errors.cc (Errors::info): New function.
13250         (gold_info): New function.
13251         * errors.h (Errors::info): New function.
13252         * gold.h (gold_info): New function.
13253         * object.cc (Input_objects::add_object): Print trace output.
13254         * options.cc (options::parse_set): New function.
13255         (General_options::parse_wrap): Deleted.
13256         (General_options::General_options): Deleted initializer.
13257         * options.h (options::String_set): New typedef.
13258         (options::parse_set): New function.
13259         (DEFINE_set): New macro.
13260         (General_options::wrap): Changed to use DEFINE_set. Changed
13261         callers of any_wrap_symbols and is_wrap_symbol.
13262         (General_options::trace, General_options::trace_symbol):
13263         New options.
13264         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13265         (General_options::wrap_symbols_): Deleted.
13266         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13267
13268 2008-04-17  David S. Miller  <davem@davemloft.net>
13269
13270         * options.cc (General_options::parse_V): New function.
13271         * options.h: Add entries for -V and -Qy.
13272
13273 2008-04-17  Ian Lance Taylor  <iant@google.com>
13274
13275         * common.cc (Symbol_table::allocate_commons): Remove options
13276         parameter.  Change caller.
13277         (Symbol_table::do_allocate_commons): Remove options parameter.
13278         Change caller.  Just call do_allocate_commons_list twice.
13279         (Symbol_table::do_allocate_commons_list): New function, broken out
13280         of do_allocate_commons.
13281         * common.h (class Allocate_commons_task): Remove options_ field.
13282         Update constructor.
13283         * symtab.cc (Symbol_table::Symbol_table): Initialize
13284         tls_commons_.
13285         (Symbol_table::add_from_object): Put TLS common symbols on
13286         tls_commons_ list.
13287         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13288         which are IN_OUTPUT_DATA.
13289         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13290         allocate_commons and do_allocate_commons declarations.  Declare
13291         do_allocate_commons_list.
13292         * gold.cc (queue_middle_tasks): Update creation of
13293         Allocate_commons_task to not pass options.
13294         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13295         (TLS_TEST_C_FLAGS): New variable.
13296         (tls_test_c_pic.o): New target.
13297         (tls_test_shared.so): Link in tls_test_c_pic.o.
13298         (tls_test_c_pic_ie.o): New target.
13299         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13300         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13301         (tls_test_c.o): New target.
13302         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13303         (tls_pic_test_LDADD): Likewise.
13304         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13305         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13306         (tls_test_c_gnu2.o): New target.
13307         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13308         tls_test_c_gnu2.o.
13309         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13310         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13311         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13312         * testsuite/tls_test.cc: Include "config.h".
13313         (t_last): Call t11_last.
13314         * testsuite/tls_test.h (t11, t11_last): Declare.
13315         * testsuite/tls_test_c.c: New file.
13316         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13317         * configure.ac: Check for OpenMP support.
13318         * configure, config.in, Makefile.in: Rebuild.
13319         * testsuite/Makefile.in: Rebuild.
13320
13321 2008-04-16  Cary Coutant  <ccoutant@google.com>
13322
13323         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13324         (Target_i386::tls_base_symbol_defined_): New field.
13325         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13326         (Target_i386::Scan::global): Likewise.
13327         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13328         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13329         (Target_x86_64::tls_base_symbol_defined_): New field.
13330         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13331         (Target_x86_64::Scan::global): Likewise.
13332
13333 2008-04-16  Cary Coutant  <ccoutant@google.com>
13334
13335         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13336         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13337         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13338         building shared libraries.
13339         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13340         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13341         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13342         * testsuite/Makefile.in: Rebuild.
13343         * testsuite/weak_undef.h: New file.
13344         * testsuite/weak_undef_file1.cc: Add extra test cases.
13345         * testsuite/weak_undef_file2.cc: Likewise.
13346         * testsuite/weak_undef_test.cc: Likewise.
13347
13348 2008-04-16  David S. Miller  <davem@davemloft.net>
13349
13350         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13351         Add issued_non_pic_error_ field.  Declare check_non_pic.
13352         (Target_sparc::Scan::check_non_pic): New function.
13353         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13354         (Target_sparc::Scan::global): Likewise.
13355
13356         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13357         * configure: Rebuild.
13358
13359         * options.h (DEFINE_enable): New macro.
13360         (new_dtags): New enable option.
13361         (initfirst, interpose, loadfltr, nodefaultlib,
13362         nodelete, nodlopen, nodump): New -z options.
13363         * layout.cc (Layout:finish_dynamic_section): If new
13364         dtags enabled, emit DT_RUNPATH.  Also, emit a
13365         DT_FLAGS_1 containing any specified -z flags.
13366
13367 2008-04-16  Ian Lance Taylor  <iant@google.com>
13368
13369         * copy-relocs.cc: New file.
13370         * copy-relocs.h: New file.
13371         * reloc.cc: Remove Copy_relocs code.
13372         * reloc.h: Likewise.
13373         * reloc-types.h (struct Reloc_types) [both versions]: Add
13374         get_reloc_addend_noerror.
13375         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13376         variants of add_global which take an addend which must be zero.
13377         * i386.cc: Include "copy-relocs.h".
13378         (class Target_i386): Change type of copy_relocs_ to variable,
13379         update initializer.
13380         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13381         Change all callers.
13382         (Target_i386::do_finalize_sections): Change handling of
13383         copy_relocs_.
13384         * sparc.cc: Include "copy-relocs.h".
13385         (class Target_sparc): Change type of copy_relocs_ to variable,
13386         update initializer.
13387         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13388         Change all callers.
13389         (Target_sparc::do_finalize_sections): Change handling of
13390         copy_relocs_.
13391         * x86_64.cc: Include "copy-relocs.h".
13392         (class Target_x86_64): Change type of copy_relocs_ to variable,
13393         update initializer.
13394         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13395         class.  Change all callers.
13396         (Target_x86_64::do_finalize_sections): Change handling of
13397         copy_relocs_.
13398         * Makefile.am (CCFILES): Add copy-relocs.cc.
13399         (HFILES): Add copy-relocs.h.
13400
13401         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13402
13403         * testsuite/script_test_4.sh: Permit leading zeroes.
13404
13405 2008-04-15  Ian Lance Taylor  <iant@google.com>
13406
13407         * script-sections.cc (Script_sections::create_segments): Use
13408         header_size_adjustment even when there is enough room for the
13409         headers.
13410         * testsuite/script_test_4.sh: New file.
13411         * testsuite/script_test_4.t: New file.
13412         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13413         (check_DATA): Add script_test_4.stdout.
13414         (MOSTLYCLEANFILES): Likewise.
13415         (script_test_4): New target.
13416         (script_test_4.stdout): New target.
13417         * testsuite/Makefile.in: Rebuild.
13418
13419         * sparc.cc: Add definitions for Output_data_plt_sparc class
13420         constants.
13421
13422 2008-04-14  David S. Miller  <davem@davemloft.net>
13423
13424         * sparc.cc: New file.
13425         * Makefile.am (TARGETSOURCES): Add sparc.cc
13426         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13427         * configure.tgt: Document targ_extra_size and
13428         targ_extra_big_endian.  Add entries for sparc-* and
13429         sparc64-*.
13430         * configure.ac: Handle targ_extra_size and
13431         targ_extra_big_endian.
13432         * Makefile.in: Rebuild.
13433         * configure: Likewise.
13434         * po/POTFILES.in: Likewise.
13435         * po/gold.pot: Likewise.
13436
13437 2008-04-14  Ian Lance Taylor  <iant@google.com>
13438
13439         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13440         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13441         in the name/type/flags to section mapping.  Don't call
13442         allocate_output_section.
13443         (Layout::choose_output_section): Change parameter from adjust_name
13444         to is_input_section.  Don't permit input sections after sections
13445         are attached to segments.  Don't call allocate_output_section.
13446         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13447         not write_enable_output_section.
13448         (Layout::make_output_section): Don't push to
13449         unattached_section_list_ nor call attach_to_segment.  Call
13450         attach_section_to_segment if sections are attached.
13451         (Layout::attach_sections_to_segments): New function.
13452         (Layout::attach_section_to_segment): New function.
13453         (Layout::attach_allocated_section_to_segment): Rename from
13454         attach_to_segment.  Remove flags parameter.
13455         (Layout::allocate_output_section): Remove function.
13456         (Layout::write_enable_output_section): Remove function.
13457         * layout.h (class Layout): Update for above changes.  Add new
13458         field sections_are_attached_.
13459         * output.h (Output_section::update_flags_for_input_section): New
13460         function.
13461         * output.cc (Output_section::add_input_section): Call
13462         update_flags_for_input_section.
13463         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13464
13465 2008-04-11  Cary Coutant  <ccoutant@google.com>
13466
13467         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13468         thought unnecessary.
13469         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13470
13471 2008-04-11  Ian Lance Taylor  <iant@google.com>
13472
13473         * output.h (class Output_section_data): Remove inline definition
13474         of set_addralign.
13475         * output.cc (Output_section_data::set_addralign): New function.
13476
13477 2008-04-11  Cary Coutant  <ccoutant@google.com>
13478
13479         Add support for TLS descriptors for i386 and x86_64.
13480         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13481         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13482         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13483         GOT_TYPE_TLS_DESC.
13484         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13485         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13486         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13487         relocations.
13488         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13489         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13490         Fix problem with initial-exec relocations.
13491         (Target_i386::Relocate::relocate_tls): Likewise.
13492         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13493         relaxation.
13494         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13495         support for section-plus-offset dynamic table entries.
13496         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13497         (Output_data_dynamic::Dynamic_entry): Add support for
13498         section-plus-offset dynamic table entries.
13499         (Output_data_dynamic::Classification): Likewise.
13500         (Output_data_dynamic::classification_): Renamed offset_.
13501         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13502         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13503         (Target_x86_64::make_plt_section): New function.
13504         (Target_x86_64::reserve_tlsdesc_entries): New function.
13505         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13506         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13507         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13508         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13509         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13510         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13511         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13512         add extra PLT entry for TLS descriptors.
13513         (Output_data_plt_x86_64::got_): New field.
13514         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13515         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13516         fields.
13517         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13518         descriptors.
13519         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13520         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13521         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13522         R_386_TLS_DESC_CALL relocations.
13523         (Target_x86_64::Scan::global): Likewise.
13524         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13525         for TLS descriptors.
13526         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13527         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13528         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13529         GD-to-IE relaxation.
13530         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13531         and TLS_DESCRIPTORS.
13532         * Makefile.in: Rebuild.
13533         * configure: Rebuild.
13534         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13535         (tls_test_shared2.so): New target.
13536         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13537         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13538         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13539         (tls_shared_gd_to_ie_test_LDADD): New variable.
13540         (tls_shared_gnu2_gd_to_ie_test): New target.
13541         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13542         New targets.
13543         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13544         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13545         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13546         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13547         (tls_shared_gnu2_test): New target.
13548         (tls_test_gnu2_shared.so): New target.
13549         (tls_shared_gnu2_test_SOURCES): New variable.
13550         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13551         (tls_shared_gnu2_test_LDFLAGS): New variable.
13552         (tls_shared_gnu2_test_LDADD): New variable.
13553         * testsuite/Makefile.in: Rebuild.
13554         * testsuite/Makefile.
13555
13556 2008-04-11  Ian Lance Taylor  <iant@google.com>
13557
13558         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13559         justsyms.t.
13560         * testsuite/Makefile.in: Rebuild.
13561
13562         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13563         long.
13564         * testsuite/script_test_2.cc (main): Adjust test.
13565
13566 2008-04-11  David S. Miller  <davem@davemloft.net>
13567             Ian Lance Taylor  <iant@google.com>
13568
13569         * options.h (General_options): Add entries for '-Y' and
13570         '-relax'.
13571         * options.cc (General_options:finalize): If -Y was used, add those
13572         entries to the library path instead of the default "/lib" and
13573         "/usr/lib".
13574
13575 2008-04-11  David S. Miller  <davem@davemloft.net>
13576
13577         * testsuite/justsyms.t: Start at 0x100.
13578         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13579         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13580         long.
13581         * testsuite/script_test_2.cc: Adjust string and section length
13582         checks.
13583
13584 2008-04-09  Ian Lance Taylor  <iant@google.com>
13585
13586         PR gold/5996
13587         * script-sections.cc (Sections_element::allocate_to_segment): Add
13588         orphan parameter.
13589         (Output_section_definition::allocate_to_segment): Likewise.
13590         (Orphan_output_section::allocate_to_segment): Likewise.
13591         (Script_sections::attach_sections_using_phdrs_clause): Don't
13592         propagate non-PT_LOAD segments to orphan sections.
13593         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13594         readelf rather than objdump.
13595         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13596         .interp section and PT_INTERP segment are the same size.
13597         * testsuite/Makefile.in: Rebuild.
13598
13599         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13600         aliases for symbols defined in the same object.
13601         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13602         (weak_alias_test_SOURCES): New variable.
13603         (weak_alias_test_DEPENDENCIES): New variable.
13604         (weak_alias_test_LDFLAGS): New variable.
13605         (weak_alias_test_LDADD): New variable.
13606         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13607         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13608         (weak_alias_test_3.o): New target.
13609         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13610         * testsuite/weak_alias_test_main.cc: New file.
13611         * testsuite/weak_alias_test_1.cc: New file.
13612         * testsuite/weak_alias_test_2.cc: New file.
13613         * testsuite/weak_alias_test_3.cc: New file.
13614
13615 2008-04-08  Ian Lance Taylor  <iant@google.com>
13616
13617         * options.h (class General_options): Add --noinhibit-exec option.
13618         * main.cc (main): Check --noinhibit-exec.
13619
13620         * options.h (class General_options): Define --wrap as a special
13621         option.  Add wrap_symbols_ field.
13622         (General_options::any_wrap_symbols): New function.
13623         (General_options::is_wrap_symbol): New function.
13624         * options.cc (General_options::parse_wrap): New function.
13625         (General_options::General_options): Initialize wrap_symbols_.
13626         * symtab.cc (Symbol_table::wrap_symbol): New function.
13627         (Symbol_table::add_from_object): Handle --wrap.
13628         * symtab.h (class Symbol_table): Declare wrap_symbol.
13629         * target.h (Target::wrap_char): New function.
13630         (Target::Target_info): Add wrap_char field.
13631         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13632         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13633         * testsuite/testfile.cc (Target_test::test_target_info):
13634         Likewise.
13635
13636         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13637         there is one.
13638
13639         * layout.h (class Layout): Add added_eh_frame_data_ field.
13640         * layout.cc (Layout::Layout): Initialize new field.
13641         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13642         output section until we find a section we merged successfully.
13643         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13644         that the size be non-zero.
13645
13646         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13647         qualifier.
13648
13649 2008-04-08  Craig Silverstein  <csilvers@google.com>
13650
13651         * configure.ac: Export new conditional variable HAVE_ZLIB.
13652         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13653         on HAVE_ZLIB.
13654         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13655         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13656
13657 2008-04-07  Ian Lance Taylor  <iant@google.com>
13658
13659         * version.cc (version_string): Set to "1.5".
13660
13661         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13662         Add issued_non_pic_error_ field.  Declare check_non_pic.
13663         (Target_x86_64::Scan::check_non_pic): New function.
13664         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13665         (Target_x86_64::Scan::global): Likewise.
13666
13667         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13668         addend parameter.  Change caller.  Handle merge sections.
13669         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13670         Address to Addend.  Don't add in the result of
13671         local_section_offset, pass down the addend and use the returned
13672         value.
13673         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13674         Update declarations of local_section_offset and symbol_value.
13675         * testsuite/two_file_test_1.cc (t18): New function.
13676         * testsuite/two_file_test_2.cc (f18): New function.
13677         * testsuite/two_file_test_main.cc (main): Call t18.
13678         * testsuite/two_file_test.h (t18, f18): Declare.
13679
13680         * configure.ac: Don't test for objdump, c++filt, or readelf.
13681         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13682         conditionals.
13683         (TEST_READELF): New variable.
13684         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13685         (check_PROGRAMS): Add two_file_strip_test.
13686         (two_file_strip_test): New target.
13687         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13688         (two_file_same_shared_strip_test_SOURCES): New variable.
13689         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13690         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13691         (two_file_same_shared_strip_test_LDADD): New variable.
13692         (two_file_shared_strip.so): New target.
13693         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13694         (ver_test_5.syms, ver_test_7.syms): Likewise.
13695         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13696         (strip_test_3.stdout): Use TEST_OBJDUMP.
13697         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13698
13699 2008-04-04  Cary Coutant  <ccoutant@google.com>
13700
13701         * symtab.h (Symbol::is_weak_undefined): New function.
13702         (Symbol::is_strong_undefined): New function.
13703         (Symbol::is_absolute): New function.
13704         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13705         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13706         absolute symbols.
13707         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13708         (weak_undef_test): New target.
13709         * testsuite/Makefile.in: Rebuild.
13710         * testsuite/weak_undef_file1.cc: New file.
13711         * testsuite/weak_undef_file2.cc: New file.
13712         * testsuite/weak_undef_test.cc: New file.
13713
13714 2008-04-03  Craig Silverstein  <csilvers@google.com>
13715
13716         * compressed_output.h (class Output_compressed_section): Use
13717         unsigned buffer.
13718         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13719         add zlib header.
13720         (zlib_compressed_suffix): Removed.
13721         (Output_compressed_section::set_final_data_size): Use unsigned
13722         buffers.
13723         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13724         Fix linker invocation.
13725         (flagstest_o_specialfile_and_compress_debug_sections):
13726         Likewise.
13727         * testsuite/Makefile.in: Regenerated.
13728
13729 2008-04-02  David S. Miller  <davem@davemloft.net>
13730
13731         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13732         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13733
13734 2008-04-02  Craig Silverstein  <csilvers@google.com>
13735
13736         * TODO: New file.
13737
13738 2008-04-02  Ian Lance Taylor  <iant@google.com>
13739
13740         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13741         parameters.  Update for new key type to views_.  Change all
13742         callers.
13743         (File_read::read): Adjust for byteshift in returned view.
13744         (File_read::add_view): New function, broken out of
13745         find_and_make_view.
13746         (File_read::make_view): New function, broken out of
13747         find_and_make_view.
13748         (File_read::find_or_make_view): Add offset and aligned
13749         parameters.  Rewrite accordingly.  Change all callers.
13750         (File_read::get_view): Add offset and aligned parameters.  Adjust
13751         for byteshift in return value.
13752         (File_read::get_lasting_view): Likewise.
13753         * fileread.h (class File_read): Update declarations.
13754         (class File_read::View): Add byteshift_ field.  Add byteshift to
13755         constructor.  Add byteshift method.
13756         * archive.h (Archive::clear_uncached_views): New function.
13757         (Archive::get_view): Add aligned parameter.  Change all callers.
13758         * object.h (Object::get_view): Add aligned parameter.  Change all
13759         callers.
13760         (Object::get_lasting_view): Likewise.
13761
13762         * fileread.cc (File_read::release): Don't call clear_views if
13763         there are multiple objects.
13764         * fileread.h (File_read::clear_uncached_views): New function.
13765         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13766         on the archive.
13767
13768 2008-03-31  Cary Coutant  <ccoutant@google.com>
13769
13770         Add thin archive support.
13771         * archive.cc (Archive::armagt): New const.
13772         (Archive::setup): Remove task parameter and calls to unlock.
13773         (Archive::unlock_nested_archives): New function.
13774         (Archive::read_header): Add nested_off parameter. Change
13775         all callers.
13776         (Archive::interpret_header): Likewise.
13777         (Archive::include_all_members): Change to handle thin
13778         archives.
13779         (Archive::include_member): Likewise.
13780         * archive.h (Archive::Archive): Add new parameters and
13781         initializers.
13782         (Archive::armagt): New const.
13783         (Archive::setup): Remove task parameter.
13784         (Archive::unlock_nested_archives): New function.
13785         (Archive::read_header): Add nested_off parameter.
13786         (Archive::interpret_header): Likewise.
13787         (Archive::Nested_archive_table): New typedef.
13788         (Archive::is_thin_archive_): New field.
13789         (Archive::nested_archives_): New field.
13790         (Archive::options_): New field.
13791         (Archive::dirpath_): New field.
13792         (Archive::task_): New field.
13793         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13794         for thin archives.  Pass additional parameters to
13795         Archive::Archive.  Unlock the archive file after calling
13796         Archive::setup.
13797
13798 2008-03-29  Ian Lance Taylor  <iant@google.com>
13799
13800         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13801         version symbol to be local.
13802         * testsuite/ver_test_4.sh: New file.
13803         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13804         (check_DATA): Add ver_test_4.syms.
13805         (ver_test_4.syms): New target.
13806         * testsuite/Makefile.in: Rebuild.
13807
13808         * output.cc
13809         (Output_section::Input_section_sort_entry::has_priority): New
13810         function.
13811         (Output_section::Input_section_sort_entry::match_file_name): New
13812         function.
13813         (Output_section::Input_section_sort_entry::match_section_name):
13814         Remove.
13815         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13816         Remove.
13817         (Output_section::Input_section_sort_entry::match_section_file):
13818         Remove.
13819         (Output_section::Input_section_sort_compare::operator()): Rewrite
13820         using new Input_section_sort_entry functions.  Sort crtbegin and
13821         crtend first.  Sort sections with no priority before sections with
13822         a priority.
13823         * testsuite/initpri1.c (d3): Check j != 4.
13824         (cd5): New constructor/destructor function.
13825         (main): Check j != 2.
13826
13827         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13828         new symbol when resolving, don't call set_is_default.
13829         * testsuite/ver_test_7.cc: New file.
13830         * testsuite/ver_test_7.sh: New file.
13831         * testsuite/Makefile.am (ver_test_7.so): New target.
13832         (ver_test_7.o): New target.
13833         (check_SCRIPTS): Add ver_test_7.sh.
13834         (check_DATA): Add ver_test_7.syms.
13835         (ver_test_7.syms): New target.
13836
13837 2008-03-28  Ian Lance Taylor  <iant@google.com>
13838
13839         * layout.cc (Layout::layout): If we see an input section with a
13840         name that needs sorting, set the must_sort flag for the output
13841         section.
13842         (Layout::make_output_section): If the name of the output section
13843         indicates that it might require sorting, set the may_sort flag.
13844         * output.h (Output_section::may_sort_attached_input_sections): New
13845         function.
13846         (Output_section::set_may_sort_attached_input_sections): New
13847         function.
13848         (Output_section::must_sort_attached_input_sections): New
13849         function.
13850         (Output_section::set_must_sort_attached_input_sections): New
13851         function.
13852         (class Output_section): Declare Input_section_sort_entry.  Define
13853         Input_section_sort_compare.  Declare
13854         sort_attached_input_sections.  Add new fields:
13855         may_sort_attached_input_sections_,
13856         must_sort_attached_input_sections_,
13857         attached_input_sections_are_sorted_.
13858         * output.cc (Output_section::Output_section): Initialize new
13859         fields.
13860         (Output_section::add_input_section): Add an entry to
13861         input_sections_ if may_sort or must_sort are true.
13862         (Output_section::set_final_data_size): Call
13863         sort_attached_input_sections if necessary.
13864         (Output_section::Input_section_sort_entry): Define new class.
13865         (Output_section::Input_section_sort_compare::operator()): New
13866         function.
13867         (Output_section::sort_attached_input_sections): New function.
13868         * configure.ac: Check whether the compiler supports constructor
13869         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13870         * testsuite/initpri1.c: New file.
13871         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13872         CONSTRUCTOR_PRIORITY.
13873         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13874         (initpri1_LDFLAGS): New variable.
13875         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13876
13877 2008-03-27  Ian Lance Taylor  <iant@google.com>
13878
13879         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13880         * testsuite/common_test_1.c: New file.
13881         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13882         (common_test_1_SOURCES): New variable.
13883         (common_test_1_DEPENDENCIES): New variable.
13884         (common_test_1_LDFLAGS): New variable.
13885
13886         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13887         and commons_ correctly when NAME/VERSION does not override
13888         NAME/NULL.
13889         * testsuite/ver_test_6.c: New file.
13890         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13891         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13892         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13893
13894 2008-03-26  Ian Lance Taylor  <iant@google.com>
13895
13896         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13897         of an undefined symbol from a version script.
13898         * testsuite/Makefile.am (ver_test_5.so): New target.
13899         (ver_test_5.o): New target.
13900         (check_SCRIPTS): Add ver_test_5.sh.
13901         (check_DATA): Add ver_test_5.syms.
13902         (ver_test_5.syms): New target.
13903         * testsuite/ver_test_5.cc: New file.
13904         * testsuite/ver_test_5.script: New file.
13905         * testsuite/ver_test_5.sh: New file.
13906         * Makefile.in, testsuite/Makefile.in: Rebuild.
13907
13908         PR gold/5986
13909         Fix problems building gold with gcc 4.3.0.
13910         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13911         (gold_error_at_location, gold_warning_at_location): Use it.
13912         * configure.ac: Check whether we can compile and use a template
13913         function with a printf attribute.
13914         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13915         when jumping over bytes.
13916         * object.cc: Instantiate Object::read_section_data.
13917         * debug.h: Include <cstring>
13918         * dwarf_reader.cc: Include <algorithm>
13919         * main.cc: Include <cstring>.
13920         * options.cc: Include <cstring>.
13921         * output.cc: Include <cstring>.
13922         * script.cc: Include <cstring>.
13923         * script.h: Include <string>.
13924         * symtab.cc: Include <cstring> and <algorithm>.
13925         * target-select.cc: Include <cstring>.
13926         * version.cc: Include <string>.
13927         * testsuite/testmain.cc: Include <cstdlib>.
13928         * configure, config.in: Rebuild.
13929
13930 2008-03-25  Ian Lance Taylor  <iant@google.com>
13931
13932         * options.cc: Include "../bfd/bfdver.h".
13933         (options::help): Print bug reporting address.
13934
13935         * version.cc (print_version): Adjust output for current value of
13936         BFD_VERSION_STRING.
13937
13938         * NEWS: New file.
13939
13940         * options.cc (options::help): Print list of supported targets.
13941         * target-select.h: Include <vector>.
13942         (class Target_selector): Make machine_, size_, and is_big_endian_
13943         fields const.  Add bfd_name_ and instantiated_target_ fields.
13944         (Target_selector::Target_selector): Add bfd_name parameter.
13945         (Target_selector::recognize): Make non-virtual, call
13946         do_recognize.
13947         (Target_selector::recognize_by_name): Make non-virtual, call
13948         do_recognize_by_name.
13949         (Target_selector::supported_names): New function.
13950         (Target_selector::bfd_name): New function.
13951         (Target_selector::do_instantiate_target): New pure virtual
13952         function.
13953         (Target_selector::do_recognize): New virtual function.
13954         (Target_selector::do_recognize_by_name): New virtual function.
13955         (Target_selector::instantiate_target): New private function.
13956         (supported_target_names): Declare.
13957         * target-select.cc (Target_selector::Target_selector): Update for
13958         new parameter and fields.
13959         (select_target_by_name): Check that the name matches before
13960         calling recognize_by_name.
13961         (supported_target_names): New function.
13962         * i386.cc (class Target_selector_i386): Update Target_selector
13963         constructor call.  Remove recognize and recognize_by_name.  Add
13964         do_instantiate_target.
13965         * x86_64.cc (class Target_selector_x86_64): Likewise.
13966         * testsuite/testfile.cc (class Target_selector_test): Update for
13967         changes to Target_selector.
13968
13969         * README: Rewrite, with some notes on unsupported features.
13970
13971 2008-03-24  Cary Coutant  <ccoutant@google.com>
13972
13973         * i386.cc (Target_i386::Got_type): New enum declaration.
13974         (Target_i386::Scan::local): Updated callers of Output_data_got
13975         member functions.
13976         (Target_i386::Scan::global): Likewise.
13977         (Target_i386::Relocate::relocate): Likewise.
13978         (Target_i386::Relocate::relocate_tls): Likewise.
13979         * object.h (Got_offset_list): New class.
13980         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13981         (Sized_relobj::local_got_offset): Likewise.
13982         (Sized_relobj::set_local_got_offset): Likewise.
13983         (Sized_relobj::local_has_tls_got_offset): Removed.
13984         (Sized_relobj::local_tls_got_offset): Removed.
13985         (Sized_relobj::set_local_tls_got_offset): Removed.
13986         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13987         * output.cc (Output_data_got::add_global): Added got_type parameter.
13988         (Output_data_got::add_global_with_rel): Likewise.
13989         (Output_data_got::add_global_with_rela): Likewise.
13990         (Output_data_got::add_global_pair_with_rel): New function.
13991         (Output_data_got::add_global_pair_with_rela): New function.
13992         (Output_data_got::add_local): Added got_type parameter.
13993         (Output_data_got::add_local_with_rel): Likewise.
13994         (Output_data_got::add_local_with_rela): Likewise.
13995         (Output_data_got::add_local_pair_with_rel): New function.
13996         (Output_data_got::add_local_pair_with_rela): New function.
13997         (Output_data_got::add_global_tls): Removed.
13998         (Output_data_got::add_global_tls_with_rel): Removed.
13999         (Output_data_got::add_global_tls_with_rela): Removed.
14000         (Output_data_got::add_local_tls): Removed.
14001         (Output_data_got::add_local_tls_with_rel): Removed.
14002         (Output_data_got::add_local_tls_with_rela): Removed.
14003         * output.h (Output_data_got::add_global): Added got_type parameter.
14004         (Output_data_got::add_global_with_rel): Likewise.
14005         (Output_data_got::add_global_with_rela): Likewise.
14006         (Output_data_got::add_global_pair_with_rel): New function.
14007         (Output_data_got::add_global_pair_with_rela): New function.
14008         (Output_data_got::add_local): Added got_type parameter.
14009         (Output_data_got::add_local_with_rel): Likewise.
14010         (Output_data_got::add_local_with_rela): Likewise.
14011         (Output_data_got::add_local_pair_with_rel): New function.
14012         (Output_data_got::add_local_pair_with_rela): New function.
14013         (Output_data_got::add_global_tls): Removed.
14014         (Output_data_got::add_global_tls_with_rel): Removed.
14015         (Output_data_got::add_global_tls_with_rela): Removed.
14016         (Output_data_got::add_local_tls): Removed.
14017         (Output_data_got::add_local_tls_with_rel): Removed.
14018         (Output_data_got::add_local_tls_with_rela): Removed.
14019         * resolve.cc (Symbol::override_base_with_special): Removed
14020         reference to has_got_offset_ field.
14021         * symtab.cc (Symbol::init_fields): Replaced initialization
14022         of got_offset_ with got_offsets_.  Removed initialization
14023         of has_got_offset_
14024         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14025         (Symbol::got_offset): Likewise.
14026         (Symbol::set_got_offset): Likewise.
14027         (Symbol::has_tls_got_offset): Removed.
14028         (Symbol::tls_got_offset): Removed.
14029         (Symbol::set_tls_got_offset): Removed.
14030         (Symbol::got_offset_): Removed.
14031         (Symbol::tls_mod_got_offset_): Removed.
14032         (Symbol::tls_pair_got_offset_): Removed.
14033         (Symbol::got_offsets_): New field.
14034         (Symbol::has_got_offset): Removed.
14035         (Symbol::has_tls_mod_got_offset): Removed.
14036         (Symbol::has_tls_pair_got_offset): Removed.
14037         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14038         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14039         member functions.
14040         (Target_x86_64::Scan::global): Likewise.
14041         (Target_x86_64::Relocate::relocate): Likewise.
14042         (Target_x86_64::Relocate::relocate_tls): Likewise.
14043
14044 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14045
14046         * yyscript.y: Fix spelling error in comment.
14047
14048 2008-03-24  Ian Lance Taylor  <iant@google.com>
14049
14050         * options.h (class General_options): Define build_id option.
14051         * layout.h (class Layout): Declare write_build_id, create_note,
14052         create_build_id.  Add build_id_note_ member.
14053         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14054         "libiberty.h", "md5.h", "sha1.h".
14055         (Layout::Layout): Initialize eh_frame_data_,
14056         eh_frame_hdr_section_, and build_id_note_.
14057         (Layout::finalize): Call create_build_id.
14058         (Layout::create_note): New function, broken out of
14059         Layout::create_gold_note.
14060         (Layout::create_gold_note): Call create_note.
14061         (Layout::create_build_id): New function.
14062         (Layout::write_build_id): New function.
14063         (Close_task_runner::run): Call write_build_id.
14064
14065         * x86_64.cc: Correct license to GPLv3.
14066
14067 2008-03-23  Ian Lance Taylor  <iant@google.com>
14068
14069         * options.cc: Include "demangle.h".
14070         (parse_optional_string): New function.
14071         (parse_long_option): Handle takes_optional_argument.
14072         (parse_short_option): Update dash_z initializer.  Handle
14073         takes_optional_argument.
14074         (General_options::General_options): Initialize do_demangle_.
14075         (General_options::finalize): Set do_demangle_.  Handle demangling
14076         style.
14077         * options.h (parse_optional_string): Declare.
14078         (struct One_option): Add optional_arg field.  Update constructor.
14079         Update call constructor calls.  Add takes_optional_argument
14080         function.
14081         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14082         (DEFINE_optional_string): Define.
14083         (General_options::demangle): Change from DEFINE_bool to
14084         DEFINE_optional_string.
14085         (General_options::no_demangle): New function.
14086         (General_options::do_demangle): New function.
14087         (General_options::set_do_demangle): New function.
14088         (General_options::execstack_status_): Move definition to end of
14089         class definition.
14090         (General_options::static_): Likewise.
14091         (General_options::do_demangle_): New field.
14092         * object.cc (big_endian>::get_symbol_location_info): Call
14093         Options::do_demangle, not Options::demangle.
14094         * symtab.cc (demangle): Likewise.
14095
14096 2008-03-22  Ian Lance Taylor  <iant@google.com>
14097
14098         * gold.h: Include <cstddef> and <sys/types.h>
14099         * options.h: Include <cstring>.
14100
14101 2008-03-21  Ian Lance Taylor  <iant@google.com>
14102
14103         * Added source code to GNU binutils.