gold/
[external/binutils.git] / gold / ChangeLog
1 2012-10-23  Cary Coutant  <ccoutant@google.com>
2
3         * dwp.h: New header file.
4         * dwp.cc: New source file.
5         * gold.h: Move shared declarations to system.h.
6         * system.h: New header file.
7         * Makefile.am: Add dwp.
8         * Makefile.in: Regenerate.
9
10 2012-10-23  Cary Coutant  <ccoutant@google.com>
11
12         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
13         Dwarf_info_reader::read_from_pointer.
14         (Dwarf_pubnames_table::read_header): Likewise.
15         (Dwarf_pubnames_table::next_name): Likewise.
16         (Dwarf_die::read_attributes): Likewise.
17         (Dwarf_die::skip_attributes): Likewise.
18         (Dwarf_info_reader::read_from_pointer): New function template.
19         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
20         (Dwarf_pubnames_table): Likewise.
21         (Dwarf_info_reader::read_from_pointer): New function template.
22         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
23         Dwarf_pubnames_table ctor.
24
25 2012-10-23  Cary Coutant  <ccoutant@google.com>
26
27         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
28         abbrev_shndx.
29         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
30         abbrev_shndx_.
31         (Dwarf_info_reader::set_abbrev_shndx): New method.
32         (Dwarf_info_reader::abbrev_shndx_): New data member.
33
34 2012-10-23  Cary Coutant  <ccoutant@google.com>
35
36         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
37         from object, not parameters.
38         (Dwarf_info_reader::parse): Likewise.
39         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
40         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
41         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
42         methods.
43
44 2012-10-23  Cary Coutant  <ccoutant@google.com>
45
46         * fileread.cc (Input_file::Input_file): New constructor.
47         * fileread.h (class Input_file): Add new constructor.
48
49 2012-10-18  Alan Modra  <amodra@gmail.com>
50
51         PR gold/14727
52         * object.cc (Relobj::is_section_name_included): Also match
53         .sdata personality section.
54
55 2012-10-18  Alan Modra  <amodra@gmail.com>
56
57         * target-reloc.h (class Default_comdat_behavior): New, package up..
58         (get_comdat_behaviour): ..this.
59         (relocate_section): Add Relocate_comdat_behavior template arg,
60         adjust code to suit.
61         * arm.cc (Target_arm::relocate_section): Adjust to suit.
62         (Target_arm::scan_reloc_section): Likewise.
63         * i386.cc (Target_i386::relocate_section): Likewise.
64         * sparc.cc (Target_sparc::relocate_section): Likewise.
65         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
66         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
67         * powerpc.cc (class Relocate_comdat_behavior): New.
68         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
69         gold::relocate_section with new template arg.
70
71 2012-10-18  Alan Modra  <amodra@gmail.com>
72
73         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
74         dynamic relocs for GOT_TPREL got entries, without symbol if
75         resolving locally.
76         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
77         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
78         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
79
80 2012-10-17  Alan Modra  <amodra@gmail.com>
81
82         PR gold/14726
83         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
84
85 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
86
87         * layout.cc (Layout::include_section): Keep sections marked
88         SHF_EXCLUDE when doing relocatable links.
89
90 2012-10-16  Alan Modra  <amodra@gmail.com>
91
92         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
93         (Target_powerpc::do_finalize_sections): Call it.
94         (Output_data_save_res): New class and supporting functions.
95         (Target_powerpc::symval_for_branch): Only look up .opd entry for
96         normal symbols defined in object files.
97
98 2012-10-12  Alan Modra  <amodra@gmail.com>
99
100         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
101         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
102         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
103         section if scan_opd_relocs not yet called.
104         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
105
106 2012-10-12  Alan Modra  <amodra@gmail.com>
107
108         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
109         add_local_ifunc_entry): Revert last change.
110         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
111
112 2012-10-05  Alan Modra  <amodra@gmail.com>
113
114         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
115         do_plt_address_for_global): New functions.
116         (Output_data_got_powerpc::do_write): Don't segfault when linking
117         statically.
118         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
119         add_local_ifunc_entry): Return true on adding entry..
120         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
121         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
122         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
123         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
124         set up symbols here.
125         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
126         syms here.  Do so even when no .iplt.  Don't segfault when linking
127         statically.
128         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
129         new variants without reloc param.
130         (Glink_sym_ent::Glink_sym_ent): Likewise.
131         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
132         reloc when refs will resolve to plt call stub.
133         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
134         R_PPC_PLTREL24 to resolve locally.
135         (Target_powerpc::Scan::global): Correct ifunc handling.
136         (Target_powerpc::Relocate::relocate): Correct local sym glink
137         lookup.  Don't destroy "value" when we have a plt call stub,
138         and when checking plt call validity.
139         (Target_powerpc::do_dynsym_value): Simplify.
140
141 2012-10-05  Alan Modra  <amodra@gmail.com>
142
143         * i386.cc (Output_data_plt_i386::address_for_global,
144         address_for_local): Add plt offset to returned value.  Adjust uses.
145         * sparc.cc (Output_data_plt_sparc::address_for_global,
146         address_for_local): Likewise.
147         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
148         address_for_local): Likewise.
149         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
150         address_for_local): Likewise.
151         * target.h (Target::plt_address_for_global, plt_address_for_local):
152         Update comment.
153         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
154         (Output_data_got::Got_entry::write): Nor here.
155         * output.h: Comment fix.
156
157 2012-10-02  Jiong Wang  <jiwang@tilera.com>
158
159         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
160         global_offset_table_ value for larget got.
161         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
162
163 2012-09-29  Alan Modra  <amodra@gmail.com>
164
165         * powerpc.cc (Target_powerpc::iplt_): New output section.
166         (Target_powerpc::iplt_section, make_iplt_section,
167         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
168         (Target_powerpc::make_plt_entry): Handle ifunc syms.
169         Target_powerpc::plt_entry_count): Count iplt entries too.
170         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
171         reloc section in constructor.  New params.
172         (Target_powerpc::make_plt_section): Create reloc section here instead.
173         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
174         functions.
175         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
176         (Output_data_glink::add_entry, find_entry): New functions to
177         deal with local syms.
178         (Glink_sym_ent): Add support for local syms.
179         (Output_data_glink::do_write): Handle ifunc plt entries.
180         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
181         (Target_powerpc::Scan::local, global): Handle ifunc syms.
182         (Target_powerpc::Relocate::relocate): Likewise.
183         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
184
185 2012-09-25  Alan Modra  <amodra@gmail.com>
186
187         * object.h (Sized_relobj_file::adjust_local_symbol,
188         do_adjust_local_symbol): New functions.
189         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
190         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
191         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
192         and irregular opd entry spacing.
193         (Powerpc_relobj::do_read_relocs): Add opd size checks.
194         (Global_symbol_visitor_opd): New functor.
195         (Target_powerpc::do_finalize_sections): Omit global symbols defined
196         on deleted opd entries.
197
198 2012-09-15  Jiong Wang  <jiwang@tilera.com>
199
200         * tilegx.cc: New file.
201         * Makefile.am (TARGETSOURCES): Add tilegx.cc
202         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
203         * configure.tgt: Add entries for tilegx*.
204         * configure.ac: Likewise.
205         * Makefile.in: Rebuild.
206         * configure: Likewise.
207         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
208         tilegx.
209
210 2012-09-13  Alan Modra  <amodra@gmail.com>
211
212         * target-reloc.h (scan_relocs): Call scan.local for relocs
213         against symbols in discarded sections.  Pass is_discarded
214         param.
215         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
216         Add is_discarded param.
217         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
218         is_discarded to flag opd entry as discarded.  Don't emit dyn
219         relocs on such entries.
220         (Target_powerpc::Scan::global): Similarly detect and handle
221         such opd entries.
222         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
223         opd_ent_.  Update all uses.
224         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
225         (Target_powerpc::relocate_section): Zero out discarded opd
226         entry relocs.
227
228 2012-09-12  Ian Lance Taylor  <iant@google.com>
229
230         PR gold/14570
231         * output.cc: Rename Output_data_got template parameter from size
232         to got_size for all functions.  Compile all variants of
233         Output_data_got.
234         (Output_data_got::Got_entry::write): Correct use of size for
235         symbol value.  Use local_is_tls rather than casting to
236         Sized_relobj_file.
237         * object.h (class Object): Add local_is_tls and do_local_is_tls.
238         (class Sized_relobj_file): Add do_local_is_tls.
239         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
240
241 2012-09-11  Alan Modra  <amodra@gmail.com>
242
243         PR gold/14566
244         * layout.cc (Layout::set_segment_offsets): When using
245         common-page-size alignment, ensure we are on a new max-page-size
246         page.
247         * output.cc (Output_segment::set_section_addresses): Use
248         abi_pagesize, not common_pagesize for relro boundary.
249         (Output_segment::set_offset): Likewise.
250
251 2012-09-11  Alan Modra  <amodra@gmail.com>
252
253         * output.h (Output_data_got::add_global_tls, add_local_tls,
254         add_local_tls_pair): New functions.
255         (Output_data_got::add_local_pair_with_rel): Remove second
256         reloc param.  Expand comment.
257         (Output_data_got::Got_entry): Rename use_plt_offset_ to
258         use_plt_or_tls_offset_, similarly for constructor param.
259         (Output_data_got::Got_entry::write): Add got_index param.
260         * output.cc (Output_data_got::add_global_tls, add_local_tls,
261         add_local_tls_pair): New functions.
262         (Output_data_got::Got_entry::write): Handle tls symbols
263         with use_plt_or_tls_offset_ set specially.
264         (Output_data_got::add_local_pair_with_rel): Only one reloc.
265         (Output_data_got::do_write): Replace iterator with index, pass
266         index to entry write function.
267         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
268         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
269         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
270         call.
271         * i386.cc (Target_i386::Scan::local): Likewise.
272         * sparc.cc (Target_sparc::Scan::local): Likewise.
273         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
274         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
275         do_tls_offset_for_global): New functions.
276         (Target_powerpc::Scan::local): Correct TLS relocations and got
277         entry values.
278         (Target_powerpc::Scan::global): Don't emit unnecessary
279         dynamic relocations on TLS GOT entries.
280
281 2012-09-10  Matthias Klose  <doko@ubuntu.com>
282
283         * config.in: Disable sanity check for kfreebsd.
284
285 2012-09-10  Sterling Augustine  <saugustine@google.com>
286
287         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
288         (Gdb_index::pubtypes_read): New parameter.
289         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
290         to calls.
291         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
292         pubtypes_object_.
293
294 2012-09-09  Alan Modra  <amodra@gmail.com>
295
296         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
297         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
298         * gc.h (gc_process_relocs): Call target gc_add_reference.
299         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
300         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
301         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
302         unnecessary cast.
303         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
304         to cater for when we don't need code offset.  Update use.
305         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
306         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
307         set_opd_valid): New functions.
308         (Target_powerpc::do_gc_add_reference): New function.
309         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
310         stashed refs.
311         (Target_powerpc::do_gc_mark_symbol): New function.
312
313 2012-09-06  Cary Coutant  <ccoutant@google.com>
314
315         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
316         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
317         (Dwarf_die::skip_attributes): Likewise.
318         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
319         * testsuite/gdb_index_test.cc (inline_func_1): New function.
320         (main): Call it.
321         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
322
323 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
324
325         * testsuite/script_test_3.t: Add .got.plt output section
326         statement.
327         * testsuite/script_test_4.t: Likewise.
328
329 2012-09-05  Alan Modra  <amodra@gmail.com>
330
331         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
332         update all uses and lose "enum" when using type.
333
334 2012-09-05  Alan Modra  <amodra@gmail.com>
335
336         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
337         * configure: Regenerate.
338         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
339         (plugin_final_layout.stdout): Likewise.
340         (memory_test): Set page sizes to 0x1000.
341         * testsuite/Makefile.in: Regenerate.
342         * testsuite/discard_locals_test.sh: Add FIXME comment.
343         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
344         * testsuite/pr14265.t: Add .got output section statement.
345         * testsuite/script_test_2.t: Likewise.
346         * testsuite/script_test_3.t: Likewise.
347         * testsuite/script_test_4.t: Likewise.
348         * testsuite/script_test_5.t: Likewise.
349         * testsuite/script_test_6.t: Likewise.
350         * testsuite/script_test_7.t: Likewise.
351         * testsuite/script_test_9.t: Likewise.
352
353 2012-09-05  Alan Modra  <amodra@gmail.com>
354
355         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
356         (Powerpc_relocate_functions::Status): New typedef.
357         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
358         (Target_powerpc::Scan::local): Handle REL64.
359         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
360         for REL32 and REL64.
361         (Target_powerpc::symval_for_branch): New function, extracted from..
362         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
363         checks.  Report overflow errors.
364
365 2012-09-05  Alan Modra  <amodra@gmail.com>
366
367         * object.h (Sized_relobj_file::emit_relocs): Delete.
368         (Sized_relobj_file::emit_relocs_reltype): Delete.
369         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
370         relocate_relocs for --emit-relocs.
371         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
372         * output.h: Update comment.
373         (Output_segment::first_section): New function.
374         (Output_segment::first_section_load_address): Use first_section.
375         * output.cc (Output_segment::first_section): New function extracted..
376         (Output_segment::first_section_load_address): ..from here.  Delete.
377         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
378         * target.h (Sized_target::relocate_for_relocatable): Likewise.
379         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
380         adjust call to target.h function.
381         * i386.cc (Target_i386): Likewise.
382         * sparc.cc (Target_sparc): Likewise.
383         * x86_64.cc (Target_x86_64): Likewise.
384         * powerpc.cc (Target_powerpc): Likewise.
385         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
386         first tls section has section symbol for optimised local dynamic
387         output relocs.
388         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
389         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
390         optimised tls code.
391         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
392         Rename to relocate_relocs.  Update error message.
393
394 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
395
396         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
397         --just-symbols.
398
399 2012-08-31  Alan Modra  <amodra@gmail.com>
400
401         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
402         (Powerpc_relobj::toc_base_offset): New stub function.
403         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
404         got_mod_index_offset to tlsld_got_offset.  Update all refs.
405         (Target_powerpc::Relocate::enum skip_tls): New.
406         (Target_powerpc::call_tls_get_addr_): New var.
407         (Target_powerpc::is_branch_reloc): Move to file scope.
408         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
409         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
410         New functions.
411         (Target_powerpc::enum Got_type): Delete old values, add new ones.
412         (powerpc_info): Correct common_pagesize for ppc64.
413         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
414         (Powerpc_relocate_functions): Add overflow check enums and functions.
415         Add non-shift version of rela, rela_ua.  Delete all rel public
416         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
417         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
418         addr16_ha3, addr14 functions.
419         (Output_data_got_powerpc::add_constant_pair): New function.
420         (Output_data_got_powerpc::got_base_offset): Likewise.
421         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
422         (instruction constants): Sort, add some more.
423         (Output_data_glink::do_write): Add and use Address typedef.  Use
424         object->toc_base_offset() stub for 64-bit.
425         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
426         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
427         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
428         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
429         Always treat .opd relocs as against locally defined symbol.
430         Correct condition for RELATIVE relocs.
431         (Target_powerpc::do_finalize_sections): Test for NULL sections.
432         (Target_powerpc::Relocate::relocate): Use plt call stub as value
433         for 32-bit syms with a plt entry.  Correct ppc64 toc base
434         calculations.  Handle TLS relocs, and more.  Add overflow
435         checking and adjust for Powerpc_relocate_functions changes.
436         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
437         Reinstate --emit-relocs code with FIXME.
438
439 2012-08-30  Alan Modra  <amodra@gmail.com>
440
441         * layout.cc (Layout::set_segment_offsets): Set p_align to
442         abi_pagesize, not common_pagesize.
443         (Layout::relaxation_loop_body): Similarly use abi_pagesize
444         to determine whether file header can go in segment.
445
446 2012-08-30  Alan Modra  <amodra@gmail.com>
447
448         * output.h (Output_reloc::Output_reloc <output section>): Add
449         is_relative param.  Adjust calls.
450         (Output_reloc::add_output_section_relative): New functions.
451         * output.cc (Output_reloc::Output_reloc <output section>): Handle
452         is_relative.
453         (Output_reloc::symbol_value): Handle SECTION_CODE.
454
455 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
456
457         * gold.cc (queue_middle_tasks): Call layout again when unique
458         segments for sections is desired.
459         * layout.cc (Layout::Layout): Initialize new members.
460         (Layout::get_output_section_flags): New function.
461         (Layout::choose_output_section): Call get_output_section_flags.
462         (Layout::layout): Make output section for mapping to a unique segment.
463         (Layout::insert_section_segment_map): New function.
464         (Layout::attach_allocated_section_to_segment): Make unique segment for
465         output sections marked so.
466         (Layout::segment_precedes): Check for unique segments when sorting.
467         * layout.h (Layout::Unique_segment_info): New struct.
468         (Layout::Section_segment_map): New typedef.
469         (Layout::insert_section_segment_map): New function.
470         (Layout::get_output_section_flags): New function.
471         (Layout::is_unique_segment_for_sections_specified): New function.
472         (Layout::set_unique_segment_for_sections_specified): New function.
473         (Layout::unique_segment_for_sections_specified_): New member.
474         (Layout::section_segment_map_): New member.
475         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
476         Rename is_gc_pass_one to is_pass_one.
477         Rename is_gc_pass_two to is_pass_two.
478         Rename is_gc_or_icf to is_two_pass.
479         Check for which pass based on whether symbols data is present.
480         Make it two pass when unique segments for sections is desired.
481         * output.cc (Output_section::Output_section): Initialize new
482         members.
483         * output.h (Output_section::is_unique_segment): New function.
484         (Output_section::set_is_unique_segment): New function.
485         (Output_section::is_unique_segment_): New member.
486         (Output_section::extra_segment_flags): New function.
487         (Output_section::set_extra_segment_flags): New function.
488         (Output_section::extra_segment_flags_): New member.
489         (Output_section::segment_alignment): New function.
490         (Output_section::set_segment_alignment): New function.
491         (Output_section::segment_alignment_): New member.
492         (Output_segment::Output_segment): Initialize is_unique_segment_.
493         (Output_segment::is_unique_segment): New function.
494         (Output_segment::set_is_unique_segment): New function.
495         (Output_segment::is_unique_segment_): New member.
496         * plugin.cc (allow_unique_segment_for_sections): New function.
497         (unique_segment_for_sections): New function.
498         (Plugin::load): Add new functions to transfer vector.
499         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
500         * Makefile.in: Regenerate.
501         * testsuite/plugin_final_layout.sh: Check if unique segment
502         functionality works.
503         * testsuite/plugin_section_order.c (onload): Check if new interfaces
504         are available.
505         (allow_unique_segment_for_sections): New global.
506         (unique_segment_for_sections): New global.
507         (claim_file_hook): Call allow_unique_segment_for_sections.
508         (all_symbols_read_hook): Call unique_segment_for_sections.
509
510 2012-08-22  Cary Coutant  <ccoutant@google.com>
511
512         * layout.cc (Layout::include_section): Don't assert on GROUP
513         sections with --emit-relocs.
514
515 2012-08-21  Cary Coutant  <ccoutant@google.com>
516
517         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
518         if --export-dynamic-symbol names an undef symbol.
519
520 2012-08-18  Alan Modra  <amodra@gmail.com>
521
522         * powerpc.cc: Formatting and white space.
523         (Powerpc_relobj): Rename got2_section_ to special_.
524         Add opd_ent_shndx_ and opd_ent_off_ vectors.
525         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
526         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
527         (Target_powerpc): Add Address typedef and invalid_address.  Use
528         throughout.
529         (Target_powerpc::is_branch_reloc): New function.
530         (Powerpc_relocate_functions): Add Address typedef, use throughout.
531         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
532         for dst_mask, value and addend.
533         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
534         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
535         (Output_data_glink::do_write): Correct toc base.  Don't try to use
536         uint16_t for 24-bit offset.  Use get_output_section_offset and
537         check return.
538         (Target_powerpc::Scan::local): Handle more relocs.
539         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
540         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
541         Plug in toc restoring insn after plt calls.  Translate branches
542         to function descriptor symbols to corresponding entry point.
543         (Target_powerpc::relocate_for_relocatable): Check return from
544         get_output_section_offset.
545         * symtab.h: Comment typo.
546
547 2012-08-14  Ian Lance Taylor  <iant@google.com>
548
549         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
550         unsupported_relocal_local to call unsupported_reloc_global.
551
552 2012-08-14  Nick Clifton  <nickc@redhat.com>
553
554         PR ld/14265
555         * script-sections.cc (Sections_element::output_section_name): Add
556         keep return parameter.
557         (Output_section_element::match_name): Add keep return parameter.
558         Return the value of the keep_ member.
559         * script-sections.h (class Output_section): Update
560         output_section_name prototype.
561         * layout.cc (Layout::keep_input_section): New public member
562         function.
563         (Layout::choose_output_section): Pass keep parameter to
564         output_section_name.
565         * layout.h (class Layout): Add keep_input_section.
566         * object.cc (Sized_relobj_file::do_layout): Check for kept input
567         sections.
568         * testsuite/Makefile.am: Add a test.
569         * testsuite/Makefile.in: Regenerate.
570         * testsuite/pr14265.c: Source file for the test.
571         * testsuite/pr14265.t: Linker script for the test.
572         * testsuite/pr14265.sh: Shell script for the test.
573
574 2012-08-14  Alan Modra  <amodra@gmail.com>
575
576         * target.h (Target::output_section_name): New function.
577         (Target::do_output_section_name): New function.
578         * layout.cc (Layout::choose_output_section): Call the above.
579         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
580
581 2012-08-14  Alan Modra  <amodra@gmail.com>
582
583         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
584         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
585         for replace_constant call.
586         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
587         (Output_data_glink::do_print_to_mapfile): New function.
588         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
589         (Target_powerpc::Relocate::relocate): Likewise.
590
591 2012-08-14  Alan Modra  <amodra@gmail.com>
592
593         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
594         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
595         (Output_data_glink::add_entry,find_entry): Remove shndx param.
596         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
597         all references to shndx_.  Handle special case for R_PPC_PLTREL24
598         here.
599         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
600         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
601         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
602         here.
603         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
604         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
605
606 2012-08-12  Alan Modra  <amodra@gmail.com>
607
608         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
609         (glink insn constants): Use uint32_t.
610         (Output_data_glink::add_entry): Use insert, not [] operator.
611
612 2012-08-11  Alan Modra  <amodra@gmail.com>
613
614         * object.h (Sized_relobj_file::find_shdr): New function.
615         (Sized_relobj_file::find_special_sections): New function.
616         * object.cc (Sized_relobj_file::find_shdr): New function.
617         (Sized_relobj_file::find_eh_frame): Use find_shdr.
618         (Sized_relobj_file::find_special_sections): New function, split out..
619         (Sized_relobj_file::do_read_symbols): ..from here.
620         * output.h (Output_data_got::replace_constant): New function.
621         (Output_data_got::num_entries): New function.
622         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
623         (Output_data_got::got_offset): Protected rather than private.
624         (Output_data_got::replace_got_entry): New function.
625         * output.cc (Output_data_got::replace_got_entry): New function.
626         * powerpc.cc (class Powerpc_relobj): New.
627         (class Powerpc_relocate_functions): Delete all psymval variants or
628         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
629         Implement _ha functions using corresponding _hi function.
630         (Powerpc_relobj::find_special_sections): New function.
631         (Target_powerpc::do_make_elf_object): New function.
632         (class Output_data_got_powerpc): New.
633         (class Output_data_glink): New.
634         (class Powerpc_scan_relocatable_reloc): New.
635         Many more changes througout file.
636
637 2012-08-09  Nick Clifton  <nickc@redhat.com>
638
639         * po/vi.po: Updated Vietnamese translation.
640
641 2012-08-07  Ian Lance Taylor  <iant@google.com>
642
643         * layout.cc (Layout::add_target_dynamic_tags): If
644         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
645         plt_rel.
646
647 2012-07-30  Nick Clifton  <nickc@redhat.com>
648
649         * po/gold.pot: Updated template.
650         * po/es.po: Updated Spanish translation.
651
652 2012-07-18  Cary Coutant  <ccoutant@google.com>
653
654         PR gold/14344
655         * configure.ac: Add check for -gpubnames support.
656         * configure: Regenerate.
657         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
658         support; force -gno-pubnames.
659         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
660         support.
661         (gdb_index_test_4): New test.
662         * testsuite/Makefile.in: Regenerate.
663         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
664         * testsuite/gdb_index_test_2.sh: Likewise.
665         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
666         * testsuite/gdb_index_test_4.sh: New script.
667         * testsuite/gdb_index_test_comm.sh: New script with common code;
668         don't look for space after colon.
669
670 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
671
672         * gold.cc (queue_middle_tasks): Update function order only after
673         deferred objects due to plugins are processed.
674
675 2012-07-11  Ian Lance Taylor  <iant@google.com>
676
677         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
678         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
679         (Target_arm::scan_reloc_for_stub): Likewise.
680         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
681         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
682         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
683         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
684         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
685
686 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
687             Ian Lance Taylor  <iant@google.com>
688
689         PR gold/14309
690         * configure.ac: Test whether std::tr1::hash<off_t> works.
691         * gold.h: Add a specialization for std::tr1::hash<off_t> if
692         needed.
693         * output.h (class Output_fill): Add virtual destructor.
694         * configure, config.in: Rebuild.
695
696 2012-06-22  Roland McGrath  <mcgrathr@google.com>
697
698         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
699
700 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
701
702         * plugin.cc (Plugin::load): Handle position independent executables.
703
704 2012-06-06  Cary Coutant  <ccoutant@google.com>
705
706         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
707         add .debug_macro.
708         (lines_only_debug_sections): Likewise.
709         (gdb_fast_lookup_sections): New static array.
710         (is_gdb_debug_section): Rename formal parameter.
711         (is_lines_only_debug_section): Likewise.
712         (is_gdb_fast_lookup_section): New function.
713         (Layout::include_section): Check for ".zdebug_" prefix; pass
714         section name suffix to is_gdb_debug_section, et al.; check for
715         fast-lookup sections when building .gdb_index.
716         * options.h (--strip-debug-gdb): Update GDB version number.
717
718 2012-06-06  Cary Coutant  <ccoutant@google.com>
719
720         * configure.ac: Add check for fallocate.
721         * configure: Regenerate.
722         * config.in: Regenerate.
723
724         * options.h (class General_options): Add --mmap-output-file and
725         --posix-fallocate options.
726         * output.cc: (posix_fallocate): Remove; replace with...
727         (gold_fallocate): New function.
728         (Output_file::map_no_anonymous): Call gold_fallocate.
729         (Output_file::map): Check --mmap-output-file option.
730
731 2012-06-05  Jing Yu  <jingyu@google.com>
732
733         * gold.h (textdomain): Add do {} to empty while(0).
734         (bindtextdomain): Likewise.
735
736 2012-06-04  Cary Coutant  <ccoutant@google.com>
737
738         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
739         has_dynsym_index.
740
741 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
742
743         * symtab.cc (Symbol_table::define_special_symbol):
744         Initialize *poldsym to prevent uninitialized variable errors.
745
746 2012-05-23  Cary Coutant  <ccoutant@google.com>
747
748         * layout.cc (Layout::section_name_mapping): Add rules to handle
749         exact match on .data.rel.ro.local or .data.rel.ro.
750         (Layout::output_section_name): Check for exact matches.
751
752 2012-05-23  Cary Coutant  <ccoutant@google.com>
753
754         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
755         more carefully.
756
757 2012-05-22  Cary Coutant  <ccoutant@google.com>
758
759         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
760         object before exporting symbol.
761
762 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
763
764         * testsuite/tls_test.cc: Include "config.h" first.
765         * testsuite/tls_test_c.c: Likewise.
766
767 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
768             Nick Clifton  <nickc@redhat.com>
769
770         PR 14072
771         * configure.in: Add check that sysdep.h has been included before
772         any system header files.
773         * configure: Regenerate.
774         * config.in: Regenerate.
775
776 2012-05-14  Cary Coutant  <ccoutant@google.com>
777
778         * layout.cc (Layout::make_output_section): Mark .tdata section
779         as RELRO.
780         * testsuite/relro_test.cc: Add a TLS variable.
781
782 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
783
784         PR gold/14091
785         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
786         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
787         R_X86_64_64.
788
789 2012-05-08  Cary Coutant  <ccoutant@google.com>
790
791         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
792         (lines_only_debug_sections): Likewise.
793
794 2012-05-02  Roland McGrath  <mcgrathr@google.com>
795
796         * nacl.cc: New file.
797         * nacl.h: New file.
798         * Makefile.am (CCFILES, HFILES): Add them.
799         * Makefile.in: Regenerate.
800         * i386.cc (Output_data_plt_i386_nacl): New class.
801         (Output_data_plt_i386_nacl_exec): New class.
802         (Output_data_plt_i386_nacl_dyn): New class.
803         (Target_i386_nacl): New class.
804         (Target_selector_i386_nacl): New class.
805         (target_selector_i386): Use it instead of Target_selector_i386.
806         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
807         (Target_x86_64_nacl): New class.
808         (Target_selector_x86_64_nacl): New class.
809         (target_selector_x86_64, target_selector_x32): Use it instead of
810         Target_selector_x86_64.
811         * arm.cc (Output_data_plt_arm_nacl): New class.
812         (Target_arm_nacl): New class.
813         (Target_selector_arm_nacl): New class.
814         (target_selector_arm, target_selector_armbe): Use it instead of
815         Target_selector_arm.
816
817         * target-select.cc (select_target): Take new Input_file* and off_t
818         arguments, pass them on to recognize method of selector.
819         * object.cc (make_elf_sized_object): Update caller.
820         * parameters.cc (parameters_force_valid_target): Likewise.
821         * incremental.cc (make_sized_incremental_binary): Likewise.
822         * target-select.h: Update decl.
823         (Target_selector::recognize): Take new Input_file* argument,
824         pass it on to do_recognize.
825         (Target_selector::do_recognize): Take new Input_file* argument.
826         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
827         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
828         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
829         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
830
831         * target.h (Target::Target_info): New members isolate_execinstr
832         and rosegment_gap.
833         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
834         * arm.cc (Target_arm::arm_info): Update initializer.
835         * i386.cc (Target_i386::i386_info): Likewise.
836         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
837         * sparc.cc (Target_sparc::sparc_info): Likewise.
838         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
839         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
840         * layout.cc (Layout::attach_allocated_section_to_segment):
841         Take new const Target* argument.  If target->isolate_execinstr(), act
842         like --rosegment.
843         (Layout::find_first_load_seg): Take new const Target* argument;
844         if target->isolate_execinstr(), reject PF_X segments.
845         (Layout::relaxation_loop_body): Update caller.
846         (Layout::set_segment_offsets): If target->isolate_execinstr(),
847         reset file offset to zero when we hit LOAD_SEG, and then do a second
848         loop over the segments before LOAD_SEG to reassign offsets after
849         addresses have been determined.  Handle target->rosegment_gap().
850         (Layout::attach_section_to_segment): Take new const Target* argument;
851         pass it to attach_allocated_section_to_segment.
852         (Layout::make_output_section): Update caller.
853         (Layout::attach_sections_to_segments): Take new const Target* argument;
854         pass it to attach_section_to_segment.
855         * gold.cc (queue_middle_tasks): Update caller.
856         * layout.h (Layout): Update method decls with new arguments.
857
858         * arm.cc (Target_arm::Target_arm): Take optional argument for the
859         Target_info pointer to use.
860         (Target_arm::do_make_data_plt): New virtual method.
861         (Target_arm::make_data_plt): New method that calls it.
862         (Target_arm::make_plt_entry): Use it.
863         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
864         for the section alignment.
865         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
866         method.
867         (Output_data_plt_arm::first_plt_entry_offset): Call it.
868         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
869         method.
870         (Output_data_plt_arm::get_plt_entry_size): Call it.
871         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
872         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
873         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
874         method.
875         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
876         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
877         method instead of sizeof(plt_entry).
878         (Output_data_plt_arm::add_entry): Likewise.
879         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
880         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
881         than static method.
882         (Target_arm::plt_entry_size): Likewise.
883         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
884         Move to ...
885         (Output_data_plt_arm_standard): ... here, new class.
886         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
887         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
888         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
889
890         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
891         Take additional argument for the PLT entry size.
892         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
893         Use get_plt_entry_size method rather than plt_entry_size variable.
894         (Output_data_plt_x86_64::reserve_slot): Likewise.
895         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
896         (Output_data_plt_x86_64::add_entry): Likewise.
897         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
898         (Output_data_plt_x86_64::address_for_global): Likewise.
899         (Output_data_plt_x86_64::address_for_local): Likewise.
900         (Output_data_plt_x86_64::set_final_data_size): Likewise.
901         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
902         Make method non-static.
903         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
904         method.
905         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
906         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
907         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
908         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
909         virtual method.
910         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
911         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
912         virtual method.
913         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
914         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
915         virtual method.
916         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
917         (Output_data_plt_x86_64::plt_entry_size)
918         (Output_data_plt_x86_64::first_plt_entry)
919         (Output_data_plt_x86_64::plt_entry)
920         (Output_data_plt_x86_64::tlsdesc_plt_entry)
921         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
922         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
923         (Output_data_plt_x86_64_standard): ... here, new class.
924         (Target_x86_64::Target_x86_64): Take optional argument for the
925         Target_info pointer to use.
926         (Target_x86_64::do_make_data_plt): New virtual method.
927         (Target_x86_64::make_data_plt): New method to call it.
928         (Target_x86_64::init_got_plt_for_update): Use that.
929         Call this->plt_->add_eh_frame method here.
930         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
931         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
932         rather than static method.
933         (Target_x86_64::plt_entry_size): Likewise.
934         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
935         rather than plt_entry_size variable.  Move guts of PLT filling to...
936         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
937         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
938         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
939
940         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
941         additional argument for the section alignment.
942         Don't do add_eh_frame_for_plt here.
943         (Output_data_plt_i386::first_plt_entry_offset): Make the method
944         non-static.  Use get_plt_entry_size method rather than plt_entry_size
945         variable.
946         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
947         method.
948         (Output_data_plt_i386::get_plt_entry_size): Call it.
949         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
950         (Output_data_plt_i386::add_eh_frame): New method to call it.
951         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
952         method.
953         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
954         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
955         method.
956         (Output_data_plt_i386::fill_plt_entry): New method to call it.
957         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
958         method instead of plt_entry_size.
959         (Output_data_plt_i386::plt_entry_size)
960         (Output_data_plt_i386::plt_eh_frame_fde_size)
961         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
962         (Output_data_plt_i386_standard): ... here, new class.
963         (Output_data_plt_i386_exec): New class.
964         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
965         (Output_data_plt_i386_exec::first_plt_entry): ... here.
966         (Output_data_plt_i386::exec_plt_entry): Move to ...
967         (Output_data_plt_i386_exec::plt_entry): ... here.
968         (Output_data_plt_i386_dyn): New class.
969         (Output_data_plt_i386::first_plt_entry): Move to ...
970         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
971         (Output_data_plt_i386::dyn_plt_entry): Move to ...
972         (Output_data_plt_i386_dyn::plt_entry): ... here.
973         (Target_i386::Target_i386): Take optional argument for the Target_info
974         pointer to use.
975         (Target_i386::do_make_data_plt): New virtual method.
976         (Target_i386::make_data_plt): New method to call it.
977         (Target_i386::make_plt_section): Use that.
978         Call this->plt_->add_eh_frame method here.
979         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
980         rather than plt_entry_size variable.
981         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
982         (Output_data_plt_i386::address_for_local): Likewise.
983         (Output_data_plt_i386::do_write): Likewise.
984         Move guts of PLT filling to...
985         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
986         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
987         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
988         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
989
990 2012-05-01  Cary Coutant  <ccoutant@google.com>
991
992         * dwarf_reader.cc (Dwarf_die::read_attributes)
993         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
994         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
995         * reduced_debug_output.cc
996         (Output_reduced_debug_info_section::get_die_end): Remove
997         DW_FORM_GNU_ref_index.  Add default case.
998
999 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1000
1001         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1002         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1003         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1004         DW_AT_high_pc as offset from DW_AT_low_pc.
1005
1006         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1007         * testsuite/Makefile.in: Regenerate.
1008         * testsuite/gdb_index_test_3.c: New test source file.
1009         * testsuite/gdb_index_test_3.sh: New test source file.
1010
1011 2012-04-25  Ian Lance Taylor  <iant@google.com>
1012
1013         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1014         pointer.
1015         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1016         as a class, not a struct.
1017         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1018         (Target_arm::apply_cortex_a8_workaround): Likewise.
1019         * gc.h: Declare Reloc_types as a struct, not a class.
1020         * object.h: Declare Symbols_data as a struct.
1021         * reloc.h: Declare Read_relocs_data as a struct.
1022         * target.h: Declare Relocate_info as a struct.
1023
1024 2012-04-24  David S. Miller  <davem@davemloft.net>
1025
1026         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1027         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1028         and R_SPARC_WPLT30.
1029
1030 2012-04-24  Cary Coutant  <ccoutant@google.com>
1031
1032         * incremental-dump.cc (find_input_containing_global): Replace
1033         magic number with symbolic constant.
1034         (dump_incremental_inputs): Update version number.
1035         * incremental.cc (Output_section_incremental_inputs): Update version
1036         number; import symbolic constants from Incremental_inputs_reader.
1037         (Incremental_inputs::create_data_sections): Align relocations
1038         section correctly for 64-bit targets.
1039         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1040         constants; add padding.
1041         (Output_section_incremental_inputs::write_header): Add assert for
1042         header_size.
1043         (Output_section_incremental_inputs::write_input_files): Add assert
1044         for input_entry_size.
1045         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1046         add assert for object_info_size, input_section_entry_size,
1047         global_sym_entry_size.
1048         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1049         for data structure sizes; use them.
1050         (Incremental_input_entry_reader): Import symbolic constants from
1051         Incremental_inputs_reader; use them.
1052
1053 2012-04-23  David S. Miller  <davem@davemloft.net>
1054
1055         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1056         and elf_flags_set_.
1057         (Target_sparc::Target_sparc): Initialize new fields.
1058         (Target_sparc::do_make_elf_object): New function.
1059         (Target_sparc::do_adjust_elf_header): New function.
1060
1061 2012-04-23  Cary Coutant  <ccoutant@google.com>
1062
1063         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1064         CU range table of gdb index.
1065
1066 2012-04-20  David S. Miller  <davem@davemloft.net>
1067
1068         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1069         instead of false.
1070
1071 2012-04-16  David S. Miller  <davem@davemloft.net>
1072
1073         * sparc.cc (Target_sparc::got_address): New function.
1074         (Sparc_relocate_functions::gdop_hix22): New function.
1075         (Sparc_relocate_functions::gdop_lox10): New function.
1076         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1077         relocs.
1078         (Target_sparc::Scan::local): Likewise if the global symbol is not
1079         preemptible and is not IFUNC.
1080         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1081         transformations for local and non-preemptible non-IFUNC global
1082         symbols.
1083
1084         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1085         writing out 64-bit part of ranges.
1086
1087         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1088         -fpic and -fpie respectively.
1089         * Makefile.in: Regenerate.
1090
1091         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1092         (Target_sparc::Target_sparc): Initialize new field.
1093         (Target_sparc::do_plt_section_for_global): New function.
1094         (Target_sparc::do_plt_section_for_local): New function.
1095         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1096         (Target_sparc::make_plt_section): New function, broken out of
1097         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1098         (Target_sparc::make_plt_entry): Call make_plt_section.
1099         (Target_sparc::make_local_ifunc_plt_entry): New function.
1100         (Target_sparc::rela_ifunc_section): New function.
1101         (Target_sparc::plt_section): Remove const.
1102         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1103         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1104         and ifunc_count_ fields.
1105         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1106         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1107         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1108         (Output_data_plt_sparc::rela_ifunc): New function.
1109         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1110         (Output_data_plt_sparc::has_ifunc_section): New function.
1111         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1112         (Output_data_plt_sparc::address_for_global): New function.
1113         (Output_data_plt_sparc::address_for_local): New function.
1114         (Output_data_plt_sparc::plt_index_to_offset): New function.
1115         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1116         and entry_count.
1117         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1118         entry_count.
1119         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1120         R_SPARC_JMP_IREL to switch.
1121         (Target_sparc::Scan::check_non_pic): Likewise.
1122         (Target_sparc::Scan::local): Handle IFUNC symbols.
1123         (Target_sparc::Scan::local): Likewise.
1124         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1125         and plt_address_for_local.
1126         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1127         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1128
1129         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1130         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1131         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1132         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1133         global relocs too.
1134         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1135         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1136         calls.
1137         * sparc.cc (Target_sparc::Scan::global): Likewise.
1138         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1139
1140 2012-04-16  Cary Coutant  <ccoutant@google.com>
1141
1142         * archive.cc (Library_base::should_include_member): Check for
1143         --export-dynamic-symbol.
1144         * options.h (class General_options): Add --export-dynamic-symbol.
1145         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1146         --export-dynamic-symbol.
1147         (Symbol_table::gc_mark_undef_symbols): Likewise.
1148         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1149
1150 2012-04-12  David S. Miller  <davem@davemloft.net>
1151
1152         * sparc.cc (Reloc::wdisp10): New relocation method.
1153         (Reloc::h34): Likewise.
1154         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1155         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1156         R_SPARC_WDISP10.
1157         (Target_sparc::Scan::local): Likewise.
1158         (Target_sparc::Scan::global): Likewise.
1159         (Target_sparc::Relocate::relocate): Likewise.
1160
1161 2012-04-09  Cary Coutant  <ccoutant@google.com>
1162
1163         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1164         low_pc == 0.
1165
1166 2012-04-06  Ian Lance Taylor  <iant@google.com>
1167
1168         * timer.cc: #include <unistd.h>.
1169
1170 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1171
1172         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1173         * config.in: Regenerate.
1174         * configure: Regenerate.
1175
1176 2012-04-05  Nick Clifton  <nickc@redhat.com>
1177
1178         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1179         (AM_LC_MESSAGES): Add.
1180         * aclocal.m4: Regenerate.
1181         * config.in: Regenerate.
1182         * configure: Regenerate.
1183
1184 2012-03-21  Cary Coutant  <ccoutant@google.com>
1185
1186         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1187         * Makefile.in: Regenerate.
1188         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1189         (Sized_elf_reloc_mapper::symbol_section): New function.
1190         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1191         (make_elf_reloc_mapper): New function.
1192         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1193         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1194         (Dwarf_abbrev_table::do_get_abbrev): New function.
1195         (Dwarf_ranges_table::read_ranges_table): New function.
1196         (Dwarf_ranges_table::read_range_list): New function.
1197         (Dwarf_pubnames_table::read_section): New function.
1198         (Dwarf_pubnames_table::read_header): New function.
1199         (Dwarf_pubnames_table::next_name): New function.
1200         (Dwarf_die::Dwarf_die): New function.
1201         (Dwarf_die::read_attributes): New function.
1202         (Dwarf_die::skip_attributes): New function.
1203         (Dwarf_die::set_name): New function.
1204         (Dwarf_die::set_linkage_name): New function.
1205         (Dwarf_die::attribute): New function.
1206         (Dwarf_die::string_attribute): New function.
1207         (Dwarf_die::int_attribute): New function.
1208         (Dwarf_die::uint_attribute): New function.
1209         (Dwarf_die::ref_attribute): New function.
1210         (Dwarf_die::child_offset): New function.
1211         (Dwarf_die::sibling_offset): New function.
1212         (Dwarf_info_reader::check_buffer): New function.
1213         (Dwarf_info_reader::parse): New function.
1214         (Dwarf_info_reader::do_parse): New function.
1215         (Dwarf_info_reader::do_read_string_table): New function.
1216         (Dwarf_info_reader::lookup_reloc): New function.
1217         (Dwarf_info_reader::get_string): New function.
1218         (Dwarf_info_reader::visit_compilation_unit): New function.
1219         (Dwarf_info_reader::visit_type_unit): New function.
1220         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1221         Sized_elf_reloc_mapper.
1222         (Sized_dwarf_line_info::symbol_section): Remove function.
1223         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1224         (Sized_dwarf_line_info::read_line_mappings): Remove object
1225         parameter, adjust callers.
1226         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1227         * dwarf_reader.h: Include <sys/types.h>.
1228         (class Track_relocs): Remove forward declaration.
1229         (class Elf_reloc_mapper): New class.
1230         (class Sized_elf_reloc_mapper): New class.
1231         (class Dwarf_abbrev_table): New class.
1232         (class Dwarf_range_list): New class.
1233         (class Dwarf_ranges_table): New class.
1234         (class Dwarf_pubnames_table): New class.
1235         (class Dwarf_die): New class.
1236         (class Dwarf_info_reader): New class.
1237         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1238         (Sized_dwarf_line_info::symbol_section): Remove member function.
1239         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1240         base class.
1241         * gdb-index.cc: New source file.
1242         * gdb-index.h: New source file.
1243         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1244         and .debug_types sections, call Layout::add_to_gdb_index.
1245         (Sized_relobj_incr::do_section_name): Implement.
1246         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1247         return type; Implement.
1248         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1249         return type.
1250         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1251         parameter list and return type.
1252         (Sized_incr_dynobj::do_section_contents): Likewise.
1253         * layout.cc: Include gdb-index.h.
1254         (Layout::Layout): Initialize gdb_index_data_.
1255         (Layout::init_fixed_output_section): Check for .gdb_index section.
1256         (Layout::add_to_gdb_index): New function. Instantiate.
1257         * layout.h: Add forward declaration for class Gdb_index.
1258         (Layout::add_to_gdb_index): New member function.
1259         (Layout::gdb_index_data_): New data member.
1260         * main.cc: Include gdb-index.h.
1261         (main): Print statistics for gdb index.
1262         * object.cc (Object::section_contents): Move code into
1263         do_section_contents.
1264         (need_decompressed_section): Check for sections needed when building
1265         gdb index.
1266         (build_compressed_section_map): Likewise.
1267         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1268         gdb index.
1269         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1270         sections; call Layout::add_to_gdb_index.
1271         (Sized_relobj_file::do_decompressed_section_contents): Call
1272         do_section_contents directly.
1273         * object.h (Object::do_section_contents): Adjust parameter list and
1274         return type.
1275         (Object::do_decompressed_section_contents): Call do_section_contents
1276         directly.
1277         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1278         return type.
1279         * options.h (class General_options): Add --gdb-index option.
1280         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1281         list and return type.
1282         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1283         * reloc.h (Track_relocs::checkpoint): New function.
1284         (Track_relocs::reset): New function.
1285
1286         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1287         New test cases.
1288         * testsuite/Makefile.in: Regenerate.
1289         * testsuite/gdb_index_test.cc: New test source file.
1290         * testsuite/gdb_index_test_1.sh: New test source file.
1291         * testsuite/gdb_index_test_2.sh: New test source file.
1292
1293 2012-03-19  Doug Kwan  <dougkwan@google.com>
1294
1295         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1296         (Target_arm::do_finalize_sections): Remove code which defines
1297         __exidx_start and __exidx_end.  Make symbol table parameter
1298         anonymous as it is not used.
1299         * gold.cc (queue_middle_tasks): Call target hook to define any
1300         target-specific symbols.
1301         * target.h (Target::define_standard_symbols): New method.
1302         (Target::do_define_standard_symbols): Same.
1303         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1304         * testsuite/Makefile.in: Regenerate.
1305         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1306         and __exidx_end.
1307         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1308         relocations are generated for __exidx_start and __exidx_end.
1309
1310 2012-03-16  Doug Kwan  <dougkwan@google.com>
1311
1312         * testsuite/Makefile.am: Disable test initpri3b.
1313         * testsuite/Makefile.in: Regenerate.
1314
1315 2012-03-15  Doug Kwan  <dougkwan@google.com>
1316
1317         * arm.cc (Target_arm::got_section): Make .got section read-only
1318         if -z now is given.
1319
1320 2012-03-15  Ian Lance Taylor  <iant@google.com>
1321
1322         PR gold/13850
1323         * layout.cc (Layout::make_output_section): Correctly mark
1324         SHT_INIT_ARRAY, et. al., as relro.
1325
1326 2012-03-14  Doug Kwan  <dougkwan@google.com>
1327
1328         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1329         dynamic relocations for protected symbols in shared objects.
1330
1331 2012-03-13  Ian Lance Taylor  <iant@google.com>
1332
1333         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1334         keep the larger alignment.
1335
1336 2012-03-12  Cary Coutant  <ccoutant@google.com>
1337
1338         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1339         handling of DW_LNE_define_file.
1340
1341 2012-03-12  Cary Coutant  <ccoutant@google.com>
1342
1343         * reduced_debug_output.cc
1344         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1345         codes to switch.
1346
1347 2012-02-29  Cary Coutant  <ccoutant@google.com>
1348
1349         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1350
1351 2012-02-29  Cary Coutant  <ccoutant@google.com>
1352
1353         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1354         Call Object::decompressed_section_contents.
1355         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1356         New dtor.
1357         (Sized_dwarf_line_info::buffer_start_): New data member.
1358         * merge.cc (Output_merge_data::do_add_input_section): Call
1359         Object::decompressed_section_contents.
1360         (Output_merge_string::do_add_input_section): Likewise.
1361         * object.cc (need_decompressed_section): New function.
1362         (build_compressed_section_map): Decompress sections needed later.
1363         (Sized_relobj_file::do_decompressed_section_contents): New function.
1364         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1365         * object.h (Object::decompressed_section_contents): New function.
1366         (Object::discard_decompressed_sections): New function.
1367         (Object::do_decompressed_section_contents): New function.
1368         (Object::do_discard_decompressed_sections): New function.
1369         (Compressed_section_info): New type.
1370         (Compressed_section_map): Include decompressed section contents.
1371         (Sized_relobj_file::do_decompressed_section_contents): New function.
1372         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1373
1374 2012-02-16  Cary Coutant  <ccoutant@google.com>
1375
1376         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1377         * testsuite/Makefile.in: Regenerate.
1378
1379 2012-02-14  Cary Coutant  <ccoutant@google.com>
1380
1381         * options.cc (General_options::finalize): Disallow -pie and -static.
1382
1383 2012-02-03  Doug Kwan  <dougkwan@google.com>
1384
1385         * arm.cc (Arm_relocate_functions::abs8,
1386         Arm_relocate_functions::abs16): Use
1387         Bits::has_signed_unsigned_overflow32.
1388         (Arm_relocate_functions::thm_abs8): Correct range of
1389         overflow check.
1390         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1391         in assertions.
1392
1393 2012-02-02  Doug Kwan  <dougkwan@google.com>
1394
1395         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1396         position independent outputs, not just shared objects.
1397
1398 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1399
1400         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1401         * configure: Regenerated.
1402
1403 2012-01-27  Ian Lance Taylor  <iant@google.com>
1404
1405         * reloc.h (Bits): New class with static functions, copied from
1406         namespace utils in arm.cc.
1407         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1408         instead.
1409
1410 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1411
1412         * incremental.cc (write_info_blocks): Correct relocation offset.
1413
1414 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1415
1416         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1417         (Relocate::tls_gd_to_le): Likewise.
1418
1419 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1420
1421         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1422
1423 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1424
1425         * configure.ac: Check if -mcmodel=medium works.
1426         * configure: Regenerated.
1427
1428 2012-01-24  Cary Coutant  <ccoutant@google.com>
1429
1430         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1431         definition and ...
1432         (read_unsigned_LEB_128_x): ... this new function.
1433         (read_signed_LEB_128): Replaced with inline definition and ...
1434         (read_signed_LEB_128_x): ... this new function.
1435         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1436         (read_unsigned_LEB_128): Add inline definition.
1437         (read_signed_LEB_128_x): New function.
1438         (read_signed_LEB_128): Add inline definition.
1439         * testsuite/Makefile.am (leb128_unittest): New unit test.
1440         * testsuite/Makefile.in: Regenerate.
1441         * testsuite/leb128_unittest.cc: New unit test.
1442
1443 2012-01-23  Ian Lance Taylor  <iant@google.com>
1444
1445         PR gold/13617
1446         * i386.cc (Target_i386::do_code_fill): When using a jmp
1447         instruction, pad with nop instructions.
1448         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1449
1450 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1451
1452         * x86_64.cc (gc_process_relocs): Add typename on types used in
1453         template.
1454         (scan_relocs): Likewise.
1455         (relocate_section): Likewise.
1456         (apply_relocation): Likewise.
1457
1458 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1459
1460         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1461         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1462         under x32.
1463
1464 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1465
1466         * x86_64.cc: Initial support for x32.
1467
1468 2012-01-03  Cary Coutant  <ccoutant@google.com>
1469
1470         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1471         Use abstract base class for GOT.
1472         * gold/output.h (class Output_data_got_base): New abstract base class.
1473         (class Output_data_got): Derive from new base class, adjust ctors.
1474         (Output_data_got::reserve_slot): Make virtual; rename to
1475         do_reserve_slot; Adjust callers.
1476         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1477         pointer to abstract base class.
1478         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1479
1480 2011-12-18  Ian Lance Taylor  <iant@google.com>
1481
1482         * object.h (Relobj::local_symbol_value): New function.
1483         (Relobj::local_plt_offset): New function.
1484         (Relobj::local_has_got_offset): New function.
1485         (Relobj::local_got_offset): New function.
1486         (Relobj::set_local_got_offset): New function.
1487         (Relobj::do_local_symbol_value): New pure virtual function.
1488         (Relobj::do_local_plt_offset): Likewise.
1489         (Relobj::do_local_has_got_offset): Likewise.
1490         (Relobj::do_local_got_offset): Likewise.
1491         (Relobj::do_set_local_got_offset): Likewise.
1492         (Sized_relobj::do_local_has_got_offset): Rename from
1493         local_has_got_offset.
1494         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1495         (Sized_relobj::do_set_local_got_offset): Rename from
1496         set_local_got_offset.
1497         (Sized_relobj_file::do_local_plt_offset): Rename from
1498         local_plt_offset.
1499         (Sized_relobj_file::do_local_symbol_value): New function.
1500         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1501         local_plt_offset.
1502         * output.cc (Output_data_got::Got_entry::write): Change object to
1503         Relobj.  Use local_symbol_value.
1504         (Output_data_got::add_global_with_rel): Change rel_dyn to
1505         Output_data_reloc_generic*.  Use add_global_generic.
1506         (Output_data_got::add_global_with_rela): Remove.  Change all
1507         callers to use add_global_with_rel.
1508         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1509         Output_data_reloc_generic*.  Use add_global_generic.
1510         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1511         callers to use add_global_pair_with_rel.
1512         (Output_data_got::add_local): Change object to Relobj*.
1513         (Output_data_got::add_local_plt): Likewise.
1514         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1515         change rel_dyn to Output_data_reloc_generic*.  Use
1516         add_local_generic.
1517         (Output_data_got::add_local_with_rela): Remove.  Change all
1518         callers to use all_local_with_rel.
1519         (Output_data_got::add_local_pair_with_rel): Change object to
1520         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1521         add_output_section_generic.
1522         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1523         callers to use add_local_pair_with_rel.
1524         (Output_data_got::reserve_local): Change object to Relobj*.
1525         * output.h: (class Output_data_reloc_generic): Add pure virtual
1526         declarations for add_global_generic, add_local_generic,
1527         add_output_section_generic.
1528         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1529         functions for Output_data_reloc_generic.  Update declarations for
1530         changes listed in output.cc.
1531         (class Output_data_got): Change template parameter to got_size.
1532         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1533         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1534         function.
1535         (Sized_relobj_incr::do_local_plt_offset): New function.
1536         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1537         add_global_generic.
1538
1539 2011-12-17  Cary Coutant  <ccoutant@google.com>
1540
1541         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1542         * resolve.cc (Symbol_table::resolve): Likewise.
1543         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1544         arrays.
1545         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1546
1547 2011-12-16  Ian Lance Taylor  <iant@google.com>
1548
1549         * output.h (Output_data_reloc_generic::add): Only call
1550         add_dynamic_reloc if this is a dynamic reloc section.
1551
1552 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1553
1554         PR gold/13505
1555         * target-reloc.h (apply_relocation): Replace <64, false> with
1556         <size, big_endian>.
1557
1558 2011-11-25  Nick Clifton  <nickc@redhat.com>
1559
1560         * po/it.po: New Italian translation.
1561
1562 2011-11-17  Sterling Augustine  <saugustine@google.com>
1563
1564         * script.cc (script_include_directive): Implement.
1565         (read_script_file): New local variables name and search_path. Update
1566         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1567         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1568         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1569
1570 2011-11-11  Sterling Augustine  <saugustine@google.com>
1571
1572         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1573         (file_or_sections_cmd): Likewise.
1574
1575 2011-11-11  Doug Kwan  <dougkwan@google.com>
1576
1577         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1578         if --just-symbols is given.
1579
1580 2011-11-10  Doug Kwan  <dougkwan@google.com>
1581
1582         PR gold/13362
1583         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1584         when processing data relocs.
1585         * reloc.h (Relocate_functions::rel_unaligned): New method.
1586         (Relocate_functions::pcrel_unaligned): Ditto.
1587         (Relocate_functions::rel32_unaligned): Ditto.
1588         (Relocate_functions::pcrel32_unaligned): Ditto.
1589
1590 2011-11-09  Doug Kwan  <dougkwan@google.com>
1591
1592         PR gold/13362
1593         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1594         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1595         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1596         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1597         (Relocate_functions::rel_unaligned): New.
1598         (Relocate_functions::rel32_unaligned): New.
1599         * target-reloc.h (relocate_for_relocatable): Add code to handle
1600         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1601         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1602         arm_unaligned_reloc_r): New targets.
1603         * testsuite/Makefile.in: Regenerate.
1604         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1605         linking.
1606
1607 2011-11-02  Ian Lance Taylor  <iant@google.com>
1608
1609         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1610         NATIVE_LINKER.
1611         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1612         * options.cc (General_options::finalize): Use library search path
1613         from configure script if specified.  If not native and no sysroot,
1614         only search TOOLLIBDIR.
1615         * options.h (Search_directory::Search_directory): Change name to
1616         const std::string&.
1617         (General_options::add_to_library_path_with_sysroot): Change arg to
1618         const std::string&.
1619         * configure, Makefile.in, config.in: Rebuild.
1620
1621 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1622
1623         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1624         we are working around the ARM1176 Erratum.
1625         * options.h (General_options::fix_arm1176): Add option.
1626         * testsuite/Makefile.am: Add testcases, and keep current ones
1627         working.
1628         * testsuite/Makefile.in: Regenerate.
1629         * testsuite/arm_fix_1176.s: New file.
1630         * testsuite/arm_fix_1176.sh: Likewise.
1631
1632 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1633
1634         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1635         may_use_blx_.
1636         (Target_arm::may_use_blx): Remove method.
1637         (Target_arm::set_may_use_blx): Likewise.
1638         (Target_arm::may_use_v4t_interworking): New method.
1639         (Target_arm::may_use_v5t_interworking): Likewise.
1640         (Target_arm::may_use_blx_): Remove member variable.
1641         (Arm_relocate_functions::arm_branch_common): Check for v5T
1642         interworking.
1643         (Arm_relocate_functions::thumb_branch_common): Likewise.
1644         (Reloc_stub::stub_type_for_reloc): Likewise.
1645         (Target_arm::do_finalize_sections): Correct interworking checks.
1646         * testsuite/Makefile.am: Add new tests.
1647         * testsuite/Makefile.in: Regenerate.
1648         * testsuite/arm_farcall_arm_arm.s: New test.
1649         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1650         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1651         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1652         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1653         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1654         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1655         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1656
1657 2011-10-31  Cary Coutant  <ccoutant@google.com>
1658
1659         PR gold/13023
1660         * expression.cc (Expression::eval_with_dot): Add
1661         is_section_dot_assignment parameter.
1662         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1663         absolute and assigning to dot within a section.
1664         * script-sections.cc
1665         (Output_section_element_assignment::set_section_addresses): Pass
1666         dot_section to set_if_absolute.
1667         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1668         as is_section_dot_assignment flag to eval_with_dot.
1669         (Output_section_element_dot_assignment::set_section_addresses):
1670         Likewise.
1671         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1672         parameter.  Also set value if relative to dot_section; set the
1673         symbol's output_section.
1674         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1675         parameter.  Adjust all callers.
1676         (Expression::eval_maybe_dot): Likewise.
1677         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1678         Adjust all callers.
1679         * testsuite/script_test_2.t: Test assignment of an absolute value
1680         to dot within an output section element.
1681
1682 2011-10-31  Cary Coutant  <ccoutant@google.com>
1683
1684         * options.h (class General_options): Add --[no-]gnu-unique options.
1685         * symtab.cc (Symbol_table::sized_write_globals): Convert
1686         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1687
1688 2011-10-31  Cary Coutant  <ccoutant@google.com>
1689
1690         PR gold/13359
1691         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1692         unnecessary assertion.
1693         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1694
1695 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1696
1697         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1698         gc_mark_symbol.
1699         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1700         gc_mark_symbol.
1701         Change to just keep the section associated with symbol.
1702         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1703         they are externally visible and --export-dynamic is turned on.
1704         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1705
1706 2011-10-19  Ian Lance Taylor  <iant@google.com>
1707
1708         PR gold/13163
1709         * script-sections.cc
1710         (Output_section_element_dot_assignment::needs_output_section): New
1711         function.
1712
1713 2011-10-19  Ian Lance Taylor  <iant@google.com>
1714
1715         PR gold/13204
1716         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1717         --section-start option was seen.
1718         * options.h (General_options::any_section_start): New function.
1719
1720 2011-10-18  David S. Miller  <davem@davemloft.net>
1721
1722         PR binutils/13301
1723         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1724         member to track relocation locations that have moved during TLS
1725         reloc optimizations.
1726         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1727         (Target_sparc::Relocate::relocate): Adjust view down by 4
1728         bytes if it matches reloc_adjust_addr_.
1729         (Target_sparc::Relocate::relocate_tls): Always move the
1730         __tls_get_addr call delay slot instruction forward 4 bytes when
1731         performing relaxation.
1732
1733 2011-10-18  Cary Coutant  <ccoutant@google.com>
1734
1735         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1736         (Output_file::map_no_anonymous): Check for non-zero
1737         return code from posix_fallocate.
1738
1739 2011-10-17  Cary Coutant  <ccoutant@google.com>
1740
1741         PR gold/13245
1742         * plugin.cc (is_visible_from_outside): Check for symbols
1743         referenced from dynamic objects.
1744         * resolve.cc (Symbol_table::resolve): Don't count references
1745         from dynamic objects as references from real ELF files.
1746         * testsuite/plugin_test_2.sh: Adjust expected result.
1747
1748 2011-10-17  Cary Coutant  <ccoutant@google.com>
1749
1750         * gold.cc: Include timer.h.
1751         (queue_middle_tasks): Stamp time.
1752         (queue_final_tasks): Likewise.
1753         * main.cc (main): Store timer in parameters.  Print timers
1754         for each pass.
1755         * parameters.cc (Parameters::Parameters): Initialize timer_.
1756         (Parameters::set_timer): New function.
1757         (set_parameters_timer): New function.
1758         * parameters.h (Parameters::set_timer): New function.
1759         (Parameters::timer): New function.
1760         (Parameters::timer_): New data member.
1761         (set_parameters_timer): New function.
1762         * timer.cc (Timer::stamp): New function.
1763         (Timer::get_pass_time): New function.
1764         * timer.h (Timer::stamp): New function.
1765         (Timer::get_pass_time): New function.
1766         (Timer::pass_times_): New data member.
1767
1768 2011-10-17  Cary Coutant  <ccoutant@google.com>
1769
1770         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1771         task for members of lib groups.
1772
1773 2011-10-17  Cary Coutant  <ccoutant@google.com>
1774
1775         PR gold/13288
1776         * fileread.cc (File_read::find_view): Add assert.
1777         (File_read::make_view): Move bounds check (replace with assert)...
1778         (File_read::find_or_make_view): ... to here.
1779
1780 2011-10-12  Cary Coutant  <ccoutant@google.com>
1781
1782         * output.cc (Output_file::open_base_file): Handle case where
1783         ::read returns less than requested size.
1784
1785 2011-10-10  Cary Coutant  <ccoutant@google.com>
1786
1787         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1788         Initialize defined_count_.
1789         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1790         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1791         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1792         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1793         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1794         * incremental.h (Sized_relobj_incr::defined_count_): New data
1795         member.
1796         (Sized_incr_dynobj::defined_count_): New data member.
1797         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1798         Return zeroes instead of internal error.
1799
1800 2011-10-10  Cary Coutant  <ccoutant@google.com>
1801
1802         PR gold/13249
1803         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1804         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1805         * output.h (class Output_reloc): Add use_plt_offset flag.
1806         (Output_reloc::type_): Adjust size of bit field.
1807         (Output_reloc::use_plt_offset_): New bit field.
1808         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1809         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1810         flag.  Adjust all callers.
1811         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1812         creating RELATIVE relocations.
1813
1814 2011-10-10  Nick Clifton  <nickc@redhat.com>
1815
1816         * po/es.po: Updated Spanish translation.
1817         * po/fi.po: Updated Finnish translation.
1818
1819 2011-10-03   Diego Novillo  <dnovillo@google.com>
1820
1821         * options.cc (parse_uint): Fix dereference of RETVAL.
1822
1823 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1824
1825         * layout.h (section_order_map_): New member.
1826         (get_section_order_map): New member function.
1827         * output.cc (Output_section::add_input_section): Check for patterns
1828         only when --section-ordering-file is specified.
1829         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1830         output_sections have been formed.
1831         * layout.cc (Layout_Layout): Initialize section_order_map_.
1832         * plugin.cc (update_section_order): Store order in order_map. Do not
1833         update the order.
1834         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1835         * testsuite/Makefile.in: Regenerate.
1836         * testsuite/plugin_section_order.c: New file.
1837         * testsuite/plugin_final_layout.cc: New file.
1838         * testsuite/plugin_final_layout.sh: New file.
1839
1840 2011-09-29  Cary Coutant  <ccoutant@google.com>
1841
1842         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1843         Check for NULL.
1844         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1845         symbols during incremental update.
1846         (Symbol_table::add_from_dynobj): Likewise.
1847
1848 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1849             Ian Lance Taylor  <iant@google.com>
1850
1851         * symtab.cc (Symbol_table::define_special_symbol): Always
1852         canonicalize version string.
1853
1854 2011-09-26  Cary Coutant  <ccoutant@google.com>
1855
1856         * gold.cc (queue_initial_tasks): Move option checks ...
1857         * options.cc (General_options::finalize): ... to here. Disable
1858         some options; make others fatal.
1859
1860 2011-09-26  Cary Coutant  <ccoutant@google.com>
1861
1862         gcc PR lto/47247
1863         * plugin.cc (get_symbols_v2): New function.
1864         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1865         (is_referenced_from_outside): New function.
1866         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1867         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1868         (get_symbols): Pass version parameter.
1869         (get_symbols_v2): New function.
1870         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1871         parameter.
1872         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1873         (onload): Add LDPT_GET_SYMBOLS_V2.
1874         (all_symbols_read_hook): Use get_symbols_v2; check for
1875         LDPR_PREVAILING_DEF_IRONLY_EXP.
1876         * testsuite/plugin_test_3.sh: Update expected results.
1877
1878 2011-09-23  Simon Baldwin  <simonb@google.com>
1879
1880         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1881         configuration options.
1882         * configure: Regenerate.
1883         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1884         * Makefile.in: Regenerate.
1885         * testsuite/Makefile.in: Regenerate.
1886
1887 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1888
1889         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1890
1891 2011-09-19  Cary Coutant  <ccoutant@google.com>
1892
1893         * incremental.cc (can_incremental_update): Fix typo in comment.
1894         * incremental.h (can_incremental_update): Likewise.
1895
1896 2011-09-18  Cary Coutant  <ccoutant@google.com>
1897
1898         * incremental.cc (can_incremental_update): New function.
1899         * incremental.h (can_incremental_update): New function.
1900         * layout.cc (Layout::init_fixed_output_section): Call it.
1901         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1902         * object.cc (Sized_relobj_file::do_layout): Call
1903         can_incremental_update.
1904
1905 2011-09-13  Cary Coutant  <ccoutant@google.com>
1906
1907         * configure.ac: Check for glibc support for gnu_indirect_function
1908         support with static linking, setting automake conditional
1909         IFUNC_STATIC.
1910         * Makefile.in: Regenerate.
1911         * configure: Regenerate.
1912
1913         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1914         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1915         for IFUNC_STATIC.
1916         * testsuite/Makefile.in: Regenerate.
1917
1918 2011-09-13  Cary Coutant  <ccoutant@google.com>
1919
1920         * incremental.cc (Sized_relobj_incr::do_layout): Call
1921         report_comdat_group for kept comdat sections.
1922         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1923         * testsuite/Makefile.in: Regenerate.
1924         * testsuite/incr_comdat_test_1.cc: New source file.
1925         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1926         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1927         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1928
1929 2011-09-13  Ian Lance Taylor  <iant@google.com>
1930
1931         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1932         variable external_symbols_offset.
1933
1934 2011-09-12  Ian Lance Taylor  <iant@google.com>
1935
1936         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1937         triggered if object has no symbols.
1938
1939 2011-09-09  David S. Miller  <davem@davemloft.net>
1940
1941         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1942         (Output_fill_debug_line::do_write): Likewise.
1943
1944 2011-08-29  Cary Coutant  <ccoutant@google.com>
1945
1946         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1947         casts to match formatting specs.
1948         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1949
1950 2011-08-26  Cary Coutant  <ccoutant@google.com>
1951
1952         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1953         remaining hole size when allocating.
1954         (Layout::make_output_section): Set fill methods for debug sections.
1955         * layout.h (Free_list::Free_list_node): Move from private to
1956         public.
1957         (Free_list::set_min_hole_size): New function.
1958         (Free_list::begin, Free_list::end): New functions.
1959         (Free_list::min_hole_): New data member.
1960         * output.cc: Include dwarf.h.
1961         (Output_fill_debug_info::do_minimum_hole_size): New function.
1962         (Output_fill_debug_info::do_write): New function.
1963         (Output_fill_debug_line::do_minimum_hole_size): New function.
1964         (Output_fill_debug_line::do_write): New function.
1965         (Output_section::Output_section): Initialize new data member.
1966         (Output_section::set_final_data_size): Ensure patch space is larger
1967         than minimum hole size.
1968         (Output_section::do_write): Fill holes in debug sections.
1969         * output.h (Output_fill): New class.
1970         (Output_fill_debug_info): New class.
1971         (Output_fill_debug_line): New class.
1972         (Output_section::set_free_space_fill): New function.
1973         (Output_section::free_space_fill_): New data member.
1974         * testsuite/Makefile.am (incremental_test_3): Add
1975         --incremental-patch option.
1976         (incremental_test_4): Likewise.
1977         (incremental_test_5): Likewise.
1978         (incremental_test_6): Likewise.
1979         (incremental_copy_test): Likewise.
1980         (incremental_common_test_1): Likewise.
1981         * testsuite/Makefile.in: Regenerate.
1982
1983 2011-08-26  Nick Clifton  <nickc@redhat.com>
1984
1985         * po/es.po: Updated Spanish translation.
1986
1987 2011-08-01  Cary Coutant  <ccoutant@google.com>
1988
1989         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1990         * gold/testsuite/Makefile.in: Regenerate.
1991         * gold/testsuite/justsyms_exec.c: New source file.
1992         * gold/testsuite/justsyms_lib.c: New source file.
1993
1994 2011-08-01  Cary Coutant  <ccoutant@google.com>
1995
1996         * layout.cc (Layout::set_segment_offsets): Don't realign text
1997         segment if -Ttext was specified.
1998         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1999         file type.
2000         * object.h (Sized_relobj_file::e_type): New function.
2001         (Sized_relobj_file::e_type_): New data member.
2002         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2003         base address for ET_EXEC files.
2004         * target.cc (Target::do_make_elf_object_implementation): Allow
2005         ET_EXEC files with --just-symbols option.
2006
2007 2011-07-28  Cary Coutant  <ccoutant@google.com>
2008
2009         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2010         Add thread_number parameter.
2011         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2012         * workqueue-threads.cc
2013         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2014         current thread if its thread number is greater than desired thread
2015         count.
2016         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2017         Add thread_number parameter.
2018         (Workqueue::should_cancel_thread): Likewise.
2019         (Workqueue::find_runnable_or_wait): Pass thread_number to
2020         should_cancel_thread.
2021         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2022         parameter.
2023
2024 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2025
2026         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2027         only after checking if it cannot be forced local.
2028         * symtab.h (is_externally_visible): Check if the symbol is not forced
2029         local.
2030
2031 2011-07-15  Ian Lance Taylor  <iant@google.com>
2032
2033         * options.h (class General_options): Add --print-output-format.
2034         Move -EL next to -EB, for  better --help output.
2035         * target-select.cc: Include <cstdio>, "options.h", and
2036         "parameters.h".
2037         (Target_selector::do_target_bfd_name): New function.
2038         (print_output_format): New function.
2039         * target-select.h (class Target_selector): Update declarations.
2040         (Target_selector::target_bfd_name): New function.
2041         (print_output_format): Declare.
2042         * main.cc: Include "target-select.h".
2043         (main): Handle --print-output-format.
2044         * gold.cc: Include "target-select.h".
2045         (queue_initial_tasks): Handle --print-output-format when there are
2046         no input files.
2047         * parameters.cc (parameters_force_valid_target): Give a better
2048         error message if -EB/-EL does not match target.
2049         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2050         function.
2051
2052 2011-07-15  Ian Lance Taylor  <iant@google.com>
2053
2054         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2055         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2056         (Output_data_plt_i386::do_write): Write address of .dynamic
2057         section to first entry in .got.plt section.
2058         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2059         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2060         Initialize layout_.
2061         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2062         section to first entry in .got.plt section.
2063         * layout.h (Layout::dynamic_section): New function.
2064
2065 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2066
2067         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2068         to claim_file call.
2069         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2070         input_section_position_, and input_section_glob_.
2071         (read_layout_from_file): Call function section_ordering_specified.
2072         * layout.h (is_section_ordering_specified): New function.
2073         (section_ordering_specified): New function.
2074         (section_ordering_specified_): New boolean member.
2075         * main.cc(main): Call load_plugins after layout object is defined.
2076         * output.cc (Output_section::add_input_section): Use
2077         function section_ordering_specified to check if section ordering is
2078         needed.
2079         * output.cc (Output_section::add_relaxed_input_section): Use
2080         function section_ordering_specified to check if section ordering is
2081         needed.
2082         (Output_section::update_section_layout): New function.
2083         (Output_section::sort_attached_input_sections): Check if input section
2084         must be reordered.
2085         * output.h (Output_section::update_section_layout): New function.
2086         * plugin.cc (get_section_count): New function.
2087         (get_section_type): New function.
2088         (get_section_name): New function.
2089         (get_section_contents): New function.
2090         (update_section_order): New function.
2091         (allow_section_ordering): New function.
2092         (Plugin::load): Add the new interfaces to the transfer vector.
2093         (Plugin_manager::load_plugins): New parameter.
2094         (Plugin_manager::all_symbols_read): New parameter.
2095         (Plugin_manager::claim_file): New parameter. Save the elf object for
2096         unclaimed objects.
2097         (Plugin_manager::get_elf_object): New function.
2098         (Plugin_manager::get_view): Change to directly use the bool to check
2099         if get_view is called from claim_file_hook.
2100         * plugin.h (input_objects): New function
2101         (Plugin__manager::load_plugins): New parameter.
2102         (Plugin_manager::claim_file): New parameter.
2103         (Plugin_manager::get_elf_object): New function.
2104         (Plugin_manager::in_claim_file_handler): New function.
2105         (Plugin_manager::in_claim_file_handler_): New member.
2106         (layout): New function.
2107         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2108         handler with an extra parameter. Make the elf object before calling
2109         claim_file handler.
2110         * testsuite/plugin_test.c (get_section_count): New function pointer.
2111         (get_section_type): New function pointer.
2112         (get_section_name): New function pointer.
2113         (get_section_contents): New function pointer.
2114         (update_section_order): New function pointer.
2115         (allow_section_ordering): New function pointer.
2116         (onload): Check if the new interfaces exist.
2117
2118 2011-07-13  Ian Lance Taylor  <iant@google.com>
2119
2120         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2121         relro section.
2122         * x86_64.cc (Target_x86_64::got_section): Likewise.
2123         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2124         (relro_now_test_SOURCES): New variable.
2125         (relro_now_test_DEPENDENCIES): New variable.
2126         (relro_now_test_LDFLAGS): New variable.
2127         (relro_now_test_LDADD): New variable.
2128         (relro_now_test.so): New target.
2129         * testsuite/Makefile.in: Rebuild.
2130
2131 2011-07-12  Ian Lance Taylor  <iant@google.com>
2132
2133         PR gold/12980
2134         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2135         GLOB_DAT relocation rather than a RELATIVE relocation for a
2136         protected symbol when creating a shared library.
2137         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2138         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2139         * testsuite/protected_main_1.cc (main): Test that protected
2140         function has same address.
2141
2142 2011-07-11  Ian Lance Taylor  <iant@google.com>
2143
2144         PR gold/12979
2145         * options.h (class General_options): Add -Bgroup.
2146         * options.cc (General_options::finalize): If -Bgroup is set,
2147         default to --unresolved-symbols=report-all.
2148         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2149         * target-reloc.h (issue_undefined_symbol_error): Handle
2150         --unresolved-symbols=report-all.
2151
2152 2011-07-08  Ian Lance Taylor  <iant@google.com>
2153
2154         PR gold/11985
2155         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2156         if linker script discards key sections.
2157         (Layout::create_dynamic_symtab): Likewise.
2158         (Layout::assign_local_dynsym_offsets): Likewise.
2159         (Layout::sized_create_version_sections): Likewise.
2160         (Layout::create_interp): Likewise.
2161         (Layout::finish_dynamic_section): Likewise.
2162         (Layout::set_dynamic_symbol_size): Likewise.
2163
2164 2011-07-08  Ian Lance Taylor  <iant@google.com>
2165
2166         PR gold/12386
2167         * options.h (class General_options): Add --unresolved-symbols.
2168         * target-reloc.h (issue_undefined_symbol_error): Check
2169         --unresolved-symbols.  Add comments.
2170
2171 2011-07-08  Ian Lance Taylor  <iant@google.com>
2172
2173         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2174         expression more complex.
2175
2176 2011-07-08  Ian Lance Taylor  <iant@google.com>
2177
2178         PR gold/11317
2179         * target-reloc.h (issue_undefined_symbol_error): New inline
2180         function, broken out of relocate_section.
2181         (relocate_section): Call issue_undefined_symbol_error.
2182         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2183         there is no TLS segment if we are about to issue an undefined
2184         symbol error.
2185         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2186
2187 2011-07-08  Ian Lance Taylor  <iant@google.com>
2188
2189         PR gold/12279
2190         * resolve.cc (Symbol_table::should_override): Add fromtype
2191         parameter.  Change all callers.  Give error when linking together
2192         TLS and non-TLS symbol.
2193         (Symbol_table::should_override_with_special): Add fromtype
2194         parameter.  Change all callers.
2195         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2196         there is no TLS segment if we have reported some errors.
2197         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2198
2199 2011-07-08  Ian Lance Taylor  <iant@google.com>
2200
2201         PR gold/12372
2202         * target.h (Target::plt_address_for_global): New function.
2203         (Target::plt_address_for_local): New function.
2204         (Target::plt_section_for_global): Remove.
2205         (Target::plt_section_for_local): Remove.
2206         (Target::do_plt_address_for_global): New virtual function.
2207         (Target::do_plt_address_for_local): New virtual function.
2208         (Target::do_plt_section_for_global): Remove.
2209         (Target::do_plt_section_for_local): Remove.
2210         (Target::register_global_plt_entry): Add Symbol_table and Layout
2211         parameters.
2212         * output.cc (Output_data_got::Got_entry::write): Use
2213         plt_address_for_global and plt_address_for_local.
2214         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2215         address of output section.
2216         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2217         got_irelative_, and irelative_count_ fields.  Update
2218         declarations.
2219         (Output_data_plt_i386::has_irelative_section): New function.
2220         (Output_data_plt_i386::entry_count): Add irelative_count_.
2221         (Output_data_plt_i386::set_final_data_size): Likewise.
2222         (class Target_i386): Add got_irelative_ and rel_irelative_
2223         fields.  Update declarations.
2224         (Target_i386::Target_i386): Initialize new fields.
2225         (Target_i386::do_plt_address_for_global): New function replacing
2226         do_plt_section_for_global.
2227         (Target_i386::do_plt_address_for_local): New function replacing
2228         do_plt_section_for_local.
2229         (Target_i386::got_section): Create got_irelative_.
2230         (Target_i386::rel_irelative_section): New function.
2231         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2232         fields.  Don't define __rel_iplt_{start,end}.
2233         (Output_data_plt_i386::add_entry): Add symtab and layout
2234         parameters.  Change all callers.  Use different PLT and GOT for
2235         IFUNC symbols.
2236         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2237         layout parameters.  Change all callers.  Use different PLT and
2238         GOT.
2239         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2240         (Output_data_plt_i386::rel_irelative): New function.
2241         (Output_data_plt_i386::address_for_global): New function.
2242         (Output_data_plt_i386::address_for_local): New function.
2243         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2244         IRELATIVE GOT when changing IFUNC GOT entries.
2245         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2246         reloc.
2247         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2248         if we didn't create an IRELATIVE GOT.
2249         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2250         plt_address_for_local.
2251         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2252         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2253         got_irelative_, and irelative_count_ fields.  Update
2254         declarations.
2255         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2256         Initialize new fields.  Remove symtab parameter.  Change all
2257         callers.
2258         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2259         irelative_count_.
2260         (Output_data_plt_x86_64::has_irelative_section): New function.
2261         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2262         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2263         fields.  Update declarations.
2264         (Target_x86_64::Target_x86_64): Initialize new fields.
2265         (Target_x86_64::do_plt_address_for_global): New function replacing
2266         do_plt_section_for_global.
2267         (Target_x86_64::do_plt_address_for_local): New function replacing
2268         do_plt_section_for_local.
2269         (Target_x86_64::got_section): Create got_irelative_.
2270         (Target_x86_64::rela_irelative_section): New function.
2271         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2272         all callers.  Don't create __rel_iplt_{start,end}.
2273         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2274         parameters.  Change all callers.  Use different PLT and GOT for
2275         IFUNC symbols.
2276         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2277         layout parameters.  Change all callers.  Use different PLT and
2278         GOT.
2279         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2280         parameters.  Change all callers.  Use different PLT and GOT for
2281         IFUNC symbols.
2282         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2283         (Output_data_plt_x86_64::rela_irelative): New function.
2284         (Output_data_plt_x86_64::address_for_global): New function.
2285         (Output_data_plt_x86_64::address_for_local): New function.
2286         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2287         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2288         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2289         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2290         parameters.
2291         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2292         reloc.
2293         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2294         symbols if we didn't create an IRELATIVE GOT.
2295         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2296         plt_address_for_local.
2297         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2298         * testsuite/ifuncvar1.c: New test file.
2299         * testsuite/ifuncvar2.c: New test file.
2300         * testsuite/ifuncvar3.c: New test file.
2301         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2302         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2303         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2304         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2305         * testsuite/Makefile.in: Rebuild.
2306
2307 2011-07-07  Cary Coutant  <ccoutant@google.com>
2308
2309         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2310         (two_file_test_1_ndebug.o): Likewise.
2311         (two_file_test_1b_ndebug.o): Likewise.
2312         (two_file_test_2_ndebug.o): Likewise.
2313         (two_file_test_main_ndebug.o): Likewise.
2314         (incremental_test_2): Link with no-debug versions.
2315
2316 2011-07-06  Cary Coutant  <ccoutant@google.com>
2317
2318         * gold/incremental.cc
2319         (Output_section_incremental_inputs::write_info_blocks): Check for
2320         hidden and internal symbols.
2321
2322 2011-07-06  Cary Coutant  <ccoutant@google.com>
2323
2324         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2325         Check disposition for startup file.
2326         (Incremental_inputs::report_command_line): Ignore
2327         --incremental-startup-unchanged option.
2328         * options.cc (General_options::parse_incremental_startup_unchanged):
2329         New function.
2330         (General_options::General_options): Initialize new data member.
2331         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2332         (General_options): Add --incremental-startup-unchanged option.
2333         (General_options::incremental_startup_disposition): New function.
2334         (General_options::incremental_startup_disposition_): New data member.
2335
2336 2011-07-06  Cary Coutant  <ccoutant@google.com>
2337
2338         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2339         input file index to Script_info ctor.
2340         (Sized_incremental_binary::do_file_has_changed): Find the
2341         command-line argument for files named in scripts.
2342         * incremental.h (Script_info::Script_info): New ctor
2343         with input file index.
2344         (Script_info::input_file_index): New function.
2345         (Script_info::input_file_index_): New data member.
2346         (Incremental_binary::get_library): Add const.
2347         (Incremental_binary::get_script_info): Add const.
2348         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2349         * testsuite/Makefile.am (incremental_test_5): New test case.
2350         (incremental_test_6): New test case.
2351         * testsuite/Makefile.in: Regenerate.
2352
2353 2011-07-06  Cary Coutant  <ccoutant@google.com>
2354
2355         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2356         debug output when command lines differ.
2357
2358 2011-07-06  Cary Coutant  <ccoutant@google.com>
2359
2360         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2361         --incremental-patch option.
2362         * layout.cc (Free_list::allocate): Extend allocation beyond original
2363         end if enabled.
2364         (Layout::make_output_section): Mark sections that should get
2365         patch space.
2366         * options.cc (parse_percent): New function.
2367         * options.h (parse_percent): New function.
2368         (DEFINE_percent): New macro.
2369         (General_options): Add --incremental-patch option.
2370         * output.cc (Output_section::Output_section): Initialize new data
2371         members.
2372         (Output_section::add_input_section): Print section name when out
2373         of patch space.
2374         (Output_section::add_output_section_data): Likewise.
2375         (Output_section::set_final_data_size): Add patch space when
2376         doing --incremental-full.
2377         (Output_section::do_reset_address_and_file_offset): Remove patch
2378         space.
2379         (Output_segment::set_section_list_addresses): Print debug output
2380         only if --incremental-update.
2381         * output.h (Output_section::set_is_patch_space_allowed): New function.
2382         (Output_section::is_patch_space_allowed_): New data member.
2383         (Output_section::patch_space_): New data member.
2384         * parameters.cc (Parameters::incremental_full): New function.
2385         * parameters.h (Parameters::incremental_full): New function
2386         * testsuite/Makefile.am (incremental_test_2): Add test for
2387         --incremental-patch option.
2388         * testsuite/Makefile.in: Regenerate.
2389         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2390         (t18): Remove function body.
2391
2392 2011-07-05  Doug Kwan  <dougkwan@google.com>
2393
2394         PR gold/12771
2395         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2396         Arm_Address type for relocation result.
2397         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2398         overflow check.
2399         (Arm_relocate_functions::abs32): Use unaligned access.
2400         (Arm_relocate_functions::rel32): Ditto.
2401         (Arm_relocate_functions::prel31): Ditto.
2402         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2403         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2404         static data relocations.
2405         * testsuite/Makefile.in: Regnerate.
2406         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2407
2408 2011-07-05  Ian Lance Taylor  <iant@google.com>
2409
2410         PR gold/12392
2411         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2412         symbols if necessary.
2413         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2414
2415 2011-07-05  Ian Lance Taylor  <iant@google.com>
2416
2417         PR gold/12952
2418         * resolve.cc (Symbol::override_base_with_special): Simply override
2419         version with special symbol version, ignoring previous version.
2420
2421 2011-07-05  Ian Lance Taylor  <iant@google.com>
2422
2423         * object.cc (Sized_relobj_file::include_section_group): Add
2424         information to comment about signature location.
2425
2426 2011-07-02  Ian Lance Taylor  <iant@google.com>
2427
2428         PR gold/12957
2429         * options.h (class General_options): Add -f and -F.
2430         * options.cc (General_options::finalize): Fatal error if -f/-F
2431         are used without -shared.
2432         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2433
2434 2011-07-02  Ian Lance Taylor  <iant@google.com>
2435
2436         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2437
2438 2011-07-01  Ian Lance Taylor  <iant@google.com>
2439
2440         PR gold/12525
2441         PR gold/12952
2442         * resolve.cc (Symbol::override_base_with_special): Don't override
2443         the version if the overriding symbol has a different name.
2444         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2445         all callers.  If we give an error about an undefined version,
2446         define the base version if necessary.
2447         * dynobj.h (class Versions): Update declaration.
2448         * testsuite/weak_alias_test_5.cc: New file.
2449         * testsuite/weak_alias_test.script: New file.
2450         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2451         and versioned_alias have the right value, and call t2.
2452         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2453         weak_alias_test_5.so.
2454         (weak_alias_test_LDADD): Likewise.
2455         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2456         * testsuite/Makefile.in: Rebuild.
2457
2458 2011-07-01  Ian Lance Taylor  <iant@google.com>
2459
2460         PR gold/12525
2461         * options.h (class General_options): Support -z notext.
2462         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2463         -Wl,-z,notext.
2464         (two_file_shared_nonpic.so): Likewise.
2465         (two_file_shared_mixed.so): Likewise.
2466         (two_file_shared_mixed_1.so): Likewise.
2467         (weak_undef_lib_nonpic.so): Likewise.
2468         (alt/weak_undef_lib_nonpic.so): Likewise.
2469         (tls_test_shared_nonpic.so): Likewise.
2470         * testsuite/Makefile.in: Rebuild.
2471
2472 2011-07-01  Ian Lance Taylor  <iant@google.com>
2473
2474         PR gold/12525
2475         * configure.ac: Test whether static linking works, setting
2476         the automake conditional HAVE_STATIC.
2477         * testsuite/Makefile.am: Disable tests using -static if
2478         HAVE_STATIC is not true.
2479         * configure, testsuite/Makefile.in: Rebuild.
2480
2481 2011-07-01  Ian Lance Taylor  <iant@google.com>
2482
2483         PR gold/12525
2484         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2485         Assert if we see DW_EH_PE_indirect.
2486         * target.h (Target::ehframe_datarel_base): New function.
2487         (Target::do_ehframe_datarel_base): New target function.
2488         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2489         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2490         function.
2491
2492 2011-07-01  Ian Lance Taylor  <iant@google.com>
2493
2494         PR gold/12571
2495         * options.h (class General_options): Add
2496         --ld-generated-unwind-info.
2497         * ehframe.cc (Fde::write): Add address parameter.  Change all
2498         callers.  If associated with PLT, fill in address and size.
2499         (Cie::set_output_offset): Only add merge mapping if there is an
2500         object.
2501         (Cie::write): Add address parameter.  Change all callers.
2502         (Eh_frame::add_ehframe_for_plt): New function.
2503         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2504         input_offset_ fields into union u_, with new plt field.
2505         (Fde::Fde): Adjust for new union field.
2506         (Fde::Fde) [Output_data version]: New constructor.
2507         (Fde::add_mapping): Only add merge mapping if there is an object.
2508         (class Cie): Update declarations.
2509         (class Eh_frame): Declare add_ehframe_for_plt.
2510         * layout.cc (Layout::layout_eh_frame): Break out code into
2511         make_eh_frame_section, and call it.
2512         (Layout::make_eh_frame_section): New function.
2513         (Layout::add_eh_frame_for_plt): New function.
2514         * layout.h (class Layout): Update declarations.
2515         * merge.cc (Merge_map::add_mapping): Add assertion.
2516         * i386.cc: Include "dwarf.h".
2517         (class Output_data_plt_i386): Make first_plt_entry,
2518         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2519         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2520         and plt_eh_frame_fde.
2521         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2522         boundary.  Call add_eh_frame_for_plt if appropriate.
2523         * x86_64.cc: Include "dwarf.h".
2524         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2525         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2526         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2527         and plt_eh_frame_fde.
2528         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2529         appropriate.
2530
2531 2011-06-29  Ian Lance Taylor  <iant@google.com>
2532
2533         PR gold/12629
2534         * object.cc (Sized_relobj_file::layout_section): Change shdr
2535         parameter to be const.
2536         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2537         out of do_layout.
2538         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2539         appropriate.  Call layout_eh_frame_section.
2540         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2541         sections.
2542         * object.h (class Sized_relobj_file): Update declarations.
2543
2544 2011-06-29  Ian Lance Taylor  <iant@google.com>
2545
2546         PR gold/12652
2547         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2548         modifier.
2549         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2550
2551 2011-06-29  Ian Lance Taylor  <iant@google.com>
2552
2553         PR gold/12675
2554         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2555         SHT_X86_64_UNWIND.
2556         * layout.cc (Layout::layout_eh_frame): Likewise.
2557
2558 2011-06-29  Ian Lance Taylor  <iant@google.com>
2559
2560         PR gold/12695
2561         * layout.cc (Layout::symtab_section_shndx): New function.
2562         * layout.h (class Layout): Declare symtab_section_shndx.
2563         * output.cc (Output_section::write_header): Call it.
2564
2565 2011-06-29  Ian Lance Taylor  <iant@google.com>
2566
2567         PR gold/12818
2568         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2569         symbols which are not used in a relocation.
2570
2571 2011-06-28  Ian Lance Taylor  <iant@google.com>
2572
2573         PR gold/12898
2574         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2575         script create indistinguishable segments.
2576         (Layout::set_segment_offsets): Use stable_sort when sorting
2577         segments.  Pass this to Compare_segments constructor.
2578         * layout.h (class Layout): Make segment_precedes non-static.
2579         (class Compare_segments): Change from struct to class.  Add
2580         layout_ field.  Add constructor.
2581         * script-sections.cc
2582         (Script_sections::attach_sections_using_phdrs_clause): Rename
2583         local orphan to is_orphan.  Don't report failure to put empty
2584         section in segment.  On attachment failure, report name of
2585         section, and attach to first PT_LOAD segment.
2586
2587 2011-06-28  Ian Lance Taylor  <iant@google.com>
2588
2589         PR gold/12934
2590         * target-select.cc (Target_selector::Target_selector): Add
2591         emulation parameter.  Change all callers.
2592         (select_target_by_bfd_name): Rename from select_target_by_name.
2593         Change all callers.
2594         (select_target_by_emulation): New function.
2595         (supported_emulation_names): New function.
2596         * target-select.h (class Target_selector): Add emulation_ field.
2597         Update declarations.
2598         (Target_selector::recognize_by_bfd_name): Rename from
2599         recognize_by_name.  Change all callers.
2600         (Target_selector::supported_bfd_names): Rename from
2601         supported_names.  Change all callers.
2602         (Target_selector::recognize_by_emulation): New function.
2603         (Target_selector::supported_emulations): New function.
2604         (Target_selector::emulation): New function.
2605         (Target_selector::do_recognize_by_bfd_name): Rename from
2606         do_recognize_by_name.  Change all callers.
2607         (Target_selector::do_supported_bfd_names): Rename from
2608         do_supported_names.  Change all callers.
2609         (Target_selector::do_recognize_by_emulation): New function.
2610         (Target_selector::do_supported_emulations): New function.
2611         (select_target_by_bfd_name): Change name in declaration.
2612         (select_target_by_emulation): Declare.
2613         (supported_emulation_names): Declare.
2614         * parameters.cc (parameters_force_valid_target): Try to find
2615         target based on emulation from -m option.
2616         * options.h (class General_options): Change doc string for -m.
2617         * options.cc (help): Print emulations.
2618         (General_options::parse_V): Likewise.
2619         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2620         Add emulation parameter.  Change all callers.
2621
2622 2011-06-28  Ian Lance Taylor  <iant@google.com>
2623
2624         * target.h (class Target): Add osabi_ field.
2625         (Target::osabi): New function.
2626         (Target::set_osabi): New function.
2627         (Target::Target): Initialize osabi_.
2628         (Target::do_adjust_elf_header): Make pure virtual.
2629         (Sized_target::do_adjust_elf_header): Declare.
2630         * target.cc (Sized_target::do_adjust_elf_header): New function.
2631         (class Sized_target): Instantiate all versions.
2632         * freebsd.h (class Target_freebsd): Remove.
2633         (Target_selector_freebsd::do_recognize): Call set_osabi on
2634         Target.
2635         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2636         (Target_selector_freebsd::set_osabi): Remove.
2637         * i386.cc (class Target_i386): Inherit from Sized_target rather
2638         than Target_freebsd.
2639         * x86_64.cc (class Target_x86_64): Likewise.
2640
2641 2011-06-28  Ian Lance Taylor  <iant@google.com>
2642
2643         * target.h (Target::can_check_for_function_pointers): Rewrite.
2644         Make non-virtual.
2645         (Target::can_icf_inline_merge_sections): Likewise.
2646         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2647         (Target::Target_info): Add can_icf_inline_merge_sections field.
2648         (Target::do_can_check_for_function_pointers): New virtual
2649         function.
2650         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2651         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2652         from can_check_for_function_pointers, move in file.
2653         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2654         section_may_have_icf_unsafe_poineters, move in file.
2655         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2656         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2657         Rename from can_check_for_function_pointers, move in file.
2658         (Target_i386::can_icf_inline_merge_sections): Remove.
2659         (Target_i386::i386_info): Initialize
2660         can_icf_inline_merge_sections.
2661         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2662         Initialize can_icf_inline_merge_sections.
2663         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2664         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2665         Rename from can_check_for_function_pointers, move in file.
2666         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2667         (Target_x86_64::x86_64_info): Initialize
2668         can_icf_inline_merge_sections.
2669         * testsuite/testfile.cc (Target_test::test_target_info):
2670         Likewise.
2671         * icf.cc (get_section_contents): Correct formatting.
2672
2673 2011-06-27  Ian Lance Taylor  <iant@google.com>
2674
2675         * symtab.cc (Symbol::versioned_name): New function.
2676         (Symbol_table::add_to_final_symtab): Use versioned_name when
2677         appropriate.
2678         (Symbol_table::sized_write_symbol): Likewise.
2679         * symtab.h (class Symbol): Declare versioned_name.
2680         * stringpool.h (class Stringpool_template): Add variant of add
2681         which takes a std::basic_string.
2682         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2683         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2684         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2685         (ver_test_12.o): New target.
2686         * testsuite/Makefile.in: Rebuild.
2687
2688 2011-06-27  Doug Kwan  <dougkwan@google.com>
2689
2690         * arm.cc (Arm_relocate_functions::thm_jump8,
2691         Arm_relocate_functions::thm_jump11): Use a wider signed
2692         type to compute offset.
2693         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2694         arm_thm_jump8.
2695         * testsuite/Makefile.in: Regenerate.
2696         * testsuite/arm_branch_in_range.sh: Check test results of
2697         arm_thm_jump11 and arm_thm_jump8.
2698         * testsuite/arm_thm_jump11.s: New test source file.
2699         * testsuite/arm_thm_jump11.t: New linker script.
2700         * testsuite/arm_thm_jump8.s: New test source file.
2701         * testsuite/arm_thm_jump8.t: New linker script.
2702
2703 2011-06-24  Ian Lance Taylor  <iant@google.com>
2704
2705         * layout.cc: Include "object.h".
2706         (ctors_sections_in_init_array): New static variable.
2707         (Layout::is_ctors_in_init_array): New function.
2708         (Layout::layout): Add entry to ctors_sections_in_init_array if
2709         appropriate.
2710         * layout.h (class Layout): Declare is_ctors_in_init_array.
2711         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2712         is_ctors_reverse_view is set.
2713         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2714         all callers.  Set is_ctors_reverse_view field of View_size.
2715         (Sized_relobj_file::reverse_words): New function.
2716         * object.h (Sized_relobj_file::View_size): Add
2717         is_ctors_reverse_view field.
2718         (class Sized_relobj_file): Update declarations.
2719         * testsuite/initpri3.c: New test.
2720         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2721         initpri3b.
2722         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2723         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2724         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2725         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2726         * testsuite/Makefile.in: Rebuild.
2727
2728 2011-06-24  Cary Coutant  <ccoutant@google.com>
2729
2730         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2731         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2732         (debug_msg_cdebug.err): New targets.
2733         * testsuite/Makefile.in: Regenerate.
2734         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2735         Fix checks for link with shared library.
2736
2737 2011-06-24  Doug Kwan  <dougkwan@google.com>
2738
2739         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2740         skip empty text sections.
2741         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2742
2743 2011-06-22  Ian Lance Taylor  <iant@google.com>
2744
2745         PR gold/12910
2746         * options.h (class General_options): Add --ctors-in-init-array.
2747         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2748         friends as SHT_PROGBITS for merging sections.
2749         (Layout::layout): Remove special handling of .init_array and
2750         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2751         and .dtors if ctors_in_init_array.
2752         (Layout::make_output_section): Force correct section types for
2753         .init_array and friends.  Don't sort if doing relocatable link,
2754         Don't sort .ctors and .dtors if ctors_in_init_array.
2755         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2756         (Layout::output_section_name): Add relobj parameter.  Change all
2757         callers.  Handle .ctors. and .dtors. in code rather than table.
2758         Handle .ctors and .dtors if ctors_in_init_array.
2759         (Layout::match_file_name): New function, moved from output.cc.
2760         * layout.h (class Layout): Update declarations.
2761         * output.cc: Include "layout.h".
2762         (Input_section_sort_entry::get_priority): New function.
2763         (Input_section_sort_entry::match_file_name): Just call
2764         Layout::match_file_name.
2765         (Output_section::Input_section_sort_init_fini_compare::operator()):
2766         Handle .ctors and .dtors.  Sort by explicit priority rather than
2767         by name.
2768         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2769         * testsuite/initpri2.c: New test.
2770         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2771         (check_PROGRAMS): Add initpri2.
2772         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2773         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2774         * configure, testsuite/Makefile.in: Rebuild.
2775
2776 2011-06-19  Ian Lance Taylor  <iant@google.com>
2777
2778         PR gold/12880
2779         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2780         .interp section to a PT_INTERP segment even if we have seen a
2781         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2782         clause in a linker script.
2783         (Layout::finalize): Don't create a .interp section if we've
2784         already create a PT_INTERP segment.
2785         (Layout::create_interp): Always call choose_output_section (revert
2786         patch of 2011-06-17).  Don't create PT_INTERP segment.
2787         * script-sections.cc
2788         (Script_sections::create_note_and_tls_segments): Add a .interp
2789         section to a PT_INTERP segment even if we have seen a
2790         --dynamic-linker option.
2791
2792 2011-06-18  Ian Lance Taylor  <iant@google.com>
2793
2794         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2795         merely because a non-PT_LOAD segment has a dynamic reloc.
2796
2797 2011-06-18  Ian Lance Taylor  <iant@google.com>
2798
2799         * layout.cc (Layout::finish_dynamic_section): Don't create
2800         DT_FLAGS entry if not needed.
2801
2802 2011-06-18  Ian Lance Taylor  <iant@google.com>
2803
2804         PR gold/12745
2805         * layout.cc (Layout::layout_eh_frame): Correct handling of
2806         writable .eh_frame section.
2807
2808 2011-06-17  Ian Lance Taylor  <iant@google.com>
2809
2810         PR gold/12893
2811         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2812         symbol is redefined with the exact same object and value.
2813
2814 2011-06-17  Ian Lance Taylor  <iant@google.com>
2815
2816         PR gold/12880
2817         * layout.h (class Layout): Add interp_segment_ field.
2818         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2819         (Layout::attach_allocated_section_to_segment): If making shared
2820         library, put .interp section in PT_INTERP segment.
2821         (Layout::finalize): Also call create_interp if -dynamic-linker
2822         option was used.
2823         (Layout::create_interp): Assert that there is no PT_INTERP
2824         segment.  If not using a SECTIONS clause, use make_output_section.
2825         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2826         * script-sections.cc
2827         (Script_sections::create_note_and_tls_segments): If making shared
2828         library, put .interp section in PT_INTERP segment.
2829
2830 2011-06-17  Ian Lance Taylor  <iant@google.com>
2831
2832         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2833         when making a shared library.
2834
2835 2011-06-17  Ian Lance Taylor  <iant@google.com>
2836
2837         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2838         parameter.  Change all callers.  Don't issue warning about PC32
2839         against locally defined symbol.
2840
2841 2011-06-16  Ian Lance Taylor  <iant@google.com>
2842
2843         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2844         occurs in same object.
2845
2846 2011-06-14  Alan Modra  <amodra@gmail.com>
2847
2848         * po/POTFILES.in: Regenerate.
2849
2850 2011-06-09  Ian Lance Taylor  <iant@google.com>
2851
2852         * script-sections.cc
2853         (Orphan_output_section::set_section_addresses): For a relocatable
2854         link set address to 0.
2855
2856 2011-06-09  Cary Coutant  <ccoutant@google.com>
2857
2858         PR gold/12804
2859         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2860         used with --compress-debug-sections.
2861         * gold/object.cc (Sized_relobj_file::do_layout): Report
2862         uncompressed size of compressed input sections.
2863
2864 2011-06-08  Cary Coutant  <ccoutant@google.com>
2865
2866         PR gold/12804
2867         * testsuite/two_file_test_2_v1.cc: Change initialization of
2868         v2 to keep it in .data.
2869
2870 2011-06-07  Cary Coutant  <ccoutant@google.com>
2871
2872         * common.cc (Symbol_table::do_allocate_commons_list): Call
2873         gold_fallback.
2874         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2875         (Errors::fallback): New function.
2876         (gold_fallback): New function.
2877         * errors.h (Errors::fallback): New function.
2878         * gold.cc (gold_exit): Change status parameter to enum; adjust
2879         all callers.
2880         (queue_initial_tasks): Call gold_fallback.
2881         * gold.h: Include cstdlib.
2882         (Exit_status): New enum type.
2883         (gold_exit): Change status parameter to enum.
2884         (gold_fallback): New function.
2885         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2886         (Layout::create_symtab_sections): Likewise.
2887         (Layout::create_shdrs): Likewise.
2888         * main.cc (main): Adjust call to gold_exit.
2889         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2890         (Output_data_got::add_got_entry_pair): Likewise.
2891         (Output_section::add_input_section): Likewise.
2892         (Output_section::add_output_section_data): Likewise.
2893         (Output_segment::set_section_list_addresses): Likewise.
2894         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2895
2896 2011-06-07  Cary Coutant  <ccoutant@google.com>
2897
2898         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2899         for incremental links.
2900         * output.cc (Output_segment::set_section_list_addresses): Remove
2901         FIXME and test for TLS or BSS.
2902
2903 2011-06-07  Cary Coutant  <ccoutant@google.com>
2904
2905         * testsuite/Makefile.am: Add incremental_copy_test,
2906         incremental_common_test_1.
2907         * testsuite/Makefile.in: Regenerate.
2908         * testsuite/common_test_1_v1.c: New source file.
2909         * testsuite/common_test_1_v2.c: New source file.
2910         * testsuite/copy_test_v1.cc: New source file.
2911
2912 2011-06-07  Cary Coutant  <ccoutant@google.com>
2913
2914         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2915         update, allocate common from bss section's free list.
2916         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2917         linker-defined symbols.
2918         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2919         Skip GOT and PLT entries that are no longer referenced.
2920         (Output_section_incremental_inputs::write_info_blocks): Mark
2921         linker-defined symbols.
2922         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2923         * output.cc (Output_section::allocate): New function.
2924         * output.h (Output_section::allocate): New function.
2925         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2926         linker-defined symbols.
2927         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2928         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2929         (Symbol::init_base_output_data): Likewise.
2930         (Symbol::init_base_output_segment): Likewise.
2931         (Symbol::init_base_constant): Likewise.
2932         (Sized_symbol::init_output_data): Likewise.
2933         (Sized_symbol::init_output_segment): Likewise.
2934         (Sized_symbol::init_constant): Likewise.
2935         (Symbol_table::do_define_in_output_data): Likewise.
2936         (Symbol_table::do_define_in_output_segment): Likewise.
2937         (Symbol_table::do_define_as_constant): Likewise.
2938         * symtab.h (Symbol::is_predefined): New function.
2939         (Symbol::init_base_output_data): Add is_predefined parameter.
2940         (Symbol::init_base_output_segment): Likewise.
2941         (Symbol::init_base_constant): Likewise.
2942         (Symbol::is_predefined_): New data member.
2943         (Sized_symbol::init_output_data): Add is_predefined parameter.
2944         (Sized_symbol::init_output_segment): Likewise.
2945         (Sized_symbol::init_constant): Likewise.
2946         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2947
2948 2011-06-07  Cary Coutant  <ccoutant@google.com>
2949
2950         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2951         instead of emit_copy_reloc.
2952         (Copy_relocs::emit_copy_reloc): Refactor.
2953         (Copy_relocs::make_copy_reloc): New function.
2954         (Copy_relocs::add_copy_reloc): Remove.
2955         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2956         section.
2957         (Copy_relocs::make_copy_reloc): New function.
2958         (Copy_relocs::add_copy_reloc): Remove.
2959         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2960         unchanged input files.
2961         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2962         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2963         Reserve BSS space for COPY relocations.
2964         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2965         (Output_section_incremental_inputs::write_info_blocks): Record
2966         whether a symbol is copied from a shared object.
2967         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2968         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2969         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2970         (Incremental_input_entry_reader::get_output_symbol_index): Add
2971         is_copy parameter.
2972         (Incremental_binary::emit_copy_relocs): New function.
2973         (Incremental_binary::do_emit_copy_relocs): New function.
2974         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2975         new data member.
2976         (Sized_incremental_binary::add_copy_reloc): New function.
2977         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2978         (Sized_incremental_binary::Copy_reloc): New struct.
2979         (Sized_incremental_binary::Copy_relocs): New typedef.
2980         (Sized_incremental_binary::copy_relocs_): New data member.
2981         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2982         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2983         * target.h (Sized_target::emit_copy_reloc): New function.
2984         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2985
2986 2011-06-02  Cary Coutant  <ccoutant@google.com>
2987
2988         PR gold/12163
2989         * gold/archive.cc (Archive::Archive): Initialize new data member.
2990         (Archive::include_all_members): Return if archive has already been
2991         included.
2992         * gold/archive.h (Archive::include_all_members_): New data member.
2993
2994 2011-06-02  Nick Clifton  <nickc@redhat.com>
2995
2996         * dynobj.h: Fix spelling mistake in comment.
2997         * output.cc: Likewise.
2998
2999 2011-05-31  Doug Kwan  <dougkwan@google.com>
3000             Asier Llano
3001
3002         PR gold/12826
3003         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3004         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3005         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3006         redundant arm_exidx_test.so.
3007         * testsuite/Makefile.in: Regenerate.
3008         (check_SCRIPTS): Add pr12826.sh
3009         (check_DATA): Add pr12826.stdout
3010         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3011         * testsuite/pr12826.sh: New file.
3012         * testsuite/pr12826_1.s: Ditto.
3013         * testsuite/pr12826_1.s: Ditto.
3014
3015 2011-05-30  Ian Lance Taylor  <iant@google.com>
3016
3017         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3018         sections.
3019
3020 2011-05-29  Ian Lance Taylor  <iant@google.com>
3021
3022         PR gold/12804
3023         * testsuite/Makefile.am: Use different file name for two_file_test
3024         temporary file for each incremental test.
3025         * testsuite/Makefile.in: Rebuild.
3026
3027 2011-05-29  Ian Lance Taylor  <iant@google.com>
3028
3029         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3030         binary input file is empty.
3031
3032 2011-05-27  Ian Lance Taylor  <iant@google.com>
3033
3034         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3035         (ver_test_9.so): Likewise.
3036         * testsuite/Makefile.in: Rebuild.
3037
3038 2011-05-26 Cary Coutant  <ccoutant@google.com>
3039
3040         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3041         * incremental.cc (Incremental_inputs::report_input_section): Fix
3042         comment, indentation.
3043         (Incremental_inputs::report_comdat_group): New function.
3044         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3045         of data for incremental input file entry.
3046         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3047         group count, COMDAT group signatures.
3048         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3049         an unchanged input file.
3050         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3051         Initialize new data member.
3052         (Incremental_object_entry::add_comdat_group): New function.
3053         (Incremental_object_entry::get_comdat_group_count): New function.
3054         (Incremental_object_entry::get_comdat_signature_key): New function.
3055         (Incremental_object_entry::groups_): New data member.
3056         (Incremental_inputs::report_comdat_group): New function.
3057         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3058         data for incremental input file entry.
3059         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3060         (Incremental_input_entry_reader::get_input_section): Adjust size of
3061         data for incremental input file entry.
3062         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3063         (Incremental_input_entry_reader::get_comdat_group_signature): New
3064         function.
3065         * object.cc (Sized_relobj::include_section_group): Report kept
3066         COMDAT groups for incremental links.
3067
3068 2011-05-24  David Meyer  <pdox@google.com>
3069
3070         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3071         with name parameter.  Add found_name parameter.
3072         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3073         * dirsearch.h (class Dirsearch): Update declaration.
3074
3075 2011-05-24  Ian Lance Taylor  <iant@google.com>
3076
3077         * archive.cc (Library_base::should_include_member): Pull in object
3078         from archive if it defines the entry symbol.
3079         * parameters.cc (Parameters::entry): New function.
3080         * parameters.h (class Parameters): Declare entry.
3081         * output.h (class Output_file_header): Remove entry_ field.
3082         * output.cc (Output_file_header::Output_file_header): Remove entry
3083         parameter.  Change all callers.
3084         (Output_file_header::entry): Use parameters->entry.
3085         * gold.cc (queue_middle_tasks): Likewise.
3086         * plugin.cc (Plugin_hook::run): Likewise.
3087
3088 2011-05-24 Cary Coutant  <ccoutant@google.com>
3089
3090         * gold.cc (queue_initial_tasks): Pass incremental base filename
3091         to Output_file::open_base_file; don't print error message.
3092         * incremental-dump.cc (main): Adjust call to
3093         Output_file::open_for_modification.
3094         * incremental-dump.cc (main): Likewise.
3095         * incremental.cc (Incremental_inputs::report_command_line):
3096         Ignore --incremental-base option when comparing command lines.
3097         Ignore parameter when given as separate argument.
3098         * options.h (class General_options): Add --incremental-base.
3099         * output.cc (Output_file::Output_file):
3100         (Output_file::open_base_file): Add base_name and writable parameters;
3101         read base file into new file; print error message here.
3102         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3103         callers.
3104         * output.h (Output_file::open_for_modification): Rename to...
3105         (Output_file::open_base_file): ...this; add base_name and
3106         writable parameters; adjust all callers.
3107         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3108         callers.
3109         * testsuite/Makefile.am (incremental_test_4): Test
3110         --incremental-base.
3111         * testsuite/Makefile.in: Regenerate.
3112
3113 2011-05-24 Cary Coutant  <ccoutant@google.com>
3114
3115         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3116         incremental_test_4.
3117         * testsuite/Makefile.in: Regenerate.
3118         * testsuite/two_file_test_1_v1.cc: New test source file.
3119         * testsuite/two_file_test_1b_v1.cc: New test source file.
3120         * testsuite/two_file_test_2_v1.cc: New test source file.
3121
3122 2011-05-24 Cary Coutant  <ccoutant@google.com>
3123
3124         * dynobj.h (Dynobj::do_dynobj): New function.
3125         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3126         flag and soname for shared objects.
3127         * incremental.cc (Incremental_inputs::report_object): Make
3128         either Incremental_object_entry or Incremental_dynobj_entry; add
3129         soname to string table.
3130         (Incremental_inputs::report_input_section): Add assertion.
3131         (Output_section_incremental_inputs::set_final_data_size): Adjust
3132         type of input file entry for shared libraries; adjust size of
3133         shared library info entry.
3134         (Output_section_incremental_inputs::write_input_files): Write
3135         as_needed flag for shared libraries.
3136         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3137         of input file entry for shared libraries; write soname.
3138         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3139         soname from incremental info.
3140         * incremental.h (enum Incremental_input_flags): Add
3141         INCREMENTAL_INPUT_AS_NEEDED.
3142         (Incremental_input_entry::Incremental_input_entry): Initialize new
3143         data member.
3144         (Incremental_input_entry::set_as_needed): New function.
3145         (Incremental_input_entry::as_needed): New function.
3146         (Incremental_input_entry::do_dynobj_entry): New function.
3147         (Incremental_input_entry::as_needed_): New data member.
3148         (Incremental_object_entry::Incremental_object_entry): Don't check
3149         for shared library.
3150         (Incremental_object_entry::do_type): Likewise.
3151         (class Incremental_dynobj_entry): New class.
3152         (Incremental_input_entry_reader::as_needed): New function.
3153         (Incremental_input_entry_reader::get_soname): New function.
3154         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3155         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3156         size of shared library info entry.
3157         * layout.cc (Layout::finish_dynamic_section): Don't test for
3158         incremental link when adding DT_NEEDED entries.
3159         * object.h (Object::Object): Initialize new data member.
3160         (Object::dynobj): New function.
3161         (Object::set_as_needed): New function.
3162         (Object::as_needed): New function.
3163         (Object::do_dynobj): New function.
3164         (Object::as_needed_): New data member.
3165
3166 2011-05-24 Cary Coutant  <ccoutant@google.com>
3167
3168         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3169         info; adjust display of GOT entries.
3170         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3171         vector of input objects; remove file_status_.
3172         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3173         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3174         got_plt reader; call target hooks to reserve GOT entries.
3175         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3176         of input file info header and GOT info entry.
3177         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3178         relocation info.
3179         (Got_plt_view_info::got_descriptor): Remove.
3180         (Got_plt_view_info::sym_index): New data member.
3181         (Got_plt_view_info::input_index): New data member.
3182         (Local_got_offset_visitor::visit): Write input file index.
3183         (Global_got_offset_visitor::visit): Write 0 for input file index.
3184         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3185         with sym_index and input_index.
3186         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3187         incremental info GOT entry; replace got_descriptor with input_index.
3188         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3189         map from input file index to object.
3190         (Sized_relobj_incr::do_layout): Replace direct data member reference
3191         with accessor function.
3192         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3193         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3194         Adjust size of input file info header.
3195         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3196         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3197         (Incremental_input_entry_reader::get_input_section): Adjust size of
3198         input file info header.
3199         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3200         of incremental info GOT entry.
3201         (Incremental_got_plt_reader::get_got_desc): Remove.
3202         (Incremental_got_plt_reader::get_got_symndx): New function.
3203         (Incremental_got_plt_reader::get_got_input_index): New function.
3204         (Sized_incremental_binary::Sized_incremental_binary): Remove
3205         file_status_; add input_objects_.
3206         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3207         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3208         (Sized_incremental_binary::file_is_unchanged): Remove.
3209         (Sized_incremental_binary::set_input_object): New function.
3210         (Sized_incremental_binary::input_object): New function.
3211         (Sized_incremental_binary::file_status_): Remove.
3212         (Sized_incremental_binary::input_objects_): New data member.
3213         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3214         references.
3215         (Sized_relobj_incr::invalid_address): Move to base class.
3216         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3217         class.
3218         (Sized_relobj_incr::do_output_section_offset): Likewise.
3219         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3220         (Sized_relobj_incr::section_offsets_): Likewise.
3221         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3222         function.
3223         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3224         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3225         with accessor function.
3226         (Sized_relobj_file::do_layout): Likewise.
3227         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3228         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3229         (Sized_relobj_file::compute_final_local_value): Replace refs to
3230         section_offsets_ with accessor function.
3231         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3232         * object.h (Relobj::Relobj): Initialize new data members.
3233         (Relobj::add_dyn_reloc): New function.
3234         (Relobj::first_dyn_reloc): New function.
3235         (Relobj::dyn_reloc_count): New function.
3236         (Relobj::first_dyn_reloc_): New data member.
3237         (Relobj::dyn_reloc_count_): New data member.
3238         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3239         references.
3240         (Sized_relobj::Address): New typedef.
3241         (Sized_relobj::invalid_address): Move here from child class.
3242         (Sized_relobj::Sized_relobj): Initialize new data members.
3243         (Sized_relobj::sized_relobj): New function.
3244         (Sized_relobj::is_output_section_offset_invalid): Move here from
3245         child class.
3246         (Sized_relobj::get_output_section_offset): Likewise.
3247         (Sized_relobj::local_has_got_offset): Likewise.
3248         (Sized_relobj::local_got_offset): Likewise.
3249         (Sized_relobj::set_local_got_offset): Likewise.
3250         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3251         (Sized_relobj::clear_got_offsets): New function.
3252         (Sized_relobj::section_offsets): Move here from child class.
3253         (Sized_relobj::do_output_section_offset): Likewise.
3254         (Sized_relobj::do_set_section_offset): Likewise.
3255         (Sized_relobj::Local_got_offsets): Likewise.
3256         (Sized_relobj::local_got_offsets_): Likewise.
3257         (Sized_relobj::section_offsets_): Likewise.
3258         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3259         references.
3260         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3261         class.
3262         (Sized_relobj_file::sized_relobj): New function
3263         (Sized_relobj_file::local_has_got_offset): Move to base class.
3264         (Sized_relobj_file::local_got_offset): Likewise.
3265         (Sized_relobj_file::set_local_got_offset): Likewise.
3266         (Sized_relobj_file::get_output_section_offset): Likewise.
3267         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3268         (Sized_relobj_file::do_output_section_offset): Likewise.
3269         (Sized_relobj_file::do_set_section_offset): Likewise.
3270         (Sized_relobj_file::Local_got_offsets): Likewise.
3271         (Sized_relobj_file::local_got_offsets_): Likewise.
3272         (Sized_relobj_file::section_offsets_): Likewise.
3273         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3274         (all constructors).
3275         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3276         (Output_reloc::get_symbol_index): Likewise.
3277         (Output_reloc::local_section_offset): Likewise.
3278         (Output_reloc::get_address): Likewise.
3279         (Output_reloc::symbol_value): Likewise.
3280         (Output_data_got::reserve_slot): Move to class definition.
3281         (Output_data_got::reserve_local): New function.
3282         (Output_data_got::reserve_slot_for_global): Remove.
3283         (Output_data_got::reserve_global): New function.
3284         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3285         (all constructors, two instantiations).
3286         (Output_reloc::get_relobj): New function (two instantiations).
3287         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3288         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3289         (Output_data_reloc::add_global): Adjust type of relobj.
3290         (Output_data_reloc::add_global_relative): Likewise.
3291         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3292         (Output_data_reloc::add_local): Likewise.
3293         (Output_data_reloc::add_local_relative): Likewise.
3294         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3295         (Output_data_reloc::add_local_section): Likewise.
3296         (Output_data_reloc::add_output_section): Likewise.
3297         (Output_data_reloc::add_absolute): Likewise.
3298         (Output_data_reloc::add_target_specific): Likewise.
3299         (Output_data_got::reserve_slot): Move definition here.
3300         (Output_data_got::reserve_local): New function.
3301         (Output_data_got::reserve_global): New function.
3302         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3303         section_offsets_ with accessor function.
3304         (Sized_relobj_file::write_sections): Likewise.
3305         (Sized_relobj_file::do_relocate_sections): Likewise.
3306         * target.h (Sized_target::reserve_local_got_entry): New function.
3307         (Sized_target::reserve_global_got_entry): New function.
3308         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3309         (Target_x86_64::reserve_global_got_entry): New function.
3310         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3311
3312 2011-05-23 Cary Coutant  <ccoutant@google.com>
3313
3314         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3315         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3316         bit when checking got_type.
3317         * incremental.cc (Sized_incremental_binary::setup_readers):
3318         Store symbol table and string table locations; initialize bit vector
3319         of file status flags.
3320         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3321         unchanged files.
3322         (Sized_incremental_binary::do_process_got_plt): New function.
3323         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3324         (Output_section_incremental_inputs::set_final_data_size): Record
3325         file index for each input file.
3326         (Output_section_incremental_inputs::write_got_plt): Store file index
3327         instead of input entry offset for each GOT entry.
3328         * incremental.h
3329         (Incremental_input_entry::Incremental_input_entry): Initialize new
3330         data member.
3331         (Incremental_input_entry::set_offset): Store file index.
3332         (Incremental_input_entry::get_file_index): New function.
3333         (Incremental_input_entry::file_index_): New data member.
3334         (Incremental_binary::process_got_plt): New function.
3335         (Incremental_binary::do_process_got_plt): New function.
3336         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3337         data members.
3338         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3339         (Sized_incremental_binary::set_file_is_unchanged): New function.
3340         (Sized_incremental_binary::file_is_unchanged): New function.
3341         (Sized_incremental_binary::do_process_got_plt): New function.
3342         (Sized_incremental_binary::file_status_): New data member.
3343         (Sized_incremental_binary::main_symtab_loc_): New data member.
3344         (Sized_incremental_binary::main_strtab_loc_): New data member.
3345         * output.cc (Output_data_got::Got_entry::write): Add case
3346         RESERVED_CODE.
3347         (Output_data_got::add_global): Call add_got_entry.
3348         (Output_data_got::add_global_plt): Likewise.
3349         (Output_data_got::add_global_with_rel): Likewise.
3350         (Output_data_got::add_global_with_rela): Likewise.
3351         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3352         (Output_data_got::add_global_pair_with_rela): Likewise.
3353         (Output_data_got::add_local): Call add_got_entry.
3354         (Output_data_got::add_local_plt): Likewise.
3355         (Output_data_got::add_local_with_rel): Likewise.
3356         (Output_data_got::add_local_with_rela): Likewise.
3357         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3358         (Output_data_got::add_local_pair_with_rela): Likewise.
3359         (Output_data_got::reserve_slot): New function.
3360         (Output_data_got::reserve_slot_for_global): New function.
3361         (Output_data_got::add_got_entry): New function.
3362         (Output_data_got::add_got_entry_pair): New function.
3363         (Output_section::add_output_section_data): Edit FIXME.
3364         * output.h
3365         (Output_section_data_build::Output_section_data_build): New
3366         constructor with size parameter.
3367         (Output_data_space::Output_data_space): Likewise.
3368         (Output_data_got::Output_data_got): Initialize new data member; new
3369         constructor with size parameter.
3370         (Output_data_got::add_constant): Call add_got_entry.
3371         (Output_data_got::reserve_slot): New function.
3372         (Output_data_got::reserve_slot_for_global): New function.
3373         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3374         (Output_data_got::add_got_entry): New function.
3375         (Output_data_got::add_got_entry_pair): New function.
3376         (Output_data_got::free_list_): New data member.
3377         * target.h (Sized_target::init_got_plt_for_update): New function.
3378         (Sized_target::register_global_plt_entry): New function.
3379         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3380         Initialize new data member; call init; add constructor with PLT count.
3381         (Output_data_plt_x86_64::init): New function.
3382         (Output_data_plt_x86_64::add_relocation): New function.
3383         (Output_data_plt_x86_64::reserve_slot): New function.
3384         (Output_data_plt_x86_64::free_list_): New data member.
3385         (Target_x86_64::init_got_plt_for_update): New function.
3386         (Target_x86_64::register_global_plt_entry): New function.
3387         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3388         incremental updates.
3389         (Output_data_plt_x86_64::add_relocation): New function.
3390         * testsuite/object_unittest.cc (Object_test): Set default options.
3391
3392 2011-05-16  Ian Lance Taylor  <iant@google.com>
3393
3394         * options.h (class General_options): Make -i a synonym for -r.
3395
3396 2011-05-16  Ian Lance Taylor  <iant@google.com>
3397
3398         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3399
3400 2011-05-10 Cary Coutant  <ccoutant@google.com>
3401
3402         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3403         strip_all (-s).
3404
3405 2011-05-06  Ian Lance Taylor  <iant@google.com>
3406
3407         * layout.cc (Layout::layout): If the output section flags change,
3408         update the ordering.
3409
3410 2011-04-25 Cary Coutant  <ccoutant@google.com>
3411
3412         * incremental-dump.cc (dump_incremental_inputs): Print local
3413         symbol info for each input file.
3414         * incremental.cc
3415         (Output_section_incremental_inputs::set_final_data_size): Add local
3416         symbol info to input file entries in incremental info.
3417         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3418         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3419         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3420         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3421         implementation.
3422         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3423         (Sized_incr_relobj::do_relocate): Write the local symbols.
3424         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3425         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3426         Adjust size of input file header.
3427         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3428         (Incremental_inputs_reader::get_local_symbol_count): New function.
3429         (Incremental_inputs_reader::get_input_section): Adjust size of input
3430         file header.
3431         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3432         (Sized_incr_relobj::This): New typedef.
3433         (Sized_incr_relobj::sym_size): New const data member.
3434         (Sized_incr_relobj::Local_symbol): New struct.
3435         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3436         (Sized_incr_relobj::do_local_symbol_offset): New function.
3437         (Sized_incr_relobj::local_symbol_count_): New data member.
3438         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3439         (Sized_incr_relobj::local_symbol_index_): New data member.
3440         (Sized_incr_relobj::local_symbol_offset_): New data member.
3441         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3442         (Sized_incr_relobj::local_symbols_): New data member.
3443         * object.h (Relobj::output_local_symbol_count): New function.
3444         (Relobj::local_symbol_offset): New function.
3445         (Relobj::do_output_local_symbol_count): New function.
3446         (Relobj::do_local_symbol_offset): New function.
3447         (Sized_relobj::do_output_local_symbol_count): New function.
3448         (Sized_relobj::do_local_symbol_offset): New function.
3449
3450 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3451
3452         * descriptors.cc (set_close_on_exec): New function.
3453         (Descriptors::open): Use set_close_on_exec.
3454         * output.cc (S_ISLNK): Define if not defined.
3455
3456 2011-04-22 Cary Coutant  <ccoutant@google.com>
3457
3458         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3459         global symbol map.
3460         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3461         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3462         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3463         relocations.
3464         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3465         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3466         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3467         * incremental.h
3468         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3469         function.
3470         (Incremental_binary::apply_incremental_relocs): New function.
3471         (Incremental_binary::do_apply_incremental_relocs): New function.
3472         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3473         data member.
3474         (Sized_incremental_binary::add_global_symbol): New function.
3475         (Sized_incremental_binary::global_symbol): New function.
3476         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3477         (Sized_incremental_binary::symbol_map_): New data member.
3478         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3479         * target.h (Sized_target::apply_relocation): New function.
3480         * target-reloc.h (apply_relocation): New function.
3481         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3482
3483 2011-04-22  Doug Kwan  <dougkwan@google.com>
3484
3485         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3486         flag of a SHT_ARM_EXIDX section.
3487         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3488         * testsuite/Makefile.in: Regenerate.
3489         * testsuite/arm_exidx_test.s: New file.
3490         * testsuite/arm_exidx_test.sh: Same.
3491
3492 2011-04-20 Cary Coutant  <ccoutant@google.com>
3493
3494         PR gold/12689
3495         * archive.h (Incremental_archive_entry::Archive_member):
3496         Initialize arg_serial_ (second constructor).
3497
3498 2011-04-17  Ian Lance Taylor  <iant@google.com>
3499
3500         * object.cc (Relocate_info::location): Simplify location string.
3501         * errors.cc (Errors::error_at_location): Don't print program
3502         name.
3503         (Errors::warning_at_location): Likewise.
3504         (Errors::undefined_symbol): Likewise.
3505         * testsuite/debug_msg.sh: Update accordingly.
3506
3507 2011-04-14 Cary Coutant  <ccoutant@google.com>
3508
3509         * gold/layout.cc (Layout::symtab_section_offset): New function.
3510         * gold/layout.h (Layout::symtab_section_offset): New function.
3511         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3512
3513 2011-04-12  Ian Lance Taylor  <iant@google.com>
3514
3515         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3516         with MREMAP_MAYMOVE.
3517         * output.h (class Output_file): Add map_is_allocated_ field.
3518         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3519         not available, provide stubs.  If mremap is not available, #define
3520         it to gold_mremap.
3521         (MREMAP_MAYMOVE): Define if not defined.
3522         (Output_file::Output_file): Initialize map_is_allocated_.
3523         (Output_file::resize): Check map_is_allocated_.
3524         (Output_file::map_anonymous): If mmap fails, use malloc.
3525         (Output_file::unmap): Don't do anything for an anonymous map.
3526         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3527         is not available, provide stubs.
3528         (File_read::View::~View): Use free rather than delete[].
3529         (File_read::make_view): Use malloc rather than new[].  If mmap
3530         fails, use malloc.
3531         (File_read::find_or_make_view): Use malloc rather than new[].
3532         * gold.h: Remove HAVE_REMAP code.
3533         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3534         exists.  Rename mremap to gold_mremap.  If mmap is not available
3535         don't do anything.
3536         * configure, config.in: Rebuild.
3537
3538 2011-04-11  Ian Lance Taylor  <iant@google.com>
3539
3540         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3541         initialize local variable v.
3542
3543 2011-04-11  Cary Coutant  <ccoutant@google.com>
3544
3545         * archive.cc (Archive::include_member): Adjust call to
3546         report_object.
3547         (Add_archive_symbols::run): Track argument serial numbers.
3548         (Lib_group::include_member): Likewise.
3549         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3550         * archive.h (Incremental_archive_entry::Archive_member):
3551         Initialize arg_serial_.
3552         (Archive_member::arg_serial_): New data member.
3553         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3554         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3555         incremental link.
3556         (Sized_dynobj::do_for_all_local_got_entries): New function.
3557         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3558         function.
3559         * fileread.cc (get_mtime): New function.
3560         * fileread.h (get_mtime): New function.
3561         * gold.cc (queue_initial_tasks): Check for incremental update.
3562         (process_incremental_input): New function.
3563         (queue_middle_tasks): Don't force valid target for incremental
3564         update.
3565         * incremental-dump.cc (find_input_containing_global): Adjust
3566         size of symbol info entry.
3567         (dump_incremental_inputs): Dump argument serial number and
3568         in_system_directory flag; bias shndx by 1; print symbol names
3569         when dumping per-file symbol lists; use new symbol info readers.
3570         * incremental.cc
3571         (Output_section_incremental_inputs:update_data_size): New function.
3572         (Sized_incremental_binary::setup_readers): Setup input readers
3573         for each input file; build maps for files added from libraries
3574         and scripts.
3575         (Sized_incremental_binary::check_input_args): New function.
3576         (Sized_incremental_binary::do_check_inputs): Build map of argument
3577         serial numbers to input arguments.
3578         (Sized_incremental_binary::do_file_has_changed): Rename
3579         do_file_is_unchanged to this; compare file modification times.
3580         (Sized_incremental_binary::do_init_layout): New function.
3581         (Sized_incremental_binary::do_reserve_layout): New function.
3582         (Sized_incremental_binary::do_get_input_reader): Remove.
3583         (Sized_incremental_binary::get_symtab_view): New function.
3584         (Incremental_checker::can_incrementally_link_output_file): Remove.
3585         (Incremental_inputs::report_command_line): Exclude --debug options.
3586         (Incremental_inputs::report_archive_begin): Add parameter; track
3587         argument serial numbers; don't put input file entry for archive
3588         before archive members.
3589         (Incremental_inputs::report_archive_end): Put input file entry
3590         for archive after archive members.
3591         (Incremental_inputs::report_object): Add parameter; track argument
3592         serial numbers and in_system_directory flag.
3593         (Incremental_inputs::report_script): Add parameter; track argument
3594         serial numbers.
3595         (Output_section_incremental_inputs::set_final_data_size): Adjust
3596         size of symbol info entry; check for forwarding symbols.
3597         (Output_section_incremental_inputs::write_input_files): Write
3598         in_system_directory flag and argument serial number.
3599         (Output_section_incremental_inputs::write_info_blocks): Map section
3600         indices between incremental info and original input file; store
3601         input section index for each symbol.
3602         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3603         change operator() to visit().
3604         (class Global_got_offset_visitor): Likewise.
3605         (class Global_symbol_visitor_got_plt):
3606         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3607         classes.
3608         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3609         (Sized_incr_relobj::do_read_symbols): New function.
3610         (Sized_incr_relobj::do_layout): New function.
3611         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3612         (Sized_incr_relobj::do_add_symbols): New function.
3613         (Sized_incr_relobj::do_should_include_member): New function.
3614         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3615         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3616         (Sized_incr_relobj::do_section_size): New function.
3617         (Sized_incr_relobj::do_section_name): New function.
3618         (Sized_incr_relobj::do_section_contents): New function.
3619         (Sized_incr_relobj::do_section_flags): New function.
3620         (Sized_incr_relobj::do_section_entsize): New function.
3621         (Sized_incr_relobj::do_section_address): New function.
3622         (Sized_incr_relobj::do_section_type): New function.
3623         (Sized_incr_relobj::do_section_link): New function.
3624         (Sized_incr_relobj::do_section_info): New function.
3625         (Sized_incr_relobj::do_section_addralign): New function.
3626         (Sized_incr_relobj::do_initialize_xindex): New function.
3627         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3628         (Sized_incr_relobj::do_read_relocs): New function.
3629         (Sized_incr_relobj::do_gc_process_relocs): New function.
3630         (Sized_incr_relobj::do_scan_relocs): New function.
3631         (Sized_incr_relobj::do_count_local_symbols): New function.
3632         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3633         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3634         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3635         (Sized_incr_relobj::do_relocate): New function.
3636         (Sized_incr_relobj::do_set_section_offset): New function.
3637         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3638         (Sized_incr_dynobj::do_read_symbols): New function.
3639         (Sized_incr_dynobj::do_layout): New function.
3640         (Sized_incr_dynobj::do_add_symbols): New function.
3641         (Sized_incr_dynobj::do_should_include_member): New function.
3642         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3643         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3644         (Sized_incr_dynobj::do_section_size): New function.
3645         (Sized_incr_dynobj::do_section_name): New function.
3646         (Sized_incr_dynobj::do_section_contents): New function.
3647         (Sized_incr_dynobj::do_section_flags): New function.
3648         (Sized_incr_dynobj::do_section_entsize): New function.
3649         (Sized_incr_dynobj::do_section_address): New function.
3650         (Sized_incr_dynobj::do_section_type): New function.
3651         (Sized_incr_dynobj::do_section_link): New function.
3652         (Sized_incr_dynobj::do_section_info): New function.
3653         (Sized_incr_dynobj::do_section_addralign): New function.
3654         (Sized_incr_dynobj::do_initialize_xindex): New function.
3655         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3656         (make_sized_incremental_object): New function.
3657         (Incremental_library::copy_unused_symbols): New function.
3658         (Incremental_library::do_for_all_unused_symbols): New function.
3659         * incremental.h (enum Incremental_input_flags): New type.
3660         (class Incremental_checker): Remove.
3661         (Incremental_input_entry::Incremental_input_entry): Add argument
3662         serial number.
3663         (Incremental_input_entry::arg_serial): New function.
3664         (Incremental_input_entry::set_is_in_system_directory): New function.
3665         (Incremental_input_entry::is_in_system_directory): New function.
3666         (Incremental_input_entry::arg_serial_): New data member.
3667         (Incremental_input_entry::is_in_system_directory_): New data member.
3668         (class Script_info): Move here from script.h.
3669         (Script_info::Script_info): Add filename parameter.
3670         (Script_info::filename): New function.
3671         (Script_info::filename_): New data member.
3672         (Incremental_script_entry::Incremental_script_entry): Add argument
3673         serial number.
3674         (Incremental_object_entry::Incremental_object_entry): Likewise.
3675         (Incremental_object_entry::add_input_section): Build list of input
3676         sections with map to original shndx.
3677         (Incremental_object_entry::get_input_section_index): New function.
3678         (Incremental_object_entry::shndx_): New data member.
3679         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3680         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3681         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3682         serial number.
3683         (Incremental_inputs::report_archive_begin): Likewise.
3684         (Incremental_inputs::report_object): Likewise.
3685         (Incremental_inputs::report_script): Likewise.
3686         (class Incremental_global_symbol_reader): New class.
3687         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3688         and store flags and input file type.
3689         (Incremental_input_entry_reader::arg_serial): New function.
3690         (Incremental_input_entry_reader::type): Extract type from flags.
3691         (Incremental_input_entry_reader::is_in_system_directory): New function.
3692         (Incremental_input_entry_reader::get_input_section_count): Call
3693         accessor function for type.
3694         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3695         function for type; adjust size of global symbol entry.
3696         (Incremental_input_entry_reader::get_global_symbol_count): Call
3697         accessor function for type.
3698         (Incremental_input_entry_reader::get_object_count): Likewise.
3699         (Incremental_input_entry_reader::get_object_offset): Likewise.
3700         (Incremental_input_entry_reader::get_member_count): Likewise.
3701         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3702         (Incremental_input_entry_reader::get_member_offset): Likewise.
3703         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3704         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3705         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3706         (Incremental_input_entry_reader::get_global_symbol_reader): New
3707         function.
3708         (Incremental_input_entry_reader::get_output_symbol_index): New
3709         function.
3710         (Incremental_input_entry_reader::type_): Remove.
3711         (Incremental_input_entry_reader::flags_): New data member.
3712         (Incremental_inputs_reader::input_file_offset): New function.
3713         (Incremental_inputs_reader::input_file_index): New function.
3714         (Incremental_inputs_reader::input_file): Call input_file_offset.
3715         (Incremental_inputs_reader::input_file_at_offset): New function.
3716         (Incremental_relocs_reader::get_r_type): Reformat.
3717         (Incremental_relocs_reader::get_r_shndx): Reformat.
3718         (Incremental_relocs_reader::get_r_offset): Reformat.
3719         (Incremental_relocs_reader::data): New function.
3720         (Incremental_binary::Incremental_binary): Initialize new data members.
3721         (Incremental_binary::check_inputs): Add cmdline parameter.
3722         (Incremental_binary::file_is_unchanged): Remove.
3723         (Input_reader::arg_serial): New function.
3724         (Input_reader::get_unused_symbol_count): New function.
3725         (Input_reader::get_unused_symbol): New function.
3726         (Input_reader::do_arg_serial): New function.
3727         (Input_reader::do_get_unused_symbol_count): New function.
3728         (Input_reader::do_get_unused_symbol): New function.
3729         (Incremental_binary::input_file_count): New function.
3730         (Incremental_binary::get_input_reader): Change signature to use
3731         index instead of filename.
3732         (Incremental_binary::file_has_changed): New function.
3733         (Incremental_binary::get_input_argument): New function.
3734         (Incremental_binary::get_library): New function.
3735         (Incremental_binary::get_script_info): New function.
3736         (Incremental_binary::init_layout): New function.
3737         (Incremental_binary::reserve_layout): New function.
3738         (Incremental_binary::output_file): New function.
3739         (Incremental_binary::do_check_inputs): New function.
3740         (Incremental_binary::do_file_is_unchanged): Remove.
3741         (Incremental_binary::do_file_has_changed): New function.
3742         (Incremental_binary::do_init_layout): New function.
3743         (Incremental_binary::do_reserve_layout): New function.
3744         (Incremental_binary::do_input_file_count): New function.
3745         (Incremental_binary::do_get_input_reader): Change signature.
3746         (Incremental_binary::input_args_map_): New data member.
3747         (Incremental_binary::library_map_): New data member.
3748         (Incremental_binary::script_map_): New data member.
3749         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3750         new data members.
3751         (Sized_incremental_binary::output_section): New function.
3752         (Sized_incremental_binary::inputs_reader): Add const.
3753         (Sized_incremental_binary::symtab_reader): Add const.
3754         (Sized_incremental_binary::relocs_reader): Add const.
3755         (Sized_incremental_binary::got_plt_reader): Add const.
3756         (Sized_incremental_binary::get_symtab_view): New function.
3757         (Sized_incremental_binary::Inputs_reader): New typedef.
3758         (Sized_incremental_binary::Input_entry_reader): New typedef.
3759         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3760         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3761         (Sized_incremental_binary::do_file_has_changed): New function.
3762         (Sized_incremental_binary::do_init_layout): New function.
3763         (Sized_incremental_binary::do_reserve_layout): New function.
3764         (Sized_input_reader::Inputs_reader): Remove.
3765         (Sized_input_reader::Input_entry_reader): Remove.
3766         (Sized_input_reader::do_arg_serial): New function.
3767         (Sized_input_reader::do_get_unused_symbol_count): New function.
3768         (Sized_input_reader::do_get_unused_symbol): New function.
3769         (Sized_incremental_binary::do_input_file_count): New function.
3770         (Sized_incremental_binary::do_get_input_reader): Change signature;
3771         use index instead of filename.
3772         (Sized_incremental_binary::section_map_): New data member.
3773         (Sized_incremental_binary::input_entry_readers_): New data member.
3774         (class Sized_incr_relobj): New class.
3775         (class Sized_incr_dynobj): New class.
3776         (make_sized_incremental_object): New function.
3777         (class Incremental_library): New class.
3778         * layout.cc (Free_list::num_lists): New static data member.
3779         (Free_list::num_nodes): New static data member.
3780         (Free_list::num_removes): New static data member.
3781         (Free_list::num_remove_visits): New static data member.
3782         (Free_list::num_allocates): New static data member.
3783         (Free_list::num_allocate_visits): New static data member.
3784         (Free_list::init): New function.
3785         (Free_list::remove): New function.
3786         (Free_list::allocate): New function.
3787         (Free_list::dump): New function.
3788         (Free_list::print_stats): New function.
3789         (Layout_task_runner::run): Resize output file for incremental updates.
3790         (Layout::Layout): Initialize new data members.
3791         (Layout::set_incremental_base): New function.
3792         (Layout::init_fixed_output_section): New function.
3793         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3794         incremental updates.
3795         (Layout::create_gold_note): Do not create gold note section for
3796         incremental updates.
3797         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3798         for incremental updates.
3799         (Layout::set_section_offsets): For incremental updates, allocate space
3800         from free list.
3801         (Layout::create_symtab_sections): Layout with offsets relative to
3802         start of section; for incremental updates, allocate space from free
3803         list.
3804         (Layout::create_shdrs): For incremental updates, allocate space from
3805         free list.
3806         (Layout::finish_dynamic_section): For incremental updates, do not
3807         check --as-needed (fixed in subsequent patch).
3808         * layout.h (class Free_list): New class.
3809         (Layout::set_incremental_base): New function.
3810         (Layout::incremental_base): New function.
3811         (Layout::init_fixed_output_section): New function.
3812         (Layout::allocate): New function.
3813         (Layout::incremental_base_): New data member.
3814         (Layout::free_list_): New data member.
3815         * main.cc (main): Print Free_list statistics.
3816         * object.cc (Relobj::finalize_incremental_relocs): Add
3817         clear_counts parameter; clear counts only when clear_counts is set.
3818         (Sized_relobj::Sized_relobj): Initialize new base class.
3819         (Sized_relobj::do_layout): Don't report special sections.
3820         (Sized_relobj::do_for_all_local_got_entries): New function.
3821         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3822         symtab_off to all symbol table offsets.
3823         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3824         * object.h (class Got_offset_list): Move to top of file.
3825         (Object::Object): Allow case where input_file == NULL.
3826         (Object::~Object): Likewise.
3827         (Object::input_file): Assert that input_file != NULL.
3828         (Object::lock): Allow case where input_file == NULL.
3829         (Object::unlock): Likewise.
3830         (Object::is_locked): Likewise.
3831         (Object::token): Likewise.
3832         (Object::release): Likewise.
3833         (Object::is_incremental): New function.
3834         (Object::get_mtime): New function.
3835         (Object::for_all_local_got_entries): New function.
3836         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3837         (Object::set_is_in_system_directory): New function.
3838         (Object::is_in_system_directory): New function.
3839         (Object::do_is_incremental): New function.
3840         (Object::do_get_mtime): New function.
3841         (Object::do_for_all_local_got_entries): New function.
3842         (Object::is_in_system_directory_): New data member.
3843         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3844         (class Sized_relobj_base): New class.
3845         (class Sized_relobj): Derive from Sized_relobj_base.
3846         (class Sized_relobj::Symbols): Redeclare from base class.
3847         (class Sized_relobj::local_got_offset_list): Remove.
3848         (class Sized_relobj::Output_sections): Redeclare from base class.
3849         (class Sized_relobj::do_for_all_local_got_entries): New function.
3850         (class Sized_relobj::write_local_symbols): Add offset parameter.
3851         (class Sized_relobj::local_symbol_offset_): Update comment.
3852         (class Sized_relobj::local_dynsym_offset_): Update comment.
3853         * options.cc (Input_arguments::add_file): Remove const.
3854         * options.h (Input_file_argument::Input_file_argument):
3855         Initialize arg_serial_ (all constructors).
3856         (Input_file_argument::set_arg_serial): New function.
3857         (Input_file_argument::arg_serial): New function.
3858         (Input_file_argument::arg_serial_): New data member.
3859         (Input_arguments::Input_arguments): Initialize file_count_.
3860         (Input_arguments::add_file): Remove const.
3861         (Input_arguments::number_of_input_files): New function.
3862         (Input_arguments::file_count_): New data member.
3863         (Command_line::number_of_input_files): Call
3864         Input_arguments::number_of_input_files.
3865         * output.cc (Output_segment_headers::Output_segment_headers):
3866         Set current size.
3867         (Output_section::Input_section::current_data_size): New function.
3868         (Output_section::Output_section): Initialize new data members.
3869         (Output_section::add_input_section): Don't do merge sections for
3870         an incremental link; allocate space from free list for an
3871         incremental update.
3872         (Output_section::add_output_section_data): Allocate space from
3873         free list for an incremental update.
3874         (Output_section::update_data_size): New function.
3875         (Output_section::set_fixed_layout): New function.
3876         (Output_section::reserve): New function.
3877         (Output_segment::set_section_addresses): Remove const.
3878         (Output_segment::set_section_list_addresses): Remove const; allocate
3879         space from free list for an incremental update.
3880         (Output_segment::set_offset): Adjust size of RELRO segment for an
3881         incremental update.
3882         * output.h (Output_data::current_data_size): Move here from
3883         child classes.
3884         (Output_data::pre_finalize_data_size): New function.
3885         (Output_data::update_data_size): New function.
3886         (Output_section_headers::update_data_size): new function.
3887         (Output_section_data_build::current_data_size): Move to Output_data.
3888         (Output_data_strtab::update_data_size): New function.
3889         (Output_section::current_data_size): Move to Output_data.
3890         (Output_section::set_fixed_layout): New function.
3891         (Output_section::has_fixed_layout): New function.
3892         (Output_section::reserve): New function.
3893         (Output_section::update_data_size): New function.
3894         (Output_section::has_fixed_layout_): New data member.
3895         (Output_section::free_list_): New data member.
3896         (Output_segment::set_section_addresses): Remove const.
3897         (Output_segment::set_section_list_addresses): Remove const.
3898         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3899         New function.
3900         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3901         New function.
3902         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3903         parameter when calling Add_symbols constructor; store argument
3904         serial number for members of a lib group.
3905         (Add_symbols::locks): Allow case where token == NULL.
3906         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3907         (Read_member::~Read_member): New function.
3908         (Read_member::is_runnable): New function.
3909         (Read_member::locks): New function.
3910         (Read_member::run): New function.
3911         (Check_script::~Check_script): New function.
3912         (Check_script::is_runnable): New function.
3913         (Check_script::locks): New function.
3914         (Check_script::run): New function.
3915         (Check_library::~Check_library): New function.
3916         (Check_library::is_runnable): New function.
3917         (Check_library::locks): New function.
3918         (Check_library::run): New function.
3919         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3920         (Add_symbols::library_): New data member.
3921         (class Read_member): New class.
3922         (class Check_script): New class.
3923         (class Check_library): New class.
3924         * reloc.cc (Read_relocs::is_runnable): Allow case where
3925         token == NULL.
3926         (Read_relocs::locks): Likewise.
3927         (Scan_relocs::locks): Likewise.
3928         (Relocate_task::locks): Likewise.
3929         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3930         to clear counters.
3931         (Sized_relobj::incremental_relocs_scan): Fix comment.
3932         (Sized_relobj::do_relocate): Pass output file offset to
3933         write_local_symbols.
3934         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3935         from class declaration.
3936         * script.cc (read_input_script): Allocate Script_info; pass
3937         argument serial number to report_script.
3938         * script.h (class Script_info): Move to incremental.h.
3939         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3940         * symtab.h (Symbol_table::add_from_incrobj): New function.
3941         (Symbol_table::set_file_offset): New function.
3942
3943 2011-04-05  Cary Coutant  <ccoutant@google.com>
3944
3945         * incremental-dump.cc (dump_incremental_inputs): Change signature
3946         to take a Sized_incremental_binary; change caller.  Use readers
3947         in Sized_incremental_binary.
3948         * incremental.cc
3949         (Sized_incremental_binary::find_incremental_inputs_sections):
3950         Rename do_find_incremental_inputs_sections to this.
3951         (Sized_incremental_binary::setup_readers): New function.
3952         (Sized_incremental_binary::do_check_inputs): Check
3953         has_incremental_info_ flag; move setup code to setup_readers;
3954         use input readers.
3955         (Sized_incremental_binary::do_file_is_unchanged): New function.
3956         (Sized_incremental_binary::do_get_input_reader): New function.
3957         * incremental.h (class Incremental_binary): Move to end of file.
3958         (Incremental_binary::file_is_unchanged): New function.
3959         (Incremental_binary::do_file_is_unchanged): New function.
3960         (Incremental_binary::Input_reader): New class.
3961         (Incremental_binary::get_input_reader): New function.
3962         (class Sized_incremental_binary): Move to end of file.
3963         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3964         input section reader classes.
3965         (Sized_incremental_binary::has_incremental_info): New function.
3966         (Sized_incremental_binary::inputs_reader): New function.
3967         (Sized_incremental_binary::symtab_reader): New function.
3968         (Sized_incremental_binary::relocs_reader): New function.
3969         (Sized_incremental_binary::got_plt_reader): New function.
3970         (Sized_incremental_binary::do_file_is_unchanged): New function.
3971         (Sized_incremental_binary::Sized_input_reader): New class.
3972         (Sized_incremental_binary::get_input_reader): New function.
3973         (Sized_incremental_binary::find_incremental_inputs_sections):
3974         Rename do_find_incremental_inputs_sections to this.
3975         (Sized_incremental_binary::setup_readers): New function.
3976         (Sized_incremental_binary::has_incremental_info_): New data member.
3977         (Sized_incremental_binary::inputs_reader_): New data member.
3978         (Sized_incremental_binary::symtab_reader_): New data member.
3979         (Sized_incremental_binary::relocs_reader_): New data member.
3980         (Sized_incremental_binary::got_plt_reader_): New data member.
3981         (Sized_incremental_binary::current_input_file_): New data member.
3982
3983 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3984
3985         PR gold/12640
3986         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3987         violation.
3988
3989 2011-03-30  Cary Coutant  <ccoutant@google.com>
3990
3991         * archive.cc (Archive::include_member): Adjust call to report_object.
3992         (Add_archive_symbols::run): Add script_info to call to
3993         report_archive_begin.
3994         (Lib_group::include_member): Adjust call to report_object.
3995         (Add_lib_group_symbols::run): Adjust call to report_object.
3996         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3997         blocks.  Add object count for script input files.
3998         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3999         script_info parameter; change all callers.
4000         (Incremental_inputs::report_object): Add script_info parameter;
4001         change all callers.
4002         (Incremental_inputs::report_script): Store backpointer to
4003         incremental info entry.
4004         (Output_section_incremental_inputs::set_final_data_size): Record
4005         additional information for scripts.
4006         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4007         * incremental.h (Incremental_script_entry::add_object): New function.
4008         (Incremental_script_entry::get_object_count): New function.
4009         (Incremental_script_entry::get_object): New function.
4010         (Incremental_script_entry::objects_): New data member; adjust
4011         constructor.
4012         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4013         (Incremental_inputs::report_object): Add script_info parameter.
4014         (Incremental_inputs_reader::get_object_count): New function.
4015         (Incremental_inputs_reader::get_object_offset): New function.
4016         * options.cc (Input_arguments::add_file): Return reference to
4017         new input argument.
4018         * options.h (Input_argument::set_script_info): New function.
4019         (Input_argument::script_info): New function.
4020         (Input_argument::script_info_): New data member; adjust all
4021         constructors.
4022         (Input_file_group::add_file): Return reference to new input argument.
4023         (Input_file_lib::add_file): Likewise.
4024         (Input_arguments::add_file): Likewise.
4025         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4026         * script.cc (Parser_closure::Parser_closure): Add script_info
4027         parameter; adjust all callers.
4028         (Parser_closure::script_info): New function.
4029         (Parser_closure::script_info_): New data member.
4030         (read_input_script): Report scripts earlier to incremental info.
4031         (script_add_file): Set script_info in Input_argument.
4032         (script_add_library): Likewise.
4033         * script.h (Script_options::Script_info): Rewrite class.
4034
4035 2011-03-29  Cary Coutant  <ccoutant@google.com>
4036
4037         * archive.cc (Library_base::should_include_member): Move
4038         method here from class Archive.
4039         (Archive::Archive): Initialize base class.
4040         (Archive::should_include_member): Move to base class.
4041         (Archive::do_for_all_unused_symbols): New function.
4042         (Add_archive_symbols::run): Remove redundant access to
4043         incremental_inputs.
4044         (Lib_group::Lib_group): Initialize base class.
4045         (Lib_group::do_filename): New function.
4046         (Lib_group::include_member): Pass pointer to Lib_group to
4047         report_object.
4048         (Lib_group::do_for_all_unused_symbols): New function.
4049         (Add_lib_group_symbols::run): Report archive information for
4050         incremental links.
4051         * archive.h (class Library_base): New base class.
4052         (class Archive): Derive from Library_base.
4053         (Archive::filename): Move to base class.
4054         (Archive::set_incremental_info): Likewise.
4055         (Archive::incremental_info): Likewise.
4056         (Archive::Should_include): Likewise.
4057         (Archive::should_include_member): Likewise.
4058         (Archive::Armap_entry): Remove.
4059         (Archive::Unused_symbol_iterator): Remove.
4060         (Archive::unused_symbols_begin): Remove.
4061         (Archive::unused_symbols_end): Remove.
4062         (Archive::do_filename): New function.
4063         (Archive::do_get_mtime): New function.
4064         (Archive::do_for_all_unused_symbols): New function.
4065         (Archive::task_): Move to base class.
4066         (Archive::incremental_info_): Likewise.
4067         (class Lib_group): Derive from Library_base.
4068         (Lib_group::do_filename): New function.
4069         (Lib_group::do_get_mtime): New function.
4070         (Lib_group::do_for_all_unused_symbols): New function.
4071         (Lib_group::task_): Move to base class.
4072         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4073         function.
4074         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4075         function.
4076         * incremental.cc (Incremental_inputs::report_archive_begin):
4077         Use Library_base; call library's get_mtime; add incremental inputs
4078         entry before members.
4079         (class Unused_symbol_visitor): New class.
4080         (Incremental_inputs::report_archive_end): Use Library_base; use
4081         visitor class to record unused symbols; don't add incremental inputs
4082         entry after members.
4083         (Incremental_inputs::report_object): Use Library_base.
4084         * incremental.h
4085         (Incremental_archive_entry::Incremental_archive_entry): Remove
4086         unused Archive parameter.
4087         (Incremental_inputs::report_archive_begin): Use Library_base.
4088         (Incremental_inputs::report_archive_end): Likewise.
4089         (Incremental_inputs::report_object): Likewise.
4090         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4091         function.
4092         * object.h (Object::for_all_global_symbols): New function.
4093         (Object::do_for_all_global_symbols): New function.
4094         (Sized_relobj::do_for_all_global_symbols): New function.
4095         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4096         function.
4097         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4098         function.
4099
4100 2011-03-27  Ian Lance Taylor  <iant@google.com>
4101
4102         * archive.cc (Archive::interpret_header): Return -1 if something
4103         goes wrong.  Change callers accordingly.
4104
4105 2011-03-25  Cary Coutant  <ccoutant@google.com>
4106
4107         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4108         * testsuite/Makefile.in: Regenerate.
4109
4110 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4111
4112         * plugin.cc (get_view): New.
4113         (Plugin::load): Pass get_view to the plugin.
4114         (Plugin_manager::get_view): New.
4115
4116 2011-03-21  Ian Lance Taylor  <iant@google.com>
4117
4118         * testsuite/final_layout.sh: Rewrite to not use dc.
4119         * testsuite/relro_test.sh: Fail if dc is not present.
4120
4121 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4122
4123         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4124         Change == to -eq.
4125         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4126         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4127         Change == to -eq.
4128         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4129         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4130
4131 2011-03-14  Ian Lance Taylor  <iant@google.com>
4132
4133         * script-sections.cc (Sort_output_sections::script_compare):
4134         Rename from is_before, change return type.
4135         (Sort_output_sections::operator()): Adjust accordingly.
4136
4137 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4138
4139         PR gold/12572
4140         * testsuite/odr_violation2.cc: Add comment to make all error line
4141         numbers double digits.
4142         * testsuite/debug_msg.sh: Adjust expected errors.
4143
4144 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4145
4146         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4147         but mark earlier ones as non-canonical
4148         (offset_to_iterator): Update search target and example
4149         (do_addr2line): Return extra lines in a vector*
4150         (format_file_lineno): Extract from do_addr2line
4151         (one_addr2line): Add vector* out-param
4152         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4153         when a lineno entry appeared last for its instruction
4154         (Dwarf_line_info): Add vector* out-param
4155         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4156         * symtab.cc (Odr_violation_compare): Include the lineno in the
4157         comparison again.
4158         (linenos_from_loc): New. Combine the canonical line for an
4159         address with its other lines.
4160         (True_if_intersect): New. Helper functor to make
4161         std::set_intersection a query.
4162         (detect_odr_violations): Compare sets of lines instead of just
4163         one line for each function. This became less deterministic, but
4164         has fewer false positives.
4165         * symtab.h: Declarations.
4166         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4167         mix an optimized and non-optimized object in the same binary
4168         (odr_violation2.so): Same.
4169         * testsuite/Makefile.in: Regenerate from Makefile.am.
4170         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4171         * testsuite/debug_msg.sh: Update line numbers and add
4172         assertions.
4173         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4174         non-optimized context.
4175         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4176         isn't inlined, and use OdrDerived in an optimized context.
4177         * testsuite/odr_header1.h: Defines OdrDerived, where
4178         optimization will change the
4179         first-instruction-in-the-destructor's file and line number.
4180         * testsuite/odr_header2.h: Defines OdrBase.
4181
4182 2011-03-09  Ian Lance Taylor  <iant@google.com>
4183
4184         * fileread.cc (File_read::clear_views): Don't delete the whole
4185         file view.
4186
4187 2011-03-08  Ian Lance Taylor  <iant@google.com>
4188
4189         PR gold/12525
4190         * fileread.cc: #include <climits>.
4191         (GOLD_IOV_MAX): Define.
4192         (File_read::read_multiple): Limit number of entries by iov_max.
4193         * fileread.h (class File_read): Always set max_readv_entries to
4194         128.
4195
4196 2011-03-07  Ian Lance Taylor  <iant@google.com>
4197
4198         PR gold/12525
4199         * options.h (class General_options): Add -dy and -dn.
4200
4201 2011-03-02  Cary Coutant  <ccoutant@google.com>
4202
4203         * testsuite/script_test_9.t: Add TLS segment.
4204
4205 2011-03-02  Simon Baldwin  <simonb@google.com>
4206
4207         * configure.ac: Add check for gnu_indirect_function support in
4208         the toolchain building binutils.
4209         * configure: Rebuild.
4210
4211 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4212
4213         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4214         plugin only symbols.
4215         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4216         in plugin files as not needed in the symbol table.
4217
4218 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4219
4220         * output.cc (Output_section::add_input_section): Delay fill
4221         generation for section ordering.
4222
4223 2011-02-09  Ian Lance Taylor  <iant@google.com>
4224
4225         PR gold/12316
4226         * object.h (class Sized_relobj): Remove clear_local_symbols.
4227         * reloc.cc (Sized_relobj::do_relocate): Don't call
4228         clear_local_symbols.
4229
4230 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4231
4232         * plugin.cc (is_visible_from_outside): Return true for symbols
4233         in the -u option.
4234
4235 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4236
4237         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4238         filename.
4239
4240 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4241
4242         * icf.h (is_section_foldable_candidate): Change type of parameter
4243         to std::string.
4244         * icf.cc (Icf::find_identical_sections): Change type of local variable
4245         section_name to be std::string.
4246         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4247
4248 2011-01-25  Ian Lance Taylor  <iant@google.com>
4249
4250         * script.cc (script_add_extern): Rewrite to use
4251         add_symbol_reference.
4252
4253 2011-01-25  Doug Kwan  <dougkwan@google.com>
4254
4255         * icf.cc (get_section_contents): Always lock section's object.
4256
4257 2011-01-24  Ian Lance Taylor  <iant@google.com>
4258
4259         * options.h (class General_options): Accept
4260         --no-detect-odr-violations.
4261
4262 2011-01-24  Ian Lance Taylor  <iant@google.com>
4263
4264         * version.cc (version_string): Bump to 1.11.
4265
4266 2011-01-24  Ian Lance Taylor  <iant@google.com>
4267
4268         * plugin.cc (class Plugin_rescan): Define new class.
4269         (Plugin_manager::claim_file): Set any_claimed_.
4270         (Plugin_manager::save_archive): New function.
4271         (Plugin_manager::save_input_group): New function.
4272         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4273         necessary.
4274         (Plugin_manager::new_undefined_symbol): New function.
4275         (Plugin_manager::rescan): New function.
4276         (Plugin_manager::rescannable_defines): New function.
4277         (Plugin_manager::add_input_file): Set any_added_.
4278         * plugin.h (class Plugin_manager): define new fields rescannable_,
4279         undefined_symbols_, any_claimed_, and any_added_.  Declare
4280         Plugin_rescan as friend.  Declare new functions.
4281         (Plugin_manager::Rescannable): Define type.
4282         (Plugin_manager::Rescannable_list): Define type.
4283         (Plugin_manager::Undefined_symbol_list): Define type.
4284         (Plugin_manager::Plugin_manager): Initialize new fields.
4285         * archive.cc (Archive::defines_symbol): New function.
4286         (Add_archive_symbols::run): Pass archive to plugins if any.
4287         * archive.h (class Archive): Declare defines_symbol.
4288         * readsyms.cc (Input_group::~Input_group): New function.
4289         (Finish_group::run): Pass input_group to plugins if any.
4290         * readsyms.h (class Input_group): Declare destructor.
4291         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4292         any.
4293
4294 2011-01-10  Ian Lance Taylor  <iant@google.com>
4295
4296         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4297         section as relro.
4298         (Layout::set_segment_offsets): Reset increase_relro before calling
4299         set_section_addresses a second time.
4300
4301 2011-01-04  Cary Coutant  <ccoutant@google.com>
4302
4303         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4304         sections before NOBITS sections.
4305
4306 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4307
4308         * version.cc (print_version): Update copyright to 2011.
4309
4310 2010-12-23  Cary Coutant  <ccoutant@google.com>
4311
4312         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4313         of OS to this->add.  Add OD parameter to second form of the function.
4314
4315 2010-12-20  Ian Lance Taylor  <iant@google.com>
4316
4317         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4318         second of two consecutive entries with same offset.
4319
4320 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4321
4322         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4323         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4324         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4325         to avoid unneeded links against $(LDADD).
4326         * testsuite/Makefile.in: Regenerate.
4327
4328 2010-12-15  Ian Lance Taylor  <iant@google.com>
4329
4330         PR gold/12324
4331         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4332         for R_X86_64_32 and R_X86_64_PC32.
4333         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4334         ver_matching_def_pic.o.
4335         (ver_matching_def_pic.o): New target.
4336
4337 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4338
4339         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4340         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4341         Move definition before File_read::View member definitions.
4342         (File_read::View::~View): Initialize and hold lock before
4343         updating current_mapped_bytes.
4344
4345 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4346
4347         * dwarf_reader.cc: Remove outdated comment.
4348         * gold-threads.cc: Fix typo in error message.
4349         * archive.cc: Fix typos in comments.
4350         * archive.h: Likewise.
4351         * arm-reloc-property.cc: Likewise.
4352         * arm-reloc-property.h: Likewise.
4353         * arm-reloc.def: Likewise.
4354         * arm.cc: Likewise.
4355         * attributes.h: Likewise.
4356         * cref.cc: Likewise.
4357         * ehframe.cc: Likewise.
4358         * fileread.h: Likewise.
4359         * gold.h: Likewise.
4360         * i386.cc: Likewise.
4361         * icf.cc: Likewise.
4362         * incremental.h: Likewise.
4363         * int_encoding.cc: Likewise.
4364         * layout.h: Likewise.
4365         * main.cc: Likewise.
4366         * merge.h: Likewise.
4367         * object.cc: Likewise.
4368         * object.h: Likewise.
4369         * options.cc: Likewise.
4370         * readsyms.cc: Likewise.
4371         * reduced_debug_output.cc: Likewise.
4372         * reloc.cc: Likewise.
4373         * script-sections.cc: Likewise.
4374         * sparc.cc: Likewise.
4375         * symtab.h: Likewise.
4376         * target-reloc.h: Likewise.
4377         * target.cc: Likewise.
4378         * target.h: Likewise.
4379         * timer.cc: Likewise.
4380         * timer.h: Likewise.
4381         * x86_64.cc: Likewise.
4382
4383 2010-12-09  Cary Coutant  <ccoutant@google.com>
4384
4385         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4386         stack.
4387         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4388         parameter; change all callers.
4389         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4390         * options.h (warn_execstack): New option.
4391
4392 2010-12-07  Doug Kwan  <dougkwan@google.com>
4393
4394         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4395         like function call relocations.
4396
4397 2010-12-07  Ian Lance Taylor  <iant@google.com>
4398
4399         * archive.cc (Archive::get_elf_object_for_member): Permit
4400         punconfigured to be NULL.
4401         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4402         (Archive::include_member): Pass NULL to get_elf_object_for_member
4403         if we searched for the archive and this is the first included
4404         object.
4405
4406 2010-12-01  Ian Lance Taylor  <iant@google.com>
4407
4408         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4409         track_relocs_type_ field.
4410         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4411         Set track_relocs_type_.
4412         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4413         contents when using RELA relocs.
4414         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4415         reloc_map_.
4416         * reloc.cc (Track_relocs::next_addend): New function.
4417         * reloc.h (class Track_relocs): Declare next_addend.
4418
4419 2010-12-01  Ian Lance Taylor  <iant@google.com>
4420
4421         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4422         virtual destructor.
4423
4424 2010-12-01  Ian Lance Taylor  <iant@google.com>
4425
4426         * README: Update compilers known to work and fail.
4427
4428 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4429
4430         * configure.in: For --enable-gold, handle value `default' instead of
4431         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4432         not the default.
4433         * configure: Regenerate.
4434
4435 2010-11-18  Doug Kwan  <dougkwan@google.com>
4436
4437         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4438         and right_alignment to be zero.  Store result alignment only if it is
4439         greater than existing alignment.
4440
4441 2010-11-16  Cary Coutant  <ccoutant@google.com>
4442
4443         PR gold/12220
4444         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4445         Check for ".zdebug_line".
4446
4447 2010-11-16  Doug Kwan  <dougkwan@google.com>
4448             Cary Coutant  <ccoutant@google.com>
4449
4450         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4451         by reference; adjust all callers.
4452         * output.cc (Output_segment::set_section_addresses): Adjust references
4453         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4454         list is empty.
4455         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4456         end at page boundary.
4457
4458 2010-11-16  Cary Coutant  <ccoutant@google.com>
4459
4460         PR gold/12220
4461         * layout.cc (Layout::choose_output_section): Transform names of
4462         compressed sections even when using a script with a SECTIONS clause.
4463         (Layout::output_section_name): Remove code to transform
4464         compressed debug section names.
4465         * output.cc (Output_section::add_input_section): Use uncompressed
4466         section size when tracking input sections.
4467
4468 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4469
4470         * symtab.h (Symbol::NON_PIC_REF): Remove.
4471         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4472         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4473         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4474         (Symbol::use_plt_offset): Take a flags argument and pass it
4475         directly to needs_dynamic_reloc.  Restrict check for undefined
4476         weak symbols to function calls.
4477         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4478         (Target_arm::Scan::global): Use it.
4479         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4480         (Target_arm::Relocate::relocate): Likewise.
4481         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4482         parameter with an r_type parameter.  Use get_reference_flags
4483         to get the flags.
4484         (Target_arm::Relocate::relocate): Update accordingly.
4485         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4486         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4487         (Target_i386::Scan::global): Likewise.
4488         (Target_i386::Relocate::relocate): Likewise.
4489         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4490         parameter with an r_type parameter.  Use get_reference_flags
4491         to get the flags.
4492         (Target_i386::Relocate::relocate): Update accordingly.
4493         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4494         (Target_powerpc::Scan::global): Use it.
4495         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4496         (Target_powerpc::Relocate::relocate): Likewise.
4497         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4498         (Target_sparc::Scan::global): Use it.
4499         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4500         (Target_sparc::Relocate::relocate): Likewise.
4501         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4502         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4503         (Target_x86_64::Scan::global): Likewise.
4504         (Target_x86_64::Relocate::relocate): Likewise.
4505
4506 2010-11-08  Doug Kwan  <dougkwan@google.com>
4507             Cary Coutant  <ccoutant@google.com>
4508
4509         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4510         (Arm_exidx_merge_section::section_contents_): New data member.
4511         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4512         (Arm_input_section::~Arm_input_section): De-allocate memory.
4513         (Arm_input_section::original_contents_): New data member.
4514         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4515         in parameters instead of calling Object::section_contents without
4516         locking.
4517         (Arm_output_section::group_section): New parameter TASK.  Pass it
4518         to callees that need locking objects.
4519         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4520         to lock EXIDX input sections.  Fix a formatting issue.  Call
4521         Arm_exidx_merged_section::build_contents to create merged section
4522         contents.
4523         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4524         to lock object of stub table owner.
4525         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4526         TEXT_SIZE to initialize data member TEXT_SIZE_.
4527         (Arm_exidx_input_section::addralign): Fix typo in comment.
4528         (Arm_exidx_input_section::text_size): New method.
4529         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4530         that require locking objects.  Lock objects before scanning for stubs
4531         and updating local symbols.
4532         (Arm_input_section<big_endian>::init): Copy contents of original
4533         input section.
4534         (Arm_input_section<big_endian>::do_write): Use saved contents of
4535         original input section instead of calling Object::section_contents
4536         without locking.
4537         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4538         size without calling Object::section_size().
4539         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4540         for size.  Allocate a buffer for merged EXIDX entries.
4541         (Arm_exidx_merged_section::build_contents): New method.
4542         (Arm_exidx_merged_section::do_write): Move merge section contents
4543         building code to Arm_exidx_merged_section::build_contetns.  Write
4544         out contetns in buffer instead of building it on the fly.
4545         (Arm_relobj::make_exidx_input_section): Also pass text section size
4546         to Arm_exidx_input_section constructor.
4547         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4548         (Arm_dynobj::do_read_symbols): Fix memory leak.
4549         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4550         * target.h: (class Task): Add forward declaration.
4551         (Target::relax): Add new parameter TASK and pass it to
4552         Target::do_relax().
4553         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4554
4555 2010-11-05  Cary Coutant  <ccoutant@google.com>
4556
4557         PR gold/10708
4558         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4559         object when reading from the file.
4560         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4561         second layout pass.
4562         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4563         when reading section contents.
4564         (get_section_contents): Likewise.
4565         (icf::find_identical_sections): Likewise.
4566         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4567         object when reading from the file.
4568         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4569         the object when doing deferred section layout.
4570
4571 2010-11-03  Nick Clifton  <nickc@redhat.com>
4572
4573         PR gold/12001
4574         * script.h (class Symbol_assignment: name): New member.  Returns
4575         the name of the symbol.
4576         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4577         Returns true if the given symbol name is on the list of
4578         assignments wating to be processed.
4579         * archive.cc (should_incldue_member): If the symbol is undefined,
4580         check to see if it is on the list of symbols pending assignment.
4581
4582 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4583
4584         * script-sections.cc (Script_sections::find_memory_region): Check
4585         for a NULL output section pointer.
4586
4587 2010-10-29  Doug Kwan  <dougkwan@google.com>
4588
4589         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4590         Output_section::add_relaxed_input_section.
4591         * output.cc (Output_section::add_relaxed_input_section): Add new
4592         arguments LAYOUT and NAME.  Set section order index.
4593         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4594         Copy section order index.
4595         * output.h (Output_section::add_relaxed_input_section): Add new
4596         arguments LAYOUT and NAME.
4597
4598 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4599
4600         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4601         NATIVE_OR_CROSS_LINKER.
4602         * testsuite/Makefile.in: Regenerate.
4603
4604 2010-10-20  Doug Kwan  <dougkwan@google.com>
4605
4606         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4607         without SHF_LINK_ORDER flags.
4608         * layout.cc (Layout::choose_output_section): Do not filter
4609         SHF_LINK_ORDER flag in a relocatable link.
4610
4611 2010-10-17  Cary Coutant  <ccoutant@google.com>
4612
4613         * output.h (Output_segment::set_section_addresses): Change function
4614         signature.  Update all callers.
4615         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4616         sections.
4617         (Output_segment::set_section_addresses): Align after last TLS
4618         section.  Add padding before last relro section instead of after.
4619
4620 2010-10-17  Doug Kwan  <dougkwan@google.com>
4621
4622         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4623         GOT output section to be writable.
4624
4625 2010-10-14  Cary Coutant  <ccoutant@google.com>
4626
4627         * debug.h (DEBUG_INCREMENTAL): New flag.
4628         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4629         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4630         mode.
4631         * incremental.cc (report_command_line): Ignore all forms of
4632         --incremental.
4633         * layout.cc (Layout::Layout): Check parameters for incremental link
4634         mode.
4635         * options.cc (General_options::parse_incremental): New function.
4636         (General_options::parse_no_incremental): New function.
4637         (General_options::parse_incremental_full): New function.
4638         (General_options::parse_incremental_update): New function.
4639         (General_options::incremental_mode_): New data member.
4640         (General_options::finalize): Check incremental_mode_.
4641         * options.h (General_options): Update help text for --incremental.
4642         Add --no-incremental, --incremental-full, --incremental-update.
4643         (General_options::Incremental_mode): New enum type.
4644         (General_options::incremental_mode): New function.
4645         (General_options::incremental_mode_): New data member.
4646         * parameters.cc (Parameters::incremental_mode_): New data member.
4647         (Parameters::set_options): Set incremental_mode_.
4648         (Parameters::set_incremental_full): New function.
4649         (Parameters::incremental): New function.
4650         (Parameters::incremental_update): New function.
4651         (set_parameters_incremental_full): New function.
4652         * parameters.h (Parameters::set_incremental_full): New function.
4653         (Parameters::incremental): New function.
4654         (Parameters::incremental_update): New function.
4655         (Parameters::incremental_mode_): New data member.
4656         (set_parameters_incremental_full): New function.
4657         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4658         incremental link mode.
4659         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4660         (Sized_relobj::do_relocate_sections): Likewise.
4661         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4662         option.
4663         * testsuite/Makefile.in: Regenerate.
4664         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4665
4666 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4667
4668         * script-sections.h (class Script_sections): Make
4669         Sections_elements typedef public.
4670         * script-sections.cc (class Sort_output_sections): Add elements_
4671         field.  Add constructor which sets it; change all callers.
4672         (Sort_output_sections::is_before): New function.
4673         (Sort_output_sections::operator()): Call is_before.
4674         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4675         conditional.
4676         * testsuite/script_test_10.sh: New test. Test script section
4677         order.
4678         * testsuite/script_test_10.t: Likewise.
4679         * testsuite/script_test_10.s: Likewise.
4680         * testsuite/Makefile.am: Wrap the cross linker tests and the
4681         common tests into NATIVE_OR_CROSS_LINKER.
4682         (check_SCRIPTS): Add script_test_10.sh.
4683         (check_DATA): Add script_test_10.stdout.
4684         (script_test_10.o, script_test_10): New targets.
4685         (script_test_10.stdout): New target.
4686         * configure, testsuite/Makefile.in: Regenerate.
4687
4688 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4689
4690         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4691         error for the deprecated relocations.
4692         (Target_arm::Scan::global): Likewise.
4693         (Target_arm::Relocate::relocate): Likewise.
4694
4695 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4696
4697         * fileread.cc (Input_file::find_file): Initialize *found_name
4698         and *namep when using the fallback search for case 4.
4699
4700 2010-10-11  Cary Coutant  <ccoutant@google.com>
4701
4702         * options.h (class General_options): Redefine -z lazy as an alias for
4703         the negation of -z now.
4704
4705 2010-10-11  Ian Lance Taylor  <iant@google.com>
4706
4707         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4708         binding.
4709
4710 2010-10-06  Nick Clifton  <nickc@redhat.com>
4711
4712         * script-sections.cc(class Memory_region): Remove
4713         current_lma_offset_ field.  Rename current_vma_offset_ to
4714         current_offset_.  Add last_section_ field.
4715         (Memory_region::get_current_vma_address): Rename to
4716         get_current_address.
4717         (Memory_region::get_current_lma_address): Delete.
4718         (Memory_region::increment_vma_offset): Rename to
4719         increment_offset.
4720         (Memory_region::increment_lma_offset): Delete.
4721         (Memory_region::attributes_compatible): New method.  Returns
4722         true if the provided section is compatible with the region.
4723         (Memory_region::get_last_section): New method.  Returns the last
4724         section to use the region.
4725         (Memory_region::set_last_section): New method.  Stores the last
4726         section to use the region.
4727         (Script_sections::block_in_region): New method.  Returns true if
4728         a block of memory is contained within a region.
4729         (Script_sections::find_memory_region): New method.  Locates a
4730         memory region to be used to set a VMA or LMA address.
4731         (Output_section_definition::set_section_addresses): Add code to
4732         check for addresses set by memory regions.
4733         (Output_segment::set_section_addresses): Remove memory region
4734         walking code.
4735         (Script_sections::create_segment): Add a warning if a header
4736         segment is created outside of any region.
4737         * script-sections.h (class Script_sections): Add prototypes for
4738         find_memory_region and block_in_region methods.
4739         * testsuite/memory_test.s: Use .long instead of .word.
4740         * testsuite/memory_test.t: Add some more output sections.
4741         * testsuite/memory_test.sh: Update expected output.
4742
4743 2010-10-02  Doug Kwan  <dougkwan@google.com>
4744
4745         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4746         defintion to symtab.h
4747         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4748         declaration to defintion.
4749
4750 2010-10-01  Nick Clifton  <nickc@redhat.com>
4751
4752         * expression.cc (eval): Replace dummy argument with NULL.
4753         (eval_maybe_dot): Check for a NULL result section pointer.
4754         (Symbol_expression::value): Likewise.
4755         (Dot_expression::value): Likewise.
4756         (BINARY_EXPRESSION): Likewise.
4757         (Max_expression::value): Likewise.
4758         (Min_expression::value): Likewise.
4759         (Absolute_expression::value): Likewise.
4760         (Addr_expression::value_from_output_section): Likewise.
4761         (Loaddddr_expression::value_from_output_section): Likewise.
4762         (Segment_start_expression::value): Likewise.
4763         * script-sections.cc
4764         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4765         argument with NULL.
4766         (Sections_elememt_dot_assignment::set_section_addresses):
4767         Likewise.
4768         (Output_data_expression::do_write_to_buffer): Likewise.
4769         (Output_section_definition::finalize_symbols): Likewise.
4770         (Output_section_definition::set_section_addresses): Likewise.
4771
4772 2010-09-30  Doug Kwan  <dougkwan@google.com>
4773
4774         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4775
4776 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4777
4778         * target.h (Target::can_icf_inline_merge_sections): New virtual
4779         function.
4780         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4781         virtual function.
4782         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4783         virtual function.
4784         * icf.cc (get_section_contents): Inline merge sections only when
4785         target allows it.
4786
4787 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4788
4789         * configure: Regenerate.
4790
4791 2010-09-17  Ian Lance Taylor  <iant@google.com>
4792
4793         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4794         * testsuite/Makefile.am (memory_test.o): New target.
4795         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4796         memory_test.t.
4797         * testsuite/Makefile.in: Rebuild.
4798
4799 2010-09-17  Doug Kwan  <dougkwan@google.com>
4800
4801         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4802         defintion if relocation uses GOT entries of the symbol.
4803         * testsuite/icf_safe_test.sh: Fix test.
4804         * testsuite/icf_safe_so_test.sh: Fix test.
4805
4806 2010-09-16  Cary Coutant  <ccoutant@google.com>
4807
4808         * script_sections.cc (class Memory_region): Remove "NULL" from
4809         vector initializations.
4810
4811 2010-09-15  Cary Coutant  <ccoutant@google.com>
4812
4813         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4814         Resolve forwarding symbols.
4815
4816 2010-09-15  Doug Kwan  <dougkwan@google.com>
4817
4818         * gold/testsuite/script_test_3.t: Add ARM special sections.
4819         * gold/testsuite/script_test_4.t: Same.
4820         * gold/testsuite/script_test_5.t: Same.
4821         * gold/testsuite/script_test_6.t: Same.
4822         * gold/testsuite/script_test_7.t: Same.
4823         * gold/testsuite/script_test_7.t: Same.
4824         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4825
4826 2010-09-14  Cary Coutant  <ccoutant@google.com>
4827
4828         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4829         (Target_x86_64::Relocate::relocate_tls): Replace check for
4830         saw_tls_block_reloc_ with test for executable section.
4831
4832 2010-09-12  Cary Coutant  <ccoutant@google.com>
4833
4834         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4835         position-independent executables to shared libraries need dynamic
4836         relocations.
4837         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4838         position-independent executables.
4839         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4840         * testsuite/Makefile.in: Regenerate.
4841
4842 2010-09-10  Nick Clifton  <nickc@redhat.com>
4843
4844         PR gold/11997
4845         * testsuite/memory_test.t: Discard any sections that are not
4846         needed.
4847
4848 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4849
4850         PR gold/11996
4851         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4852         "This::" to work around a bug in gcc 4.2.
4853
4854         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4855
4856 2010-09-09  Rafael Espindola  <espindola@google.com>
4857
4858         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4859         sections with different PF_X flags in the same segment.
4860         (Layout::find_first_load_seg): Search all segments to find the first
4861         one.
4862         * options.h (rosegment): New.
4863
4864 2010-09-08  Rafael Espindola  <espindola@google.com>
4865
4866         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4867
4868 2010-09-08  Doug Kwan  <dougkwan@google.com>
4869
4870         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4871         (Arm_relobj::do_relocate_sections): Add new parameter for output
4872         file to match the parent.
4873         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4874         of local symbols instead of input values.  Update code to track
4875         changes in gold::relocate_section.
4876         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4877         (Sized_relobj::compute_final_local_value_internal): New methods.
4878         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4879         body into private version of Sized_relobj::compute_final_local_value.
4880         Call the inline method.
4881         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4882         merged symbol value if there is one.
4883         (Symbol_value::has_output_value): New method defintiion.
4884         (Sized_relobj::Compute_final_local_value_status): New enum type.
4885         (Sized_relobj::compute_final_local_value): New methods.
4886         (Sized_relobj::compute_final_local_value_internal): New methods.
4887         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4888         and arm_cortex_a8.sh.
4889         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4890         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4891         New tests.
4892         * Makefile.in: Regenerate.
4893         * testsuite/arm_bl_out_of_range.s: Update test.
4894         * testsuite/thumb_bl_out_of_range.s: Ditto.
4895         * testsuite/thumb_blx_out_of_range.s: Ditto.
4896         * testsuite/arm_branch_out_of_range.sh: New file.
4897         * testsuite/arm_cortex_a8.sh: Ditto.
4898         * testsuite/arm_cortex_a8_b.s: Ditto.
4899         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4900         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4901         * testsuite/arm_cortex_a8_bl.s: Ditto.
4902         * testsuite/arm_cortex_a8_blx.s: Ditto.
4903         * testsuite/arm_cortex_a8_local.s: Ditto.
4904         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4905         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4906
4907 2010-09-08  Rafael Espindola  <espindola@google.com>
4908
4909         * Makefile.am (memory_test.stdout): Run readelf with -W.
4910         * Makefile.in: Regenerate.
4911         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4912         64 bit output.
4913
4914 2010-09-08  Rafael Espindola  <espindola@google.com>
4915
4916         * script-sections.cc (Script_sections::add_memory_region): Convert
4917         field precision to int.
4918         * script.cc (script_set_section_region, script_set_section_region):
4919         Convert field precision to int.
4920
4921 2010-09-08  Rafael Espindola  <espindola@google.com>
4922
4923         * arm.cc (do_finalize_sections): Create the __exidx_start and
4924         __exdix_end symbols even when the section is missing.
4925
4926 2010-09-08  Nick Clifton  <nickc@redhat.com>
4927
4928         * README: Remove claim that MEMORY is not supported.
4929         * expression.cc (script_exp_function_origin)
4930         (script_exp_function_length): Move from here to ...
4931         * script.cc: ... here.
4932         (script_set_section_region, script_add_memory)
4933         (script_parse_memory_attr, script_include_directive): New
4934         functions.
4935         * script-sections.cc
4936         (class Memory_region): New class.
4937         (class Output_section_definition): Add set_memory_region,
4938         set_section_vma, set_section_lma and get_section_name methods.
4939         (class Script_Sections): Add add_memory_region,
4940         find_memory_region, find_memory_region_origin,
4941         find_memory_region_length and set_memory_region methods.
4942         Have set_section_addresses method walk the list of set memory
4943         regions.
4944         Extend the print methos to display memory regions.
4945         * script-sections.h: Add prototypes for new methods.
4946         Add enum for MEMORY region attributes.
4947         * yyscript.y: Add support for parsing MEMORY regions.
4948         * script-c.h: Add prototypes for new functions.
4949         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4950         * testsuite/Makefile.in: Regenerate.
4951         * testsuite/memory_test.sh: New script.
4952         * testsuite/memory_test.s: New assembler source file.
4953         * testsuite/memory_test.t: New linker script.
4954
4955 2010-08-27  Doug Kwan  <dougkwan@google.com>
4956
4957         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4958         reference override an existing dynamic weak reference.
4959         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4960         * testsuite/Makefile.in: Regenerate.
4961         * testsuite/dyn_weak_ref.sh: New file.
4962         * testsuite/dyn_weak_ref_1.c: Ditto.
4963         * testsuite/dyn_weak_ref_2.c: Ditto.
4964
4965 2010-08-27  Ian Lance Taylor  <iant@google.com>
4966
4967         * incremental.h (class Incremental_input_entry): Add virtual
4968         destructor.
4969
4970 2010-08-27  Ian Lance Taylor  <iant@google.com>
4971
4972         * testsuite/start_lib_test_3.c: Mark t3 as used.
4973
4974 2010-08-27  Nick Clifton  <nickc@redhat.com>
4975
4976         * options.cc (version_script): Fix small typo in previous
4977         whitespace tidyup.
4978
4979 2010-08-25  Nick Clifton  <nickc@redhat.com>
4980
4981         * archive.cc: Formatting fixes: Remove whitespace between
4982         typename and following asterisk.  Remove whitespace between
4983         function name and opening parenthesis.
4984         * archive.h: Likewise.
4985         * arm.cc: Likewise.
4986         * attributes.cc: Likewise.
4987         * attributes.h: Likewise.
4988         * common.cc: Likewise.
4989         * copy-relocs.cc: Likewise.
4990         * dirsearch.h: Likewise.
4991         * dynobj.cc: Likewise.
4992         * ehframe.cc: Likewise.
4993         * ehframe.h: Likewise.
4994         * expression.cc: Likewise.
4995         * fileread.cc: Likewise.
4996         * fileread.h: Likewise.
4997         * gc.h: Likewise.
4998         * gold-threads.cc: Likewise.
4999         * gold.cc: Likewise.
5000         * i386.cc: Likewise.
5001         * icf.h: Likewise.
5002         * incremental-dump.cc: Likewise.
5003         * incremental.cc: Likewise.
5004         * layout.cc: Likewise.
5005         * layout.h: Likewise.
5006         * main.cc: Likewise.
5007         * merge.cc: Likewise.
5008         * merge.h: Likewise.
5009         * object.cc: Likewise.
5010         * object.h: Likewise.
5011         * options.cc: Likewise.
5012         * options.h: Likewise.
5013         * output.cc: Likewise.
5014         * output.h: Likewise.
5015         * plugin.cc: Likewise.
5016         * plugin.h: Likewise.
5017         * powerpc.cc: Likewise.
5018         * reloc.cc: Likewise.
5019         * script-c.h: Likewise.
5020         * script-sections.cc: Likewise.
5021         * script.cc: Likewise.
5022         * stringpool.cc: Likewise.
5023         * symtab.cc: Likewise.
5024         * symtab.h: Likewise.
5025         * target.cc: Likewise.
5026         * timer.cc: Likewise.
5027         * timer.h: Likewise.
5028         * version.cc: Likewise.
5029         * x86_64.cc: Likewise.
5030
5031 2010-08-24  Nick Clifton  <nickc@redhat.com>
5032
5033         PR 11899
5034         * layout.cc (segment_precedes): Sort segments by their physical
5035         addresses, if they have been set.
5036
5037 2010-08-23  Cary Coutant  <ccoutant@google.com>
5038
5039         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5040         symbols data.
5041         (Lib_group::include_member): Unlock object after deleting its
5042         symbols data.
5043         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5044         the bug fixed here.
5045
5046 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5047             Cary Coutant  <ccoutant@google.com>
5048
5049         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5050         constructor, and set_blocker.
5051         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5052         readsyms_blocker_.
5053         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5054         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5055         * testsuite/Makefile.am (start_lib_test): New test case.
5056         * testsuite/Makefile.in: Regenerate.
5057         * testsuite/start_lib_test_main.c: New file.
5058         * testsuite/start_lib_test_1.c: New file.
5059         * testsuite/start_lib_test_2.c: New file.
5060         * testsuite/start_lib_test_3.c: New file.
5061
5062 2010-08-19  Ian Lance Taylor  <iant@google.com>
5063
5064         * Makefile.in: Rebuild with automake 1.11.1.
5065         * aclocal.m4: Likewise.
5066         * testsuite/Makefile.in: Likewise.
5067
5068 2010-08-19  Ian Lance Taylor  <iant@google.com>
5069
5070         PR 10893
5071         * i386.cc (class Output_data_plt_i386): Update declarations.
5072         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5073         local_ifuncs_ fields.
5074         (Target_i386::do_plt_section_for_global): New function.
5075         (Target_i386::do_plt_section_for_local): New function.
5076         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5077         parameter; change all callers.  Initialize global_ifuncs_ and
5078         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5079         __rel_iplt_end.
5080         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5081         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5082         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5083         symbols.
5084         (Target_i386::make_plt_section): New function, broken out of
5085         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5086         (Target_i386::make_plt_entry): Call make_plt_section.
5087         (Target_i386::make_local_ifunc_plt_entry): New function.
5088         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5089         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5090         R_386_IRELATIVE to switch.
5091         (Target_i386::Scan::global): Likewise.
5092         (Target_i386::Relocate::relocate): Likewise.
5093         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5094         switch.
5095         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5096         (Target_x86_64::do_plt_section_for_global): New function.
5097         (Target_x86_64::do_plt_section_for_local): New function.
5098         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5099         parameter; change all callers.  If doing a static link define
5100         __rela_iplt_start and __rela_iplt_end.
5101         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5102         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5103         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5104         to point to .plt.
5105         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5106         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5107         switch.
5108         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5109         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5110         R_X86_64_IRELATIVE to switch.
5111         (Target_x86_64::Scan::global): Likewise.
5112         (Target_x86_64::Relocate::relocate): Likewise.
5113         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5114         switch.
5115         * target.h (class Target): Add plt_section_for_global and
5116         plt_section_for_local functions.  Add do_plt_section_for_global
5117         and do_plt_section_for_local virtual functions.
5118         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5119         clarifying comments.
5120         (Symbol::use_plt_offset): Handle IFUNC symbol.
5121         * object.cc (Sized_relobj::Sized_relobj): Initialize
5122         local_plt_offsets_.
5123         (Sized_relobj::local_has_plt_offset): New function.
5124         (Sized_relobj::local_plt_offset): New function.
5125         (Sized_relobj::set_local_plt_offset): New function.
5126         (Sized_relobj::do_count): Handle IFUNC symbol.
5127         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5128         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5129         is_ifunc_symbol functions.
5130         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5131         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5132         local_plt_offsets_ field.
5133         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5134         * output.h (class Output_section_data): Add non-const
5135         output_section function.
5136         (class Output_data_got): Update declarations.
5137         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5138         Add use_plt_offset parameter to global and local constructors.
5139         Change all callers.  Change local_sym_index_ field to 31 bits.
5140         Change GSYM_CODE and CONSTANT_CODE accordingly.
5141         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5142         doing a static link don't set sh_link field.
5143         (Output_data_got::Got_entry::write): Use PLT offset if
5144         appropriate.
5145         (Output_data_got::add_global_plt): New function.
5146         (Output_data_got::add_local_plt): New function.
5147         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5148         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5149         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5150         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5151         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5152         IFUNC conditional.
5153         * testsuite/ifunc-sel.h: New file.
5154         * testsuite/ifuncmain1.c: New file.
5155         * testsuite/ifuncmain1vis.c: New file.
5156         * testsuite/ifuncmod1.c: New file.
5157         * testsuite/ifuncdep2.c: New file.
5158         * testsuite/ifuncmain2.c: New file.
5159         * testsuite/ifuncmain3.c: New file.
5160         * testsuite/ifuncmod3.c: New file.
5161         * testsuite/ifuncmain4.c: New file.
5162         * testsuite/ifuncmain5.c: New file.
5163         * testsuite/ifuncmod5.c: New file.
5164         * testsuite/ifuncmain6pie.c: New file.
5165         * testsuite/ifuncmod6.c: New file.
5166         * testsuite/ifuncmain7.c: New file.
5167         * configure, testsuite/Makefile.in: Rebuild.
5168
5169 2010-08-18  Ian Lance Taylor  <iant@google.com>
5170
5171         * incremental.cc
5172         (Output_section_incremental_inputs::write_input_files): Add cast
5173         to avoid signed/unsigned comparison warning.
5174         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5175
5176 2010-08-12  Cary Coutant  <ccoutant@google.com>
5177
5178         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5179
5180 2010-08-13  Ian Lance Taylor  <iant@google.com>
5181
5182         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5183
5184 2010-08-12  Cary Coutant  <ccoutant@google.com>
5185             Doug Kwan  <dougkwan@google.com>
5186
5187         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5188         defintion overrides non-weak undef, remember that the original undef
5189         is not weak.
5190         * symtab.cc (Symbol_table::sized_write_global): For undef without
5191         an original weak binding, set binding to global in output.
5192         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5193         * testsuite/Makefile.in: Regenerate.
5194         * testsuite/strong_ref_weak_def.sh: New file.
5195         * testsuite/strong_ref_weak_def_1.c: Ditto.
5196         * testsuite/strong_ref_weak_def_2.c: Ditto.
5197
5198 2010-08-12  Cary Coutant  <ccoutant@google.com>
5199
5200         * testsuite/incremental_test.sh: Rewrite.
5201         * testsuite/incremental_test_1.c: Rewrite.
5202         * testsuite/incremental_test_2.c: Rewrite.
5203
5204 2010-08-12  Cary Coutant  <ccoutant@google.com>
5205
5206         * arm.cc (Target_arm::got_size): Add const.
5207         (Target_arm::got_entry_count): New function.
5208         (Target_arm::plt_entry_count): New function.
5209         (Target_arm::first_plt_entry_offset): New function.
5210         (Target_arm::plt_entry_size): New function.
5211         (Output_data_plt_arm::entry_count): New function.
5212         (Output_data_plt_arm::first_plt_entry_offset): New function.
5213         (Output_data_plt_arm::get_plt_entry_size): New function.
5214         * i386.cc (Target_i386::got_size): Add const.
5215         (Target_i386::got_entry_count): New function.
5216         (Target_i386::plt_entry_count): New function.
5217         (Target_i386::first_plt_entry_offset): New function.
5218         (Target_i386::plt_entry_size): New function.
5219         (Output_data_plt_i386::entry_count): New function.
5220         (Output_data_plt_i386::first_plt_entry_offset): New function.
5221         (Output_data_plt_i386::get_plt_entry_size): New function.
5222         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5223         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5224         * incremental.cc: Include target.h.
5225         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5226         parameter.  Adjust all callers.  Find incremental_got_plt section.
5227         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5228         section.
5229         (Output_section_incremental_inputs::set_final_data_size): Calculate
5230         size of incremental_got_plt section.
5231         (Output_section_incremental_inputs::do_write): Write the
5232         incremental_got_plt section.
5233         (Got_plt_view_info): New struct.
5234         (Local_got_offset_visitor): New class.
5235         (Global_got_offset_visitor): New class.
5236         (Global_symbol_visitor_got_plt): New class.
5237         (Output_section_incremental_inputs::write_got_plt): New function.
5238         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5239         Add parameter.  Adjust all callers.
5240         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5241         (Incremental_inputs::got_plt_section): New function.
5242         (Incremental_inputs::got_plt_section_): New data member.
5243         (Incremental_got_plt_reader): New class.
5244         * layout.cc (Layout::create_incremental_info_sections): Add the
5245         incremental_got_plt section.
5246         * object.h (Got_offset_list::get_list): New function.
5247         (Got offset_list::for_all_got_offsets): New function.
5248         (Sized_relobj::local_got_offset_list): New function.
5249         * powerpc.cc (Target_powerpc::got_size): Add const.
5250         (Target_powerpc::got_entry_count): New function.
5251         (Target_powerpc::plt_entry_count): New function.
5252         (Target_powerpc::first_plt_entry_offset): New function.
5253         (Target_powerpc::plt_entry_size): New function.
5254         (Output_data_plt_powerpc::entry_count): New function.
5255         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5256         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5257         * sparc.cc (Target_sparc::got_size): Add const.
5258         (Target_sparc::got_entry_count): New function.
5259         (Target_sparc::plt_entry_count): New function.
5260         (Target_sparc::first_plt_entry_offset): New function.
5261         (Target_sparc::plt_entry_size): New function.
5262         (Output_data_plt_sparc::entry_count): New function.
5263         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5264         (Output_data_plt_sparc::get_plt_entry_size): New function.
5265         * symtab.h (Symbol::got_offset_list): New function.
5266         (Symbol_table::for_all_symbols): New function.
5267         * target.h (Sized_target::got_entry_count): New function.
5268         (Sized_target::plt_entry_count): New function.
5269         (Sized_target::plt_entry_size): New function.
5270         * x86_64.cc (Target_x86_64::got_size): Add const.
5271         (Target_x86_64::got_entry_count): New function.
5272         (Target_x86_64::plt_entry_count): New function.
5273         (Target_x86_64::first_plt_entry_offset): New function.
5274         (Target_x86_64::plt_entry_size): New function.
5275         (Output_data_plt_x86_64::entry_count): New function.
5276         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5277         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5278
5279 2010-08-12  Cary Coutant  <ccoutant@google.com>
5280
5281         * archive.cc: Include incremental.h.
5282         (Archive::Archive): Initialize incremental_info_.
5283         (Archive::include_member): Record archive members in incremental info.
5284         (Add_archive_symbols::run): Record begin and end of an archive in
5285         incremental info.
5286         (Lib_group::include_member): Record objects in incremental info.
5287         * archive.h (Incremental_archive_entry): Forward declaration.
5288         (Archive::set_incremental_info): New member function.
5289         (Archive::incremental_info): New member function.
5290         (Archive::Unused_symbol_iterator): New class.
5291         (Archive::unused_symbols_begin): New member function.
5292         (Archive::unused_symbols_end): New member function.
5293         (Archive::incremental_info_): New data member.
5294         * incremental-dump.cc (find_input_containing_global): New function.
5295         (dump_incremental_inputs): Dump new incremental info sections.
5296         * incremental.cc: Include symtab.h.
5297         (Output_section_incremental_inputs): New class.
5298         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5299         new incremental info sections.
5300         (Sized_incremental_binary::do_check_inputs): Likewise.
5301         (Incremental_inputs::report_archive): Remove.
5302         (Incremental_inputs::report_archive_begin): New function.
5303         (Incremental_inputs::report_archive_end): New function.
5304         (Incremental_inputs::report_object): New function.
5305         (Incremental_inputs::finalize_inputs): Remove.
5306         (Incremental_inputs::report_input_section): New function.
5307         (Incremental_inputs::report_script): Rewrite.
5308         (Incremental_inputs::finalize): Do nothing but finalize string table.
5309         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5310         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5311         (Incremental_inputs::create_data_sections): New function.
5312         (Incremental_inputs::relocs_entsize): New function.
5313         (Output_section_incremental_inputs::set_final_data_size): New function.
5314         (Output_section_incremental_inputs::do_write): New function.
5315         (Output_section_incremental_inputs::write_header): New function.
5316         (Output_section_incremental_inputs::write_input_files): New function.
5317         (Output_section_incremental_inputs::write_info_blocks): New function.
5318         (Output_section_incremental_inputs::write_symtab): New function.
5319         * incremental.h (Incremental_script_entry): Forward declaration.
5320         (Incremental_object_entry): Forward declaration.
5321         (Incremental_archive_entry): Forward declaration.
5322         (Incremental_inputs): Forward declaration.
5323         (Incremental_inputs_header_data): Remove.
5324         (Incremental_inputs_header): Remove.
5325         (Incremental_inputs_header_write): Remove.
5326         (Incremental_inputs_entry_data): Remove.
5327         (Incremental_inputs_entry): Remove.
5328         (Incremental_inputs_entry_write): Remove.
5329         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5330         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5331         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5332         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5333         Likewise.
5334         (Incremental_input_entry): New class.
5335         (Incremental_script_entry): New class.
5336         (Incremental_object_entry): New class.
5337         (Incremental_archive_entry): New class.
5338         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5339         (Incremental_inputs::report_inputs): Remove.
5340         (Incremental_inputs::report_archive): Remove.
5341         (Incremental_inputs::report_archive_begin): New function.
5342         (Incremental_inputs::report_archive_end): New function.
5343         (Incremental_inputs::report_object): Change prototype.
5344         (Incremental_inputs::report_input_section): New function.
5345         (Incremental_inputs::report_script): Change prototype.
5346         (Incremental_inputs::get_reloc_count): New function.
5347         (Incremental_inputs::set_reloc_count): New function.
5348         (Incremental_inputs::create_data_sections): New function.
5349         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5350         (Incremental_inputs::inputs_section): New function.
5351         (Incremental_inputs::symtab_section): New function.
5352         (Incremental_inputs::relocs_section): New function.
5353         (Incremental_inputs::get_stringpool): Add const.
5354         (Incremental_inputs::command_line): Add const.
5355         (Incremental_inputs::inputs): Remove.
5356         (Incremental_inputs::command_line_key): New function.
5357         (Incremental_inputs::input_file_count): New function.
5358         (Incremental_inputs::input_files): New function.
5359         (Incremental_inputs::relocs_entsize): New function.
5360         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5361         (Incremental_inputs::finalize_inputs): Remove.
5362         (Incremental_inputs::Input_info): Remove.
5363         (Incremental_inputs::lock_): Remove.
5364         (Incremental_inputs::inputs_): Change type.
5365         (Incremental_inputs::inputs_map_): Remove.
5366         (Incremental_inputs::current_object_entry_): New data member.
5367         (Incremental_inputs::inputs_section_): New data member.
5368         (Incremental_inputs::symtab_section_): New data member.
5369         (Incremental_inputs::relocs_section_): New data member.
5370         (Incremental_inputs::reloc_count_): New data member.
5371         (Incremental_inputs_reader): New class.
5372         (Incremental_symtab_reader): New class.
5373         (Incremental_relocs_reader): New class.
5374         * layout.cc (Layout::finalize): Move finalization of incremental info
5375         and creation of incremental info sections to follow finalization of
5376         symbol table.  Set offsets for postprocessing sections.
5377         (Layout::create_incremental_info_sections): Call
5378         Incremental_inputs::create_data_sections.  Add incremental symtab
5379         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5380         sections to layout after input sections.
5381         * layout.h (struct Timespec): Forward declaration.
5382         (Layout::incremental_inputs): Add const.
5383         (Layout::create_incremental_info_sections): Add parameter.
5384         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5385         * object.cc: Include incremental.h.
5386         (Relobj::finalize_incremental_relocs): New function.
5387         (Sized_relobj::do_layout): Record input sections in incremental info.
5388         * object.h (Object::output_section): New function.
5389         (Object::output_section_offset): Moved from Relobj.
5390         (Object::get_incremental_reloc_base): New function.
5391         (Object::get_incremental_reloc_count): New function.
5392         (Object::do_output_section): New function.
5393         (Object::do_output_section_offset): Moved from Relobj.
5394         (Object::do_get_incremental_reloc_base): New function.
5395         (Object::do_get_incremental_reloc_count): New function.
5396         (Object::Object): Initialize new data members.
5397         (Relobj::output_section): Renamed do_output_section and moved to
5398         protected.
5399         (Relobj::output_section_offset): Moved to Object.
5400         (Relobj::do_get_incremental_reloc_base): New function.
5401         (Relobj::do_get_incremental_reloc_count): New function.
5402         (Relobj::allocate_incremental_reloc_counts): New function.
5403         (Relobj::count_incremental_reloc): New function.
5404         (Relobj::finalize_incremental_relocs): New function.
5405         (Relobj::next_incremental_reloc_index): New function.
5406         (Relobj::reloc_counts_): New data member.
5407         (Relobj::reloc_bases_): New data member.
5408         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5409         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5410         (Sized_relobj::incremental_relocs_scan): New function.
5411         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5412         (Sized_relobj::incremental_relocs_write): New function.
5413         (Sized_relobj::incremental_relocs_write_reltype): New function.
5414         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5415         incremental link.
5416         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5417         archives and object files elsewhere.
5418         (Add_symbols::run): Report object files here.
5419         (Finish_group::run): Report end of archive at end of group.
5420         * reloc.cc: Include layout.h, incremental.h.
5421         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5422         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5423         (Sized_relobj::incremental_relocs_scan): New function.
5424         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5425         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5426         (Sized_relobj::incremental_relocs_write): New function.
5427         (Sized_relobj::incremental_relocs_write_reltype): New function.
5428         * script.cc (read_input_script): Rewrite test for incremental link.
5429         Change call to Incremental_inputs::report_script.
5430         * symtab.h (Symbol_table::first_global_index): New function.
5431         (Symbol_table::output_count): New function.
5432
5433 2010-08-12  Doug Kwan  <dougkwan@google.com>
5434
5435         * arm.cc (Target_arm::merge_object_attributes): Check command line
5436         options --no-wchar-size-warning and --no-enum-size-warning.
5437         * options.h (General_options): Add ld-compatible options
5438         --no-enum-size-warning and --no-wchar-size-warning.
5439
5440 2010-08-04  Ian Lance Taylor  <iant@google.com>
5441
5442         * x86_64.cc (Target_x86_64::Scan::local): Use
5443         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5444         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5445         (Target_x86_64::Scan::global): Likewise.
5446         (Target_x86_64::Relocate::relocate): Likewise.
5447         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5448         Likewise.
5449
5450 2010-08-03  Cary Coutant  <ccoutant@google.com>
5451
5452         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5453         to reserve space in merged_strings vector. Keep total input size
5454         for stats.
5455         (Output_merge_string::do_print_merge_stats): Print total input size.
5456         * merge.h (Output_merge_string): Add input_size_ field.
5457         * stringpool.cc (Stringpool_template::string_length): Move
5458         implementations out of Stringpool_template class and place in
5459         stringpool.h.
5460         * stringpool.h (string_length): Move out of Stringpool_template.
5461
5462 2010-08-03  Ian Lance Taylor  <iant@google.com>
5463
5464         PR 11712
5465         * layout.cc (relaxation_loop_body): If address of load segment is
5466         set, adjust address to include headers if possible.
5467
5468 2010-08-03  Ian Lance Taylor  <iant@google.com>
5469
5470         * version.cc (version_string): Bump to 1.10.
5471
5472 2010-08-03  Ian Lance Taylor  <iant@google.com>
5473
5474         PR 11805
5475         * layout.h (enum Output_section_order): Define.
5476         (class Layout): Update declarations.
5477         * layout.cc (Layout::get_output_section): Add order parameter.
5478         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5479         is_first_non_relro parameters.  Change all callers.
5480         (Layout::choose_output_section): Likewise.
5481         (Layout::add_output_section_data): Likewise.
5482         (Layout::make_output_section): Likewise.  Set order.
5483         (Layout::default_section_order): New function.
5484         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5485         * output.cc (Output_section::Output_section): Initialize order_.
5486         Don't initialize deleted fields.
5487         (Output_segment::Output_segment): Don't initialize deleted
5488         fields.
5489         (Output_segment::add_output_section_to_load): New function
5490         replacing add_output_section.  Change all callers to call this or
5491         add_output_section_to_nonload.
5492         (Output_segment::add_output_section_to_nonload): New function.
5493         (Output_segment::remove_output_section): Rewrite.
5494         (Output_segment::add_initial_output_data): Likewise.
5495         (Output_segment::has_any_data_sections): Likewise.
5496         (Output_segment::is_first_section_relro): Likewise.
5497         (Output_segment::maximum_alignment): Likewise.
5498         (Output_segment::has_dynamic_reloc): New function replacing
5499         dynamic_reloc_count.  Change all callers.
5500         (Output_segment::has_dynamic_reloc_list): New function replacing
5501         dynamic_reloc_count_list.  Change all callers.
5502         (Output_segment::set_section_addresses): Rewrite.
5503         (Output_segment::set_offset): Rewrite.
5504         (Output_segment::find_first_and_last_list): Remove.
5505         (Output_segment::set_tls_offsets): Rewrite.
5506         (Output_segment::first_section_load_address): Likewise.
5507         (Output_segment::output_section_count): Likewise.
5508         (Output_segment::section_with_lowest_load_address): Likewise.
5509         (Output_segment::write_section_headers): Likewise.
5510         (Output_segment::print_sections_to_map): Likewise.
5511         * output.h (class Output_data): Remove dynamic_reloc_count_
5512         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5513         (Output_data::add_dynamic_reloc): Rewrite.
5514         (Output_data::has_dynamic_reloc): New function.
5515         (Output_data::dynamic_reloc_count): Remove.
5516         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5517         is_last_relro_, is_first_non_relro_, is_interp_,
5518         is_dynamic_linker_section_ fields.  Add order and set_order
5519         functions.  Remove is_relro_local, set_is_relro_local,
5520         is_last_relro, set_is_last_relro, is_first_non_relro,
5521         set_is_first_non_relro functions, is_interp, set_is_interp,
5522         is_dynamic_linker_section, and set_is_dynamic_linker_section
5523         functions.
5524         (class Output_segment): Change Output_data_list from std::list to
5525         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5526         output_bss_ fields.  Update declarations.
5527
5528 2010-08-02  Ian Lance Taylor  <iant@google.com>
5529
5530         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5531         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5532         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5533
5534 2010-08-02  Ian Lance Taylor  <iant@google.com>
5535
5536         PR 11855
5537         * script.cc (Script_options::Script_options): Initialize
5538         symbol_definitions_ and symbol_references_.
5539         (Script_options::add_symbol_assignment): Update
5540         symbol_definitions_ and symbol_references_.
5541         (Script_options::add_symbol_reference): New function.
5542         (script_symbol): New function.
5543         * script.h (class Script_options): Add symbol_definitions_ and
5544         symbol_references_ fields.
5545         (Script_options::referenced_const_iterator): New type.
5546         (Script_options::referenced_begin): New function.
5547         (Script_options::referenced_end): New function.
5548         (Script_options::is_referenced): New function.
5549         (Script_options::any_unreferenced): New function.
5550         * script-c.h (script_symbol): Declare.
5551         * yyscript.y (exp): Call script_symbol.
5552         * symtab.cc: Include "script.h".
5553         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5554         Change all callers.  Check symbols referenced by scripts.
5555         (Symbol_table::add_undefined_symbols_from_command_line): Add
5556         layout parameter.  Change all callers.
5557         (Symbol_table::do_add_undefined_symbols_from_command_line):
5558         Likewise.  Break out loop body.  Check symbols referenced by
5559         scripts.
5560         (Symbol_table::add_undefined_symbol_from_command_line): New
5561         function broken out of
5562         do_add_undefined_symbols_from_command_line.
5563         * symtab.h (class Symbol_table): Update declarations.
5564         * archive.cc: Include "layout.h".
5565         (Archive::should_include_member): Add layout parameter.  Change
5566         all callers.  Check for symbol mentioned in expression.
5567         * archive.h (class Archive): Update declaration.
5568         * object.cc (Sized_relobj::do_should_include_member): Add layout
5569         parameter.
5570         * object.h (Object::should_include_member): Add layout parameter.
5571         Change all callers.
5572         (Object::do_should_include_member): Add layout parameter.
5573         (class Sized_relobj): Update declaration.
5574         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5575         parameter.
5576         * dynobj.h (class Sized_dynobj): Update declaration.
5577         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5578         layout parameter.
5579         * plugin.h (class Sized_pluginobj): Update declaration.
5580
5581 2010-08-02  Ian Lance Taylor  <iant@google.com>
5582
5583         PR 11866
5584         * output.cc (Output_segment::set_offset): Search for the first and
5585         last sections rather than assuming that the list is in order.
5586         (Output_segment::find_first_and_last_list): New function.
5587         * output.h (class Output_segment): Update declarations.
5588         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5589         (relro_strip_test_SOURCES): New variable.
5590         (relro_strip_test_DEPENDENCIES): New variable.
5591         (relro_strip_test_LDFLAGS): New variable.
5592         (relro_strip_test_LDADD): New variable.
5593         (relro_strip_test.so): New target.
5594
5595 2010-08-02  Ian Lance Taylor  <iant@google.com>
5596
5597         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5598         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5599         (Target_i386::got_tlsdesc_section): New function.
5600         (Target_i386::got_section): Create space for GOT entries for
5601         TLSDESC relocations.
5602         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5603         R_386_TLS_GOTDESC.
5604         (Target_i386::Scan::global): Likewise.
5605         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5606         using TLSDESC GOT.
5607         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5608         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5609         (Target_x86_64::got_tlsdesc_section): New function.
5610         (Target_x86_64::got_section): Create space for GOT entries for
5611         TLSDESC relocations.
5612         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5613         R_386_TLS_GOTDESC.
5614         (Target_x86_64::Scan::global): Likewise.
5615         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5616         using TLSDESC GOT.
5617
5618 2010-08-02  Ian Lance Taylor  <iant@google.com>
5619
5620         * testsuite/final_layout.sh: Use dc to convert from hex to
5621         decimal.
5622
5623 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5624
5625         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5626         paramter to the call to gold::gc_process_relocs.
5627         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5628         paramter to the call to gold::gc_process_relocs.
5629         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5630         parameter to the call to gold::gc_process_relocs.
5631         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5632         template parameter to the call to gold::gc_process_relocs.
5633         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5634         paramter to the call to gold::gc_process_relocs.
5635         * gc.h (get_embedded_addend_size): New function.
5636         (gc_process_relocs): Save the size of the reloc for use by ICF.
5637         * icf.cc (get_section_contents): Get the addend from the text section
5638         for SHT_REL relocation sections.
5639         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5640         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5641         * int_encoding.h (read_from_pointer): New overloaded function.
5642         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5643         * testsuite/icf_sht_rel_addend_test.sh: New file.
5644         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5645         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5646
5647 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5648
5649         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5650         * Makefile.in: Regenerate.
5651         * testsuite/Makefile.in: Regenerate.
5652
5653 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5654
5655         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5656         * gold/testsuite/debug_msg.cc: Likewise.
5657         * gold/testsuite/odr_violation1.cc
5658         * gold/testsuite/odr_violation2.cc
5659
5660 2010-07-21  Cary Coutant  <ccoutant@google.com>
5661
5662         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5663         string, and length fields.
5664         (Output_merge_string::Merged_strings_list): New type.
5665         (Output_merge_string::Merged_strings_lists): New typedef.
5666         (Output_merge_string): Replace merged_strings_ with
5667         merged_strings_lists_.
5668         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5669         Merged_strings_list per input object and section.  Don't store pointer
5670         to the string.  Don't store length with each merged string entry.
5671         (Output_merge_string::finalize_merged_data): Loop over list of merged
5672         strings lists.  Recompute length of each merged string.
5673
5674 2010-07-15  Cary Coutant  <ccoutant@google.com>
5675
5676         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5677         here.
5678
5679 2010-07-14  Ian Lance Taylor  <iant@google.com>
5680
5681         * descriptors.cc (Descriptors::open): Report correct name in error
5682         message.
5683
5684 2010-07-13  Doug Kwan  <dougkwan@google.com>
5685
5686         * arm.cc (Arm_input_section::Arm_input_section): For a
5687         SHT_ARM_EXIDX section, always keeps the input sections.
5688         (Arm_input_section::set_exidx_section_link): New method.
5689         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5690         has_errors_ to false.
5691         (Arm_exidx_input_section::has_errors,
5692         Arm_exidx_input_section::set_has_errors): New methods.
5693         (Arm_exidx_input_section::has_errors_): New data member.
5694         (Arm_relobj::get_exidx_shndx_list): New method.
5695         (Arm_output_section::append_text_sections_to_list): Do not skip
5696         section without SHF_EXECINSTR.
5697         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5698         errors.
5699         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5700         section header.  Make error messages more verbose.  Check for
5701         a non-executable section linked to an EXIDX section.
5702         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5703         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5704         check that there is no deferred EXIDX section if we exit early.
5705         Instead of not making an EXIDX section in case of an error, make one
5706         and set the has_errors flag of it.
5707         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5708         in a relocatable link.
5709         (Target_arm::do_relax): Look for the EXIDX output section instead of
5710         assuming that it is called .ARM.exidx.
5711         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5712         section list.  Do not check for SHF_EXECINSTR section flags but
5713         skip any input section with errors.
5714         * output.cc (Output_section::Output_section): Initialize
5715         always_keeps_input_sections_ to false.
5716         (Output_section::add_input_section): Check for
5717         always_keeps_input_sections_.
5718         *  output.h (Output_section::always_keeps_input_sections,
5719         Output_section::set_always_keeps_input_sections): New methods.
5720         (Output_section::always_keeps_input_sections): New data member.
5721
5722 2010-07-13  Rafael Espindola  <espindola@google.com>
5723
5724         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5725         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5726
5727 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5728             Ian Lance Taylor  <iant@google.com>
5729
5730         * output.h (Output_section_lookup_maps::add_merge_section):
5731         Correct check of whether value was inserted.
5732         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5733         (Output_section_lookup_maps::add_relaxed_input_section):
5734         Likewise.
5735         * arm.cc (Target_arm::got_section): Remove used local os.
5736         * i386.cc (Target_i386::got_section): Likewise.
5737         * x86_64.cc (Target_x86_64::got_section): Likewise.
5738         * sparc.cc (Target_sparc::got_section): Likewise.
5739         (Target_sparc::relocate): Remove unused local have_got_offset.
5740         * powerpc.cc (Target_powerpc::relocate): Likewise.
5741
5742 2010-07-13  Ian Lance Taylor  <iant@google.com>
5743
5744         * compressed_output.cc (zlib_decompress): Fix signature in
5745         !HAVE_ZLIB_H case.
5746
5747         * archive.cc (Archive::include_member): Unlock an external member
5748         of a thin archive.  Don't bother to delete an object we know is
5749         NULL.
5750
5751 2010-07-12  Cary Coutant  <ccoutant@google.com>
5752
5753         * compressed_output.cc (zlib_decompress): New function.
5754         (get_uncompressed_size): New function.
5755         (decompress_input_section): New function.
5756         * compressed_output.h (get_uncompressed_size): New function.
5757         (decompress_input_section): New function.
5758         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5759         Handle compressed debug sections.
5760         * layout.cc (is_compressed_debug_section): New function.
5761         (Layout::output_section_name): Map compressed section names to
5762         canonical names.
5763         * layout.h (is_compressed_debug_section): New function.
5764         (is_debug_info_section): Recognize compressed debug sections.
5765         * merge.cc: Include compressed_output.h.
5766         (Output_merge_data::do_add_input_section): Handle compressed
5767         debug sections.
5768         (Output_merge_string::do_add_input_section): Handle compressed
5769         debug sections.
5770         * object.cc: Include compressed_output.h.
5771         (Sized_relobj::Sized_relobj): Initialize new data members.
5772         (build_compressed_section_map): New function.
5773         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5774         * object.h (Object::section_is_compressed): New method.
5775         (Object::do_section_is_compressed): New method.
5776         (Sized_relobj::Compressed_section_map): New type.
5777         (Sized_relobj::do_section_is_compressed): New method.
5778         (Sized_relobj::compressed_sections_): New data member.
5779         * output.cc (Output_section::add_input_section): Handle compressed
5780         debug sections.
5781         * reloc.cc: Include compressed_output.h.
5782         (Sized_relobj::write_sections): Handle compressed debug sections.
5783
5784 2010-07-08  Cary Coutant  <ccoutant@google.com>
5785
5786         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5787         weak when resolving to a dynamic def.
5788         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5789         for weak undef/dynamic def cases. Adjust callers.
5790         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5791         undef_binding_weak_.
5792         (Symbol_table::sized_write_globals): Adjust symbol binding.
5793         (Symbol_table::sized_write_symbol): Add binding parameter.
5794         * symtab.h (Symbol::set_undef_binding): New method.
5795         (Symbol::is_undef_binding_weak): New method.
5796         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5797         (Symbol_table::should_override): Add new parameter.
5798         (Symbol_table::sized_write_symbol): Add new parameter.
5799
5800         * testsuite/weak_undef_file1.cc: Add new test case.
5801         * testsuite/weak_undef_file2.cc: Fix header comment.
5802         * testsuite/weak_undef_test.cc: Add new test case.
5803
5804 2010-06-29  Doug Kwan  <dougkwan@google.com>
5805
5806         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5807         Initialize USE_SYMBOL_.
5808         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5809         definition.
5810         (Arm_reloc_property::uses_symbol_): New data member declaration.
5811         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5812         uses symbol value and symbol is undefined but not weakly undefined.
5813
5814 2010-06-28  Rafael Espindola  <espindola@google.com>
5815
5816         * plugin.cc (Plugin::load): Use dlerror.
5817
5818 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5819
5820         * symtab.cc (detect_odr_violations): When reporting an ODR
5821         violation, report an object where the symbol is defined.
5822
5823 2010-06-25  Doug Kwan  <dougkwan@google.com>
5824
5825         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5826         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5827         definition.
5828         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5829         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5830         target hook to detect function points.
5831         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5832         * icf.h (Icf::check_section_for_function_pointers): Change type of
5833         parameter SECTION_NAME to const reference to std::string.  Use
5834         target hook to determine if section may have unsafe pointers.
5835         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5836         method definition.
5837
5838 2010-06-21  Rafael Espindola  <espindola@google.com>
5839
5840         * fileread.cc (Input_file::find_fie): New
5841         (Input_file::open): Use Input_file::find_fie.
5842         * fileread.h (Input_file::find_fie): New
5843         * plugin.cc (set_extra_library_path): New.
5844         (Plugin::load): Add set_extra_library_path to the transfer vector.
5845         (Plugin_manager::set_extra_library_path): New.
5846         (Plugin_manager::add_input_file): Use the extra search path if set.
5847         (set_extra_library_path(): New.
5848         * plugin.h (Plugin_manager): Add set_extra_library_path and
5849         extra_search_path_.
5850
5851 2010-06-19  Cary Coutant  <ccoutant@google.com>
5852
5853         * layout.cc (gdb_sections): Add .debug_types.
5854         (lines_only_debug_sections): Likewise.
5855
5856 2010-06-18  Rafael Espindola  <espindola@google.com>
5857
5858         * plugin.cc (add_input_file,add_input_library)
5859         (Plugin_manager::add_input_file): Make filename arguments const.
5860         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5861         const.
5862
5863 2010-06-16  Doug Kwan  <dougkwan@google.com>
5864
5865         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5866         .ARM.attributes section if we have not merged any input
5867         attributes sections.
5868
5869 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5870
5871         * arm.cc: Allow combining objects with no EABI version
5872         information.
5873
5874 2010-06-15  Rafael Espindola  <espindola@google.com>
5875
5876         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5877
5878 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5879
5880         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5881         (struct iovec): Correct !HAVE_READV definition.
5882
5883 2010-06-10  Cary Coutant  <ccoutant@google.com>
5884
5885         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5886         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5887         reloc sections.
5888         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5889
5890         PR 11683
5891         * symtab.h (Symbol::is_placeholder): New member function.
5892         * target-reloc.h (relocate_section): Check for placeholder symbols.
5893
5894         * testsuite/Makefile.am (plugin_test_8): New test.
5895         (plugin_test_9): New test.
5896         * testsuite/Makefile.in: Regenerate.
5897
5898 2010-06-09  Nick Clifton  <nickc@redhat.com>
5899
5900         * yyscript.y (input_list_element): Allow strings prefixed with
5901         the '-' character.  Treat these as libraries.
5902         * script.cc (script_add_library): New function.  Adds a library
5903         specified by "-l<name>" found in an input script.
5904         * script-c.h: Add prototype for script_add_library.
5905
5906 2010-06-07  Doug Kwan  <dougkwan@google.com>
5907
5908         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5909         Restrict stub-group size to be within long conditional branch
5910         range when working around cortex-A8 erratum.
5911
5912 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5913
5914         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5915         #ifdef typo.
5916
5917 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5918
5919         PR gold/11658
5920         * output.cc
5921         (Output_section::Input_section_sort_entry::compare_section_ordering):
5922         Change to return non-zero correctly.
5923         (Output_section::Input_section_sort_section_order_index_compare
5924         ::operator()): Change to fix ambiguity in comparisons.
5925
5926 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5927
5928         * gold.h (is_wildcard_string): New function.
5929         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5930         (Layout::layout_eh_frame): Ditto.
5931         (Layout::find_section_order_index): New method.
5932         (Layout::read_layout_from_file): New method.
5933         * layout.h (Layout::find_section_order_index): New method.
5934         (Layout::read_layout_from_file): New method.
5935         (Layout::input_section_position_): New private member.
5936         (Layout::input_section_glob_): New private member.
5937         * main.cc (main): Call read_layout_from_file here.
5938         * options.h (--section-ordering-file): New option.
5939         * output.cc (Output_section::input_section_order_specified_): New
5940         member.
5941         (Output_section::Output_section): Initialize new member.
5942         (Output_section::add_input_section): Add new parameter.
5943         Keep input sections when --section-ordering-file is used.
5944         (Output_section::set_final_data_size): Sort input sections when
5945         section ordering file is specified.
5946         (Output_section::Input_section_sort_entry): Add new parameter.
5947         Check sorting type.
5948         (Output_section::Input_section_sort_entry::compare_section_ordering):
5949         New method.
5950         (Output_section::Input_section_sort_compare::operator()): Change to
5951         consider section_order_index.
5952         (Output_section::Input_section_sort_init_fini_compare::operator()):
5953         Change to consider section_order_index.
5954         (Output_section::Input_section_sort_section_order_index_compare
5955         ::operator()): New method.
5956         (Output_section::sort_attached_input_sections): Change to sort
5957         according to section order when specified.
5958         (Output_section::add_input_section<32, true>): Add new parameter.
5959         (Output_section::add_input_section<64, true>): Add new parameter.
5960         (Output_section::add_input_section<32, false>): Add new parameter.
5961         (Output_section::add_input_section<64, false>): Add new parameter.
5962         * output.h (Output_section::add_input_section): Add new parameter.
5963         (Output_section::input_section_order_specified): New
5964         method.
5965         (Output_section::set_input_section_order_specified): New method.
5966         (Input_section::Input_section): Initialize section_order_index_.
5967         (Input_section::section_order_index): New method.
5968         (Input_section::set_section_order_index): New method.
5969         (Input_section::section_order_index_): New member.
5970         (Input_section::Input_section_sort_section_order_index_compare): New
5971         struct.
5972         (Output_section::input_section_order_specified_): New member.
5973         * script-sections.cc (is_wildcard_string): Delete and move modified
5974         method to gold.h.
5975         (Output_section_element_input::Output_section_element_input): Modify
5976         call to is_wildcard_string.
5977         (Output_section_element_input::Input_section_pattern
5978         ::Input_section_pattern): Ditto.
5979         (Output_section_element_input::Output_section_element_input): Ditto.
5980         * testsuite/Makefile.am (final_layout): New test case.
5981         * testsuite/Makefile.in: Regenerate.
5982         * testsuite/final_layout.cc: New file.
5983         * testsuite/final_layout.sh: New file.
5984
5985 2010-06-01  Rafael Espindola  <espindola@google.com>
5986
5987         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5988
5989 2010-06-01  Rafael Espindola  <espindola@google.com>
5990
5991         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5992         visibility of symbols.
5993
5994 2010-05-27  Doug Kwan  <dougkwan@google.com>
5995
5996         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5997         from start of output section instead of address for a local symbol
5998         in a merged or relaxed section when doing a relocatable link.
5999
6000 2010-05-26  Rafael Espindola  <espindola@google.com>
6001
6002         PR 11604
6003         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6004         adding sections the garbage collector removed.
6005         * gold/testsuite/Makefile.am: Add test.
6006         * gold/testsuite/Makefile.in: Regenerate.
6007         * gold/testsuite/plugin_test_7.sh: New.
6008         * gold/testsuite/plugin_test_7_1.c: New.
6009         * gold/testsuite/plugin_test_7_2.c: New.
6010
6011 2010-05-26  Rafael Espindola  <espindola@google.com>
6012
6013         * script-sections.cc (Output_section_definition::set_section_addresses):
6014         Check for --section-start.
6015
6016 2010-05-26  Doug Kwan  <dougkwan@google.com>
6017
6018         * arm.cc (Arm_scan_relocatable_relocs): New class.
6019         (Target_arm::relocate_special_relocatable): New method.
6020         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6021         (Arm_relocate_functions::thumb_branch_common): Same.
6022         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6023         instead of Default_scan_relocatable_relocs.
6024         * target-reloc.h (relocate_for_relocatable): Let target handle
6025         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6026         * target.h (Sized_target::relocate_special_relocatable): New method.
6027
6028 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6029
6030         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6031
6032 2010-05-23  Doug Kwan  <dougkwan@google.com>
6033
6034         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6035         instead of a cast.
6036         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6037         with a direct branch, not a conditional branch, to a stub.
6038         * merge.cc (Output_merge_base::record_input_section): New method
6039         defintion.
6040         (Output_merge_data::do_add_input_section): Record input section if
6041         keeps-input-sections flag is set.
6042         (Output_merge_string::do_add_input_section): Ditto.
6043         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6044         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6045         INPUT_SECTIONS_.
6046         (Output_merge_base::keeps_input_sections,
6047         Output_merge_base::set_keeps_input_sections,
6048         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6049         method definitions.
6050         (Output_merge_base::Input_sections): New type declaration.
6051         (Output_merge_base::input_sections_begin,
6052         Output_merge_base::input_sections_end,
6053         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6054         (Output_merge_base::bool keeps_input_sections_,
6055         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6056         Output_merge_base::input_sections_): New data members.
6057         (Output_merge_data::do_set_keeps_input_sections): New method
6058         defintion.
6059         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6060         * output.cc (Output_section::Input_section::relobj): Move method
6061         defintion from class declaration to here and handle merge sections.
6062         (Output_section::Input_section::shndx): Ditto.
6063         (Output_section::Output_section): Remove initializations of removed
6064         data members and initialize new data member LOOKUP_MAPS_.
6065         (Output_section::add_input_section): Set keeps-input-sections flag
6066         for a newly created merge output section as appropriate.  Adjust code
6067         to use Output_section_lookup_maps class.
6068         (Output_section::add_relaxed_input_section): Adjst code for lookup
6069         maps code refactoring.
6070         (Output_section::add_merge_input_section): Add a new parameter
6071         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6072         class.  If adding input section to a newly created merge output
6073         section fails, remove the new merge section.
6074         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6075         Adjust code for use of the Output_section_lookup_maps class.
6076         (Output_section::find_merge_section): Ditto.
6077         (Output_section::build_lookup_maps): New method defintion.
6078         (Output_section::find_relaxed_input_section): Adjust code to use
6079         Output_section_lookup_maps class.
6080         (Output_section::get_input_sections): Export merge sections.  Adjust
6081         code to use Output_section_lookup_maps class.
6082         (Output_section:::add_script_input_section): Adjust code to use
6083         Output_section_lookup_maps class.  Update lookup maps for merge
6084         sections also.
6085         (Output_section::discard_states): Use Output_section_lookup_maps.
6086         (Output_section::restore_states): Same.
6087         * output.h (Merge_section_properties): Move class defintion out of
6088         Output_section.
6089         (Output_section_lookup_maps): New class.
6090         (Output_section::Input_section::is_merge_section): New method
6091         defintion.
6092         (Output_section::Input_section::relobj): Move defintion out of class
6093         defintion.  Declare method only.
6094         (Output_section::Input_section::shndx): Ditto.
6095         (Output_section::Input_section::output_merge_base): New method defintion.
6096         (Output_section::Input_section::u2_.pomb): New union field.
6097         (Output_section::Merge_section_by_properties_map,
6098         Output_section::Output_section_data_by_input_section_map,
6099         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6100         Remove types.
6101         (Output_section::add_merge_input_section): Add new parameter
6102         KEEPS_INPUT_SECTIONS.
6103         (Output_section::build_lookup_maps): New method declaration.
6104         (Output_section::merge_section_map_,
6105         Output_section::merge_section_by_properties_map_,
6106         Output_section::relaxed_input_section_map_,
6107         Output_section::is_relaxed_input_section_map_valid_): Remove data
6108         members.
6109         (Output_section::lookup_maps_): New data member.
6110
6111 2010-05-21  Doug Kwan  <dougkwan@google.com>
6112
6113         PR gold/11619
6114         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6115         avoid a compilation error.
6116
6117 2010-05-19  Rafael Espindola  <espindola@google.com>
6118
6119         * script-sections.cc (Output_section_definition::allocate_to_segment):
6120         Update the phdrs_list even when the output section is NULL.
6121         * testsuite/Makefile.am: Add test.
6122         * testsuite/Makefile.in: Regenerate.
6123         * testsuite/script_test_9.cc: New.
6124         * testsuite/script_test_9.sh: New.
6125         * testsuite/script_test_9.t: New.
6126
6127 2010-05-19  Doug Kwan  <dougkwan@google.com>
6128
6129         * arm.cc (Arm_input_section::original_size): New method.
6130         (Arm_input_section::do_addralign): Add a cast.
6131         (Arm_input_section::do_output_offset): Remove static cast.
6132         (Arm_input_section::original_addralign,
6133          Arm_input_section::original_size_): Change type to uint32_t.
6134         (Arm_input_section::init): Add safe casts for section alignment
6135         and size.
6136         (Arm_input_section::set_final_data_size): Do not set address and
6137         offset of stub table.
6138         (Arm_output_section::fix_exidx_coverage): Change use of of
6139         Output_section::Simple_input_section to that of
6140         Output_section::Input_section.
6141         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6142         except for the first pass.
6143         * output.cc (Output_section::get_input_sections): Change type of
6144         input_sections to std::list<Input_section>.
6145         (Output_section::add_script_input_section): Rename from
6146         Output_section::add_simple_input_section.  Change type of SIS
6147         parameter from Simple_input_section to Input_section.
6148         * output.h (Output_section::Simple_input_section): Remove class.
6149         (Output_section::Input_section): Change class visibility to public.
6150         (Output_section::Input_section::addralign): Use stored alignments
6151         for special input sections if set.
6152         (Output_section::Input_section::set_addralign): New method.
6153         (Output_section::get_input_sections): Change parameter type from
6154         list of Simple_input_section to list of Input_section.
6155         (Output_section::add_script_input_section): Rename from
6156         Output_section::add_simple_input_section. Change first parameter's
6157         type from Simple_input_section to Input_section and remove the
6158         second and third parameters.
6159         * script-sections.cc (Input_section::Input_section_list): Change
6160         type to list of Output_section::Input_section/
6161         (Input_section_info::Input_section_info): Change parameter type of
6162         INPUT_SECTION to Output_section::Input_section.
6163         (Input_section_info::input_section): Change return type.
6164         (Input_section_info::input_section_): Change type to
6165         Output_section::Input_section.
6166         (Output_section_element_input::set_section_addresses): Adjust code
6167         to use Output_section::Input_section instead of
6168         Output_section::Simple_input_section.  Adjust code for renaming
6169         of Output_section::add_simple_input_section.
6170         (Orphan_output_section::set_section_addresses): Ditto.
6171
6172 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6173
6174         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6175         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6176
6177 2010-05-18  Rafael Espindola  <espindola@google.com>
6178
6179         * options.cc (General_options::finalize): Handle -nostdlib.
6180         * options.h (nostdlib): New option.
6181         * script.cc (script_add_search_dir): Handle -nostdlib.
6182
6183 2010-05-12  Doug Kwan  <dougkwan@google.com>
6184
6185         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6186         attributes section only if there no attributes section after merging.
6187         (Target_arm::merge_object_attributes): Move value of
6188         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6189         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6190         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6191         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6192         and arm_attr_merge_7.stdout.
6193         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6194         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6195         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6196         arm_attr_merge_7b.o): New rules.
6197         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6198         arm_attr_merge_7
6199         * testsuite/Makefile.in: Regenerate.
6200         * testsuite/arm_attr_merge.sh: New file.
6201         * testsuite/arm_attr_merge_[67][ab].s: Same.
6202
6203 2010-05-05  Nick Clifton  <nickc@redhat.com>
6204
6205         * po/es.po: Updated Spanish translation.
6206
6207 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6208
6209         * Makefile.am (install-exec-local): Properly install gold as
6210         default cross linker.
6211         * Makefile.in: Regenerated.
6212
6213 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6214             Nick Clifton  <nickc@redhat.com>
6215
6216         * configure.ac (install_as_default): Define and set to false
6217         unless --enable-gold or --enable-gold=both/gold has been
6218         specified.
6219         * configure: Regenerate.
6220
6221         * Makefile.am (install-exec-local): Install the executable as
6222         'ld.gold'.  If install_as_default is true then also install it as
6223         'ld'.
6224         * Makefile.in: Regenerated.
6225
6226 2010-04-24  Ian Lance Taylor  <iant@google.com>
6227
6228         * layout.cc (Layout::layout_reloc): In relocatable link don't
6229         combine reloc sections for grouped sections.
6230
6231 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6232
6233         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6234         sections that are not ordinary to icf.
6235         * icf.cc (get_section_contents): Handle relocation pointing to section
6236         with no object or shndx information.
6237         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6238         * testsuite/Makefile.in: Regenerate.
6239         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6240         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6241
6242 2010-04-22  Ian Lance Taylor  <iant@google.com>
6243
6244         * expression.cc (Expression::Expression_eval_info): Add
6245         result_alignment_pointer field.
6246         (Expression::eval_with_dot): Add result_alignment_pointer
6247         parameter.  Change all callers.
6248         (Expression::eval_maybe_dot): Likewise.
6249         (class Binary_expression): Add alignment_pointer parameter to
6250         left_value and right_value.  Change all callers.
6251         (BINARY_EXPRESSION): Set result alignment.
6252         (class Trinary_expression): Add alignment_pointer parameter to
6253         arg2_value and arg3_value.  Change all callers.
6254         (Trinary_cond::value): Set result alignment.
6255         (Max_expression::value, Min_expression::value): Likewise.
6256         (Align_expression::value): Likewise.
6257         * script-sections.cc (class Sections_element): Add dot_alignment
6258         parameter to set_section_addresses virtual function.  Update
6259         instantiations.
6260         (class Output_section_element): Likewise.
6261         (Script_sections::create_segments): Add dot_alignment parameter.
6262         Change all callers.
6263         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6264         (Script_sections::set_phdrs_clause_addresses): Likewise.
6265         * script-sections.h: Update declarations.
6266         * script.h: Update declarations.
6267         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6268         min_p_align.
6269         * testsuite/script_test_3.t: Set large alignment.
6270         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6271         segment has expected alignment.
6272
6273 2010-04-22  Nick Clifton  <nickc@redhat.com>
6274
6275         * po/gold.pot: Updated by the Translation project.
6276         * po/vi.po: Updated Vietnamese translation.
6277
6278 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6279
6280         * testsuite/Makefile.am (check_PROGRAMS): Add
6281         icf_virtual_function_folding_test.
6282         * testsuite/Makefile.in: Regenerated.
6283
6284 2010-04-15  Andrew Haley  <aph@redhat.com>
6285
6286         * options.h (merge_exidx_entries): New option.
6287         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6288         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6289         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6290         (Target_arm::merge_exidx_entries): New function.
6291         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6292         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6293         to Arm_exidx_fixup constructor.
6294         Add new arg, merge_exidx_entries.
6295         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6296         Arm_output_section::fix_exidx_coverage.
6297
6298 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6299
6300         * icf.cc (get_section_contents): Check for preemptible functions.
6301         Ignore addend when appropriate.
6302         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6303         section folded.
6304         (add_from_relobj): Check for section folded.
6305         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6306         * symtab.h (should_add_dynsym_entry): Add new parameter.
6307         * target-reloc.h (scan_relocs): Check for section folded.
6308         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6309         Check reloc types for function pointers in shared objects.
6310         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6311         case.
6312         (icf_preemptible_functions_test): New test case.
6313         (icf_string_merge_test): New test case.
6314         * testsuite.Makefile.in: Regenerate.
6315         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6316         bar_glob.  Refactor code.
6317         * testsuite/icf_preemptible_functions_test.cc: New file.
6318         * testsuite/icf_preemptible_functions_test.sh: New file.
6319         * testsuite/icf_string_merge_test.cc: New file.
6320         * testsuite/icf_string_merge_test.sh: New file.
6321         * testsuite/icf_virtual_function_folding_test.cc: New file.
6322         * testsuite/icf_virtual_function_folding_test.sh: New file.
6323
6324 2010-04-14  Doug Kwan  <dougkwan@google.com>
6325
6326         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6327         for local symbol recounting if we remove a section due to ICF.
6328         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6329         there are no regular objects in input.
6330
6331 2010-04-13  Doug Kwan  <dougkwan@google.com>
6332
6333         * arm.cc (Arm_input_section::set_final_data_size): Compute
6334         accurate final data size instead of using current data size.
6335
6336 2010-04-09  Doug Kwan  <dougkwan@google.com>
6337
6338         * layout.cc (Layout::choose_output_section): Handle script section
6339         types.
6340         (Layout::make_output_section_for_script): Add section type parameter.
6341         Handle script section types.
6342         * layout.h (Layout::make_output_section_for_script): Add section
6343         type parameter.
6344         * output.cc (Output_section::Output_section): Initialize data member
6345         is_noload_.
6346         (Output_section::do_reset_address_and_file_offset): Do not set address
6347         to 0 if section is a NOLOAD section.
6348         * output.h (Output_section::is_noload): New method.
6349         (Output_section::set_is_noload): Ditto.
6350         (Output_section::is_noload_): New data member.
6351         * script-c.h (Script_section_type): New enum type.
6352         (struct Parser_output_section_header): Add new file section_type.
6353         * script-sections.cc (Sections_element::output_section_name): Add
6354         parameter for returning script section type.
6355         (Output_section_definition::output_section_name): Ditto.
6356         (Output_section_definition::section_type)P; New method.
6357         (Output_section_definiton::script_section_type_name): Ditto.
6358         (Output_section_definition::script_section_type_): New data member.
6359         (Output_section_definition::Output_section_definition): Initialize
6360         data member Output_section_definition::script_section_type_.
6361         (Output_section_definition::create_sections): Pass script section type
6362         to Layout::make_output_section_for_script.
6363         (Output_section_definition::output_section_name): Return script
6364         section type to caller.
6365         (Output_section_definition::set_section_address): Do not advance
6366         dot value and load address if section type is NOLOAD.  Set address
6367         of NOLOAD sections regardless of section flags.
6368         (Output_section_definition::print): Print section type if it is
6369         not SCRIPT_SECTION_TYPE_NONE.
6370         (Output_section_definition::section_type): New method.
6371         (Output_section_definition::script_section_type_name): Ditto.
6372         (Script_sections::output_section_name): Add new parameter
6373         PSECTION_TYPE for returning script section type.  Pass it to
6374         section elements.  Handle discard sections.
6375         (Sort_output_sections::operator()): Handle NOLOAD sections.
6376         * script-sections.h (Script_sections::Section_type): New enum type.
6377         (Script_sections::output_section_name): Add a new parameter for
6378         returning script section type.
6379         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6380         INFO and NOLOAD.
6381         * yyscript.y (union): Add new field SECTION_TYPE.
6382         (COPY, DSECT, INFO, NOLOAD): New tokens.
6383         (opt_address_and_section_type): Change type to output_section_header.
6384         (section_type): New non-terminal
6385         (section_header): Handle section type.
6386         (opt_address_and_section_type): Return section type value.
6387
6388 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6389
6390         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6391         * testsuite/plugin_common_test_2.c (foo): Likewise.
6392
6393 2010-04-08  Doug Kwan  <dougkwan@google.com>
6394
6395         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6396         Output_merge_data.
6397         * output.cc (Output_section::add_merge_input_section): Simplify
6398         code and return status of Output_merge_base::add_input_section.
6399         Update merge section map only if Output_merge_base::add_input_section
6400         returns true.
6401
6402 2010-04-07  Doug Kwan  <dougkwan@google.com>
6403
6404         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6405         if section is marked as containing instructions but has no mapping
6406         symbols.
6407         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6408         correct section index.
6409         (Arm_relobj::find_linked_text_section): Ditto.
6410
6411 2010-04-07  Cary Coutant  <ccoutant@google.com>
6412
6413         * archive.cc (include_member): Destroy Read_symbols_data object before
6414         releasing file.
6415         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6416         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6417         (Read_symbols_data::~Read_symbols_data) New destructor.
6418         (Section_relocs::Section_relocs) New constructor.
6419         (Section_relocs::~Section_relocs) New destructor.
6420         (Read_relocs_data::Read_relocs_data) New constructor.
6421         (Read_relocs_data::~Read_relocs_data) New destructor.
6422         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6423         pointers to NULL after deleting.
6424
6425 2010-04-07  Doug Kwan  <dougkwan@google.com>
6426
6427         * arm.cc: Replace "endianity" with "endianness" in comments.
6428         (Arm_exidx_cantunwind): Ditto.
6429         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6430         (Arm_relobj::merge_flags_and_attributes): New method.
6431         (Arm_relobj::merge_flags_and_attributes_): New data member.
6432         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6433         (Arm_relobj::scan_sections_for_stubs): Ditto.
6434         (Arm_relobj::do_read_symbols): Check to see if we really want to
6435         merge processor-specific flags and attributes.  Exit early if
6436         an object is empty except for section names and the undefined symbol.
6437         (Target_arm::do_finalize_sections): Move check for ELF format to
6438         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6439         attributes from a regular object only when we have determined that
6440         it is aapropriate.  Do not create an .ARM.attributes section in
6441         output if there is no regular input object.
6442         (Target_arm::merge_processor_specific_flags): Check
6443         --warn-mismatch before printing any error.
6444         (Target_arm::merge_object_attributes): Ditto.
6445         * gold.cc (queue_middle_tasks): Handle the case in which there is
6446         no regular object in input.
6447         * options.cc (General_options::parse_EB): New method.
6448         (General_options::parse_EL): Same.
6449         (General_options::General_options): Initialize endianness_.
6450         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6451         New options.
6452         (General_options::Endianness): New enum.
6453         (General_options::endianness): New method.
6454         (General_options::endianness_): New data member.
6455         * parameters.cc (Parameters::set_options): Check target endianness.
6456         (Parameters::set_target_once): Ditto.
6457         (Parameters::check_target_endianness): New method.
6458         (parameters_force_valid_target): If either -EL or -EB is specified,
6459         use it to define endianness of default target.
6460         * parameters.h (Parameters::check_target_endianness): New method
6461         declaration.
6462         * target.h (class Target): Change "endianity" to "endianness"
6463         in comments.
6464
6465 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6466
6467         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6468         * configure: Regenerate.
6469         * Makefile.in: Regenerate.
6470         * testsuite/Makefile.in: Regenerate.
6471
6472 2010-04-06  Cary Coutant  <ccoutant@google.com>
6473
6474         gcc PR lto/42757
6475         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6476         prevailing definitions of common symbols.
6477         * testsuite/plugin_test_6.sh: New test case.
6478         * testsuite/plugin_common_test_1.c: New test case.
6479         * testsuite/plugin_common_test_2.c: New test case.
6480         * testsuite/Makefile.am (plugin_test_6): New test case.
6481         * testsuite/Makefile.in: Regenerate.
6482
6483 2010-04-06  Nick Clifton  <nickc@redhat.com>
6484
6485         * po/vi.po: New Vietnamese translation.
6486
6487 2010-03-30  Doug Kwan  <dougkwan@google.com>
6488
6489         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6490
6491 2010-03-25  Doug Kwan  <dougkwan@google.com>
6492
6493         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6494         to avoid a conversion warning on a 32-bit host.
6495
6496 2010-03-24  Ian Lance Taylor  <iant@google.com>
6497
6498         * testsuite/script_test_3.t: Add a TLS segment.
6499         * testsuite/Makefile.am (check_PROGRAMS): Add
6500         tls_phdrs_script_test.
6501         (tls_phdrs_script_test_SOURCES): Define.
6502         (tls_phdrs_script_test_DEPENDENCIES): Define.
6503         (tls_phdrs_script_test_LDFLAGS): Define.
6504         (tls_phdrs_script_test_LDADD): Define.
6505         * testsuite/Makefile.in: Rebuild.
6506
6507 2010-03-23  Cary Coutant  <ccoutant@google.com>
6508
6509         * fileread.cc (find_or_make_view): Fix comment.
6510
6511 2010-03-23  Ian Lance Taylor  <iant@google.com>
6512
6513         * script-sections.cc (class Orphan_section_placement): Define
6514         PLACE_TLS and PLACE_TLS_BSS.
6515         (Orphan_section_placement::Orphan_section_placement): Initialize
6516         new places.
6517         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6518         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6519         (tls_script_test_SOURCES): Define.
6520         (tls_script_test_DEPENDENCIES): Define.
6521         (tls_script_test_LDFLAGS): Define.
6522         (tls_script_test_LDADD): Define.
6523         * testsuite/Makefile.in: Rebuild.
6524
6525 2010-03-22  Doug Kwan  <dougkwan@google.com>
6526
6527         * arm.cc (Arm_relocate_functions::abs8,
6528         Arm_relocate_functions::abs16): Use correct check for overflow
6529         specified in the ARM ELF specs.
6530         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6531         target of a BLX instruction specially.
6532         (Reloc_stub::stub_type_for_reloc): Ditto.
6533         (Relocate::relocate): Use symbolic names instead of numeric relocation
6534         codes to report error.
6535         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6536         workaround.
6537         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6538         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6539         thumb2_blx_out_of_range.stdout
6540         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6541         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6542         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6543         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6544         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6545         thumb2_blx_in_range, thumb2_blx_in_range.o,
6546         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6547         thumb2_blx_out_of_range.o): New rules.
6548         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6549         thumb2_blx_in_range and thumb2_blx_out_of_range.
6550         * testsuite/Makefile.in: Regenerate.
6551         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6552         * testsuite/thumb_blx_in_range.s: New file.
6553         * testsuite/thumb_blx_out_of_range.s: New file.
6554
6555 2010-03-22  Rafael Espindola  <espindola@google.com>
6556
6557         * archive.cc (Should_include): Move to archive.h.
6558         (should_include_member): Make it a member of Archive.
6559         (Lib_group): New.
6560         (Add_lib_group_symbols): New.
6561         * archive.h: Include options.h.
6562         (Archive_member): Moved from Archive.
6563         (Should_include): Moved from archive.cc.
6564         (Lib_group): New.
6565         (Add_lib_group_symbols): New.
6566         * dynobj.cc (do_should_include_member): New.
6567         * dynobj.h (do_should_include_member): New.
6568         * gold.cc (queue_initial_tasks): Update call to queue.
6569         * main.cc (main): Print lib group stats.
6570         * object.cc (do_should_include_member): New.
6571         * object.h: Include archive.h.
6572         (Object::should_include_member): New.
6573         (Object::do_should_include_member): New.
6574         (Sized_relobj::do_should_include_member): New.
6575         * options.cc (General_options::parse_start_lib): New.
6576         (General_options::parse_end_lib): New.
6577         (Input_arguments::add_file): Handle lib groups.
6578         (Input_arguments::start_group): Check we are not in a lib.
6579         (Input_arguments::start_lib): New.
6580         (Input_arguments::end_lib): New.
6581         * options.h (General_options): Add start_lib and end_lib.
6582         (Input_argument::lib_): New.
6583         (Input_argument::lib): New.
6584         (Input_argument::is_lib): New.
6585         (Input_file_lib): New.
6586         (Input_arguments::in_lib_): New.
6587         (Input_arguments::in_lib): New.
6588         (Input_arguments::start_lib): New.
6589         (Input_arguments::end_lib_): New.
6590         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6591         in unused members as preempted.
6592         (Sized_pluginobj::do_should_include_member): New.
6593         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6594         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6595         return the blocker.
6596         (Read_symbols::do_whole_lib_group): New.
6597         (Read_symbols::do_lib_group): New.
6598         (Read_symbols::do_read_symbols): Handle lib groups.
6599         (Read_symbols::get_name): Handle lib groups.
6600         * readsyms.h (Read_symbols): Add an archive member pointer.
6601         (Read_symbols::do_whole_lib_group): New.
6602         (Read_symbols::do_lib_group): New.
6603         (Read_symbols::member_): New.
6604         * script.cc (read_input_script): Update call to queue_soon.
6605
6606 2010-03-19  Doug Kwan  <dougkwan@google.com>
6607
6608         * arm.cc (Stub_table::Stub_table): Initialize new data members
6609         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6610         (Stub_table::add_reloc_stub): Assign stub offset and update
6611         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6612         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6613         New data members.
6614         (Stub_table::update_data_size_and_addralign): Use
6615         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6616         instead of going over all reloc stubs.
6617         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6618         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6619         Stringpool_template::offset_ to size of Stringpool_char.
6620         (Stringpool_template::new_key_offset): Remove code to initialize
6621         Stringpool_template::offset_.
6622         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6623         Stringpool_template::offset_ to zero.
6624
6625 2010-03-15  Doug Kwan  <dougkwan@google.com>
6626
6627         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6628         offset_.
6629         (Stringpool_template::new_key_offset): New method.
6630         (Stringpool_template::add_string): Assign offsets when adding new
6631         strings.
6632         (Stringpool_template::set_string_offsets): Do not set string offsets
6633         when not optimizing.
6634         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6635         member size_.
6636         (Chunked_vector::clear): Clear size_.
6637         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6638         (Chunked_vector::size): Return size_.
6639         (Chunked_vector::push_back): Use size_ to find insert position.
6640         (Chunked_vector::size_): New data member.
6641         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6642         (Stringpool_template::new_key_offset): New method declaration.
6643         (Stringpool_template::offset_): New data member.
6644
6645 2010-03-15   Rafael Espindola  <espindola@google.com>
6646
6647         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6648         Add_symbols' constructor.
6649         * readsyms.h (Add_symbols): Remove the input_group member.
6650
6651 2010-03-10  Ian Lance Taylor  <iant@google.com>
6652
6653         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6654         target to ask whether a reference to a symbol requires a stack
6655         split.
6656         * target.h (Target::is_call_to_non_split): New function.
6657         (Target::do_is_call_to_non_split): Declare virtual function.
6658         * target.cc: Include "symtab.h".
6659         (Target::do_is_call_to_non_split): New function.
6660         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6661
6662 2010-03-10  Cary Coutant  <ccoutant@google.com>
6663
6664         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6665         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6666         (File_read::open[2]): Add whole_file_view_ to list of views.
6667         (File_read::make_view): Remove test of whole_file_view_.
6668         (File_read::find_or_make_view): Create whole_file_view_ if
6669         necessary.
6670         (File_read::clear_views): Replace bool parameter with enum;
6671         adjust all callers.  Don't delete views with permanent data;
6672         do delete cached views and views from archives if
6673         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6674         if clearing the corresponding view.
6675         * fileread.h (File_read::Clear_views_mode): New enum.
6676         (File_read::View::is_permanent_view): New method.
6677         (File_read::clear_views): Replace bool parameter
6678         with enum; adjust all callers.
6679         * options.h (General_options): Change keep_files_mapped option;
6680         add map_whole_files.
6681         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6682         releasing the file.
6683         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6684         the file.
6685
6686 2010-03-10  David S. Miller  <davem@davemloft.net>
6687
6688         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6689
6690 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6691
6692         * icf.cc (get_section_contents): Add '@' marker after processing the
6693         merge reloc.
6694
6695 2010-03-08  Doug Kwan  <dougkwan@google.com>
6696
6697         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6698         due to a conversion warning.
6699         (Arm_relobj::update_output_local_symbol_count): Check for local
6700         symbol with unset output index.
6701
6702 2010-03-05  Ian Lance Taylor  <iant@google.com>
6703
6704         * options.h (class General_options): Add --spare-dynamic-tags.
6705         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6706         --spare-dynamic-tags.
6707
6708 2010-03-05  Ian Lance Taylor  <iant@google.com>
6709
6710         * incremental.cc: Include "libiberty.h".
6711
6712 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6713
6714         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6715         function, is_info_ member.
6716         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6717         (Versions::Versions): Update caller.
6718         (Versions::define_base_version): Likewise.
6719         (Versions::add_def): Likewise.
6720
6721 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6722
6723         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6724         (Scan::possible_function_pointer_reloc): New function.
6725         (Scan::local_reloc_may_be_function_pointer): Change to call
6726         possible_function_pointer_reloc.
6727         (Scan::global_reloc_may_be_function_pointer): Ditto.
6728         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6729         relocations in ".data.rel.ro._ZTV" section.
6730         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6731         * testsuite/icf_safe_so_test.cc: Ditto.
6732         * testsuite/icf_safe_test.cc: Ditto.
6733         * testsuite/icf_safe_test.sh: Ditto.
6734
6735 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6736             Ian Lance Taylor  <iant@google.com>
6737
6738         * target-reloc.h (relocate_section): Check the symbol table index
6739         for -1U before setting the local symbol index.
6740         (scan_relocatable_relocs): If copying the relocation, record that
6741         the local symbol is required.
6742         * object.h (Symbol_value::is_output_symtab_index_set): New
6743         function.
6744         (Symbol_value::may_be_discarded_from_output_symtab): New
6745         function.
6746         (Symbol_value::has_output_symtab_entry): New function.
6747         (Symbol_value::needs_output_symtab_entry): Remove.
6748         (Symbol_value::output_symtab_index): Make sure the symbol index is
6749         set.
6750         (Symbol_value::set_output_symtab_index): Make sure the symbol
6751         index is not set.  Make sure the new index is valid.
6752         (Symbol_value::set_must_have_output_symtab_entry): New function.
6753         (Symbol_value::has_output_dynsym_entry): New function.
6754         (Symbol_value::set_output_dynsym_index): Make sure the new index
6755         is valid.
6756         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6757         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6758         local symbol if permitted.
6759         (Sized_relobj::do_finalize_local_symbols): Call
6760         is_output_symtab_index_set rather than needs_output_symtab_entry.
6761         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6762         rather than needs_output_symtab_entry.  Call
6763         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6764         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6765         is_output_symtab_index_set rather than needs_output_symtab_entry.
6766         * testsuite/discard_locals_relocatable_test.c: New file.
6767         * testsuite/discard_locals_test.sh: Test -r.
6768         * testsuite/Makefile.am (check_DATA): Add
6769         discard_locals_relocatable_test1.syms,
6770         discard_local_relocatable_test2.syms.
6771         (MOSTLYCLEANFILES): Likewise.  Also add
6772         discard_locals_relocatable_test1.lout and
6773         discard_locals_relocatable_test2.out.
6774         (discard_locals_relocatable_test1.syms): New target.
6775         (discard_locals_relocatable_test.o): New target.
6776         (discard_locals_relocatable_test1.out): New target.
6777         (discard_locals_relocatable_test2.syms): New target.
6778         (discard_locals_relocatable_test2.out): New target.
6779         (various): Add missing ../ld-new dependencies.
6780         * testsuite/Makefile.in: Rebuild.
6781
6782 2010-03-03  Nick Clifton  <nickc@redhat.com>
6783
6784         * po/fi.po: New Finnish translation.
6785
6786 2010-03-01  Doug Kwan  <dougkwan@google.com>
6787
6788         * layout.cc (Layout::Layout): Force section types of .init_array*,
6789         .preinit_array* and .fini_array* sections.
6790         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6791         Fix check of return value of std::string::find.().
6792         (Output_section::Input_section_sort_compare::operator()): Remove
6793         comment about .init_array.
6794         (Output_section::Input_section_sort_init_fini_compare::operator()):
6795         New method.
6796         (Output_section::sort_attached_input_sections): Handle .init_array
6797         and .fini_array specially.
6798         * output.h (Output_section::Inut_section_sort_compare): Update
6799         comment.
6800         (Output_section::Input_section_sort_init_fini_compare): New struct.
6801
6802 2010-02-26  Doug Kwan  <dougkwan@google.com>
6803
6804         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6805         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6806         * testsuite/debug_msg.sh: Avoid matching source line number for
6807         use of global variable undef_int.
6808
6809 2010-02-26  Doug Kwan  <dougkwan@google.com>
6810
6811         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6812         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6813         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6814         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6815         * options.cc (General_options::General_options): Initialize member
6816         fix_v4bx_.
6817         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6818         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6819         and rm_no_fix_v4bx.stdout
6820         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6821         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6822         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6823         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6824         and arm_no_fix_v4bx.
6825         * Makefile.in: Regenerate.
6826         * testsuite/arm_fix_v4bx.s: New file.
6827         * testsuite/arm_fix_v4bx.sh: Ditto.
6828
6829 2010-02-24  Doug Kwan  <dougkwan@google.com>
6830
6831         * arm.cc (Target_arm::got_section): Make the .got section the first
6832         non RELRO section in the data segment.
6833         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6834         suffixes of section names.
6835
6836 2010-02-24  Doug Kwan  <dougkwan@google.com>
6837
6838         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6839         flags and attributes merging if an input file is a binary file.
6840         * fileread.cc (Input_file::open): Record format of original file.
6841         * fileread.h (Input_file::Format): New enum type.
6842         (Input_file::Input_file): Initialize data member format_.
6843         (Input_file::format): New method definition.
6844         (Input_file::format_):: New data member.
6845
6846 2010-02-24  Doug Kwan  <dougkwan@google.com>
6847
6848         * arm.cc (Arm_output_data_got): New class.
6849         (ARM_TCB_SIZE): New constant
6850         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6851         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6852         If user uses a script with a SECTIONS clause, issue only a warning
6853         for a misplaced EXIDX input section.  Otherwise, issue an error.
6854         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6855         garbage collection.
6856         (Target_arm::got_mode_index_entry): Handle static linking.
6857         (Target_arm::Scan::local): Ditto.
6858         (Target_arm::Scan::global): Ditto.
6859         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6860         all incorrectly implemented relocations.
6861         (Target_arm::fix_exidx_coverage): Pass layout to
6862         Arm_output_section::fix_exidx_coverage.
6863         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6864         from ".ARM.exidx." and ".ARM.extab.".
6865
6866 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6867
6868         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6869         section if it does not already exist.
6870         * attributes.cc (Attributes_section_data::Attributes_section_data):
6871         Don't crash if size is zero.
6872
6873 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6874             Ian Lance Taylor  <iant@google.com>
6875
6876         * gold.cc (queue_middle_tasks): If no input files were opened,
6877         exit.
6878         * workqueue.h (Task_function::Task_function): Assert that there is
6879         a blocker.
6880
6881 2010-02-22  Doug Kwan  <dougkwan@google.com>
6882
6883         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6884         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6885         types to avoid warnings due to different uint64_t implementations
6886         on different hosts.
6887
6888 2010-02-21  Doug Kwan  <dougkwan@google.com>
6889
6890         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6891         handling of the maximum backward branch offset.
6892         (Arm_relocate_functions::thumb_branch_common): Ditto.
6893         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6894         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6895         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6896         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6897         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6898         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6899         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6900         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6901         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6902         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6903         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6904         thumb2_bl_out_of_range.o): New rules.
6905         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6906         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6907         thumb2_bl_out_of_range
6908         * testsuite/Makefile.in: Regenerate.
6909         * testsuite/arm_bl_in_range.s: New file.
6910         * testsuite/arm_bl_out_of_range.s: Ditto.
6911         * testsuite/arm_branch_in_range.sh: Ditto.
6912         * testsuite/arm_branch_range.t: Ditto.
6913         * testsuite/thumb2_branch_range.t: Ditto.
6914         * testsuite/thumb_bl_in_range.s: Ditto.
6915         * testsuite/thumb_bl_out_of_range.s: Ditto.
6916         * testsuite/thumb_branch_range.t: Ditto.
6917
6918 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6919
6920         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6921         Add reloc offset information.
6922         * icf.cc (get_section_contents): Change iterators to point to the new
6923         vectors. Add reloc offset information to the contents.
6924         * icf.h (Icf::Sections_reachable_info): New typedef.
6925         (Icf::Sections_reachable_list): New typedef.
6926         (Icf::Offset_info): New typedef.
6927         (Icf::Reloc_info): New struct typedef.
6928         (Icf::Reloc_info_list): New typedef.
6929         (Icf::symbol_reloc_list): Delete method.
6930         (Icf::addend_reloc_list): Delete method.
6931         (Icf::section_reloc_list): Delete method.
6932         (Icf::reloc_info_list): New method.
6933         (Icf::reloc_info_list_): New member.
6934
6935 2010-02-19  Doug Kwan  <dougkwan@google.com>
6936
6937         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6938         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6939         * arm.cc (Arm_relocation_functions): New forward declaration.
6940         (Target_arm::Target_arm): Initialize new data members
6941         got_mod_index_offset_ and tls_base_symbol_defined_.
6942         (Target_arm::Relocate::relocate_tls): New method.
6943         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6944          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6945         New methods.
6946         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6947         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6948         (Target_arm::got_mod_index_offset_,
6949         Target_arm::tls_base_symbol_defined_): New data members.
6950         (Target_arm::Scan::local, Target::Scan::global,
6951         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6952         relocations.
6953
6954 2010-02-18  Doug Kwan  <dougkwan@google.com>
6955
6956         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6957         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6958         text section as a parameter becuase some broken tools may not set
6959         the link in section header.
6960         (Target_arm::has_got_section): New method.
6961         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6962         without any mapping symbol as data only.  Remove warning.
6963         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6964         link in its section header, try to discover the link by inspecting the
6965         REL31 relocation at the beginning of the section.
6966         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6967         in error message.
6968         (Target_arm::Scan::global): Treat any reference to the symbol
6969         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6970
6971 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6972
6973         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6974         (Scan::global_reloc_may_be_function_pointer): New function.
6975         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6976         (Scan::global_reloc_may_be_function_pointer): New function.
6977         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6978         (Scan::global_reloc_may_be_function_pointer): New function.
6979         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6980         (Scan::global_reloc_may_be_function_pointer): New function.
6981         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6982         (Scan::global_reloc_may_be_function_pointer): New function.
6983         (Scan::possible_function_pointer_reloc): New function.
6984         (Target_x86_64::can_check_for_function_pointers): New function.
6985         * gc.h (gc_process_relocs): Scan relocation types to determine if
6986         function pointers were taken for targets that support it.
6987         * icf.cc (Icf::find_identical_sections): Include functions for
6988         folding in safe ICF whose pointer is not taken.
6989         * icf.h (Secn_fptr_taken_set): New typedef.
6990         (fptr_section_id_): New member.
6991         (section_has_function_pointers): New function.
6992         (set_section_has_function_pointers): New function.
6993         (check_section_for_function_pointers): New function.
6994         * options.h: Fix comment for safe ICF option.
6995         * target.h (can_check_for_function_pointers): New function.
6996         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6997         Modify icf_safe_test for X86-64.
6998         * testsuite/Makefile.in: Regenerate.
6999         * testsuite/icf_safe_so_test.cc: New file.
7000         * testsuite/icf_safe_so_test.sh: New file.
7001         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7002         (main): Change to take pointer to function kept_func_3.
7003         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7004         folding is done correctly for X86-64.
7005
7006 2010-02-12  David S. Miller  <davem@davemloft.net>
7007
7008         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7009         is_symbolless parameter.
7010         (Output_reloc<SHT_REL>::is_symbolless): New.
7011         (Output_reloc<SHT_REL>::is_symbolless_): New.
7012         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7013         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7014         (Output_reloc<SHT_RELA>::is_symbolless): New.
7015         (Output_data_reloc::add_global): Handle is_symbolless.
7016         (Output_data_reloc::add_global_relative): Likewise.
7017         (Output_data_reloc::add_local): Likewise.
7018         (Output_data_reloc::add_local_relative): Likewise.
7019         (Output_data_reloc::add_symbolless_global_addend): New.
7020         (Output_data_reloc::add_symbolless_local_addend): New.
7021         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7022         is_symbolless.
7023         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7024         instead of ->is_relative_
7025         (Output_reloc::write): Likewise.
7026         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7027         (Output_reloc::write_rel): Simplify.
7028
7029         * sparc.cc (Target_sparc::Scan::local): Use
7030         ->add_symbolless_local_addend as needed.
7031         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7032         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7033         based upon relocation offset.
7034
7035 2010-02-11  Doug Kwan  <dougkwan@google.com>
7036
7037         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7038         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7039         beginning of function.
7040         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7041         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7042         parameter is_32bit in calls to should_apply_static_reloc.
7043         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7044         (check_DATA): Add arm_abs_global.stdout.
7045         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7046         arm_abs_global.stdout): New rules.
7047         (MOSTLLYCLEANFILES): Add arm_abs_global
7048         * Makefile.in: Regenerate.
7049         * testsuite/arm_abs_global.s: New file.
7050         * testsuite/arm_abs_global.sh: Ditto.
7051         * testsuite/arm_abs_lib.s: Ditto.
7052
7053 2010-02-11  Ian Lance Taylor  <iant@google.com>
7054
7055         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7056         Read_relocs task.
7057         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7058         Allocate_commons_task first.
7059         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7060         task, rather than symtab_lock_.
7061         (Gc_process_relocs::~Gc_process_relocs): New function.
7062         (Gc_process_relocs::is_runnable): Check this_blocker_.
7063         (Gc_process_relocs::locks): Use next_blocker_ rather than
7064         blocker_.
7065         (Scan_relocs::~Scan_relocs): New function.
7066         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7067         symtab_lock_.
7068         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7069         next_blocker_.
7070         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7071         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7072         constructor accordingly.
7073         (class Gc_process_relocs): Likewise.
7074         (class Scan_relocs): Likewise.
7075         * common.h (class Allocate_commons_task): Remove symtab_lock_
7076         field, and corresponding constructor parameter.
7077         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7078         symtab_lock_.
7079         (Allocate_commons_task::locks): Likewise.
7080
7081 2010-02-11  Ian Lance Taylor  <iant@google.com>
7082
7083         * gold-threads.h (class Once): Define.
7084         (class Initialize_lock): Rewrite as child of Once.
7085         * gold-threads.cc (class Once_initialize): Define.
7086         (once_pointer_control): New static variable.
7087         (once_pointer, once_arg): New static variables.
7088         (c_run_once): New static function.
7089         (Once::Once, Once::run_once, Once::internal_run): New functions.
7090         (class Initialize_lock_once): Remove.
7091         (initialize_lock_control): Remove.
7092         (initialize_lock_pointer): Remove.
7093         (initialize_lock_once): Remove.
7094         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7095         (Initialize_lock::initialize): Rewrite.
7096         (Initialize_lock::do_run_once): New function.
7097         * archive.cc (Archive::interpret_header): Only clear name if it is
7098         not already empty.
7099         * fileread.cc: Include "gold-threads.h"
7100         (file_counts_lock): New static variable.
7101         (file_counts_initialize_lock): Likewise.
7102         (File_read::release): Only increment counts when using --stats.
7103         Use a lock around the increment.
7104         * parameters.cc (class Set_parameters_target_once): Define.
7105         (set_parameters_target_once): New static variable.
7106         (Parameters::Parameters): Move here from parameters.h.
7107         (Parameters::set_target): Rewrite.
7108         (Parameters::set_target_once): New function.
7109         (Parameters::clear_target): Move here and rewrite.
7110         * parameters.h (class Parameters): Update declarations.  Add
7111         set_parameters_target_once_ field.
7112         (Parameters::Parameters): Move to parameters.cc.
7113         (Parameters::clear_target): Likewise.
7114         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7115         task.
7116         (Start_group::~Start_group): New function.
7117         (Start_group::is_runnable): New function.
7118         (Start_group::locks, Start_group::run): New functions.
7119         (Finish_group::run): Change saw_undefined to size_t.
7120         * readsyms.h (class Start_group): Define.
7121         (class Finish_group): Change saw_undefined_ field to size_t.
7122         (Finish_group::Finish_group): Remove saw_undefined and
7123         this_blocker parameters.  Change all callers.
7124         (Finish_group::set_saw_undefined): New function.
7125         (Finish_group::set_blocker): New function.
7126         * symtab.h (class Symbol_table): Change saw_undefined to return
7127         size_t.  Change saw_undefined_ field to size_t.
7128         * target-select.cc (Set_target_once::do_run_once): New function.
7129         (Target_selector::Target_selector): Initialize set_target_once_
7130         field.  Don't initialize lock_ and initialize_lock_ fields.
7131         (Target_selector::instantiate_target): Rewrite.
7132         (Target_selector::set_target): New function.
7133         * target-select.h (class Set_target_once): Define.
7134         (class Target_selector): Update declarations.  Make
7135         Set_target_once a friend.  Remove lock_ and initialize_lock_
7136         fields.  Add set_target_once_ field.
7137
7138 2010-02-10  Ian Lance Taylor  <iant@google.com>
7139
7140         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7141         queueing any tasks.
7142         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7143         (queue_middle_tasks): Add all blockers before queueing any tasks.
7144         (queue_final_tasks): Likewise.
7145         * token.h (Task_token::add_blockers): New function.
7146         * object.h (Input_objects::number_of_relobjs): New function.
7147
7148 2010-02-10  Ian Lance Taylor  <iant@google.com>
7149
7150         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7151         shared, not if not position independent.
7152         * x86_64.cc (Relocate::relocate_tls): Likewise.
7153         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7154         (tls_pie_pic_test): New target.
7155         * testsuite/Makefile.in: Rebuild.
7156
7157         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7158         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7159         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7160         * testsuite/Makefile.in: Rebuild.
7161
7162 2010-02-09  David S. Miller  <davem@davemloft.net>
7163
7164         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7165         R_SPARC_RELATIVE using ->add_local_relative().
7166         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7167
7168         * output.h (Output_data_dynamic::add_section_size): New method
7169         that takes two Output_data objects.
7170         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7171         entry param.  Handle it in initializers.
7172         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7173         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7174         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7175         arg.
7176         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7177         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7178         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7179         for dynrel_includes_plt.
7180         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7181         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7182         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7183         before .rela.plt
7184         (Target_sparc::do_finalize_sections): Update to pass true for
7185         dynrel_includes_plt.
7186         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7187         output before .rela.plt
7188         (Target_powerpc::do_finalize_sections): Update to pass true for
7189         dynrel_includes_plt when 32-bit.
7190
7191 2010-02-08  Doug Kwan  <dougkwan@google.com>
7192
7193         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7194         method.
7195         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7196         Arm_relobj::scan_section_for_cortex_a8_stubs,
7197         Arm_relobj::do_relocation_section): Instead of calling
7198         Output_section::output_address, use faster
7199         Arm_relobj::simple_input_section_output_address.
7200
7201 2010-02-08  David S. Miller  <davem@davemloft.net>
7202
7203         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7204         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7205         relocation helper function.
7206
7207         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7208         just like R_SPARC_GOT{10,13,22}.
7209         (Target_sparc::Scan::local): Likewise.
7210         (Target_sparc::Relocate:relocate): Likewise.
7211
7212 2010-02-06  Ian Lance Taylor  <iant@google.com>
7213
7214         * configure.ac: Rewrite targetobjs duplicate removal code to use
7215         only shell constructs.
7216         * configure: Rebuild.
7217
7218 2010-02-05  Doug Kwan  <dougkwan@google.com>
7219
7220         PR 11247
7221         * arm.cc (Arm_relobj::section_is_scannable): New method.
7222         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7223         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7224
7225 2010-02-04  Doug Kwan  <dougkwan@google.com>
7226
7227         PR 11247
7228         * arm-reloc-property.cc (cstdio): Include.
7229         * configure.ac (targetobjs): Remove duplicates.
7230         * configure: Regenerate.
7231         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7232         big and little endian version for a given address size.
7233
7234 2010-02-03  Doug Kwan  <dougkwan@google.com>
7235
7236         * arm-reloc-property.cc
7237         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7238         definition.
7239         * arm-reloc-property.h
7240         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7241         New method definition.
7242         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7243         declaration.
7244         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7245         overflow to N.
7246         (GOT_PREL): Change implemented to Y.
7247         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7248         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7249         (Arm_relocate_functions::movw_abs_nc): Remove method.
7250         (Arm_relocate_functions::movt_abs): Ditto.
7251         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7252         (Arm_relocate_functions::thm_movt_abs): Ditto.
7253         (Arm_relocate_functions::movw_rel_nc): Ditto.
7254         (Arm_relocate_functions::movw_rel): Ditto.
7255         (Arm_relocate_functions::movt_rel): Ditto.
7256         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7257         (Arm_relocate_functions:thm_movw_rel): Ditto.
7258         (Arm_relocate_functions:thm_movt_rel): Ditto.
7259         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7260         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7261         New method definitions.
7262         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7263         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7264         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7265         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7266         (Target_arm::Relocate::relocate): Check for non-static or
7267         unimplemented relocation code and exit early.  Change calls to
7268         Target_arm::reloc_uses_thumb_bit and
7269         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7270         instead.  Refactor code to handle similar relocations to increase
7271         code sharing.  Remove check for unsupported relocation code in switch
7272         statement.
7273         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7274         relocation property table to find out size.  Change error message to
7275         print out the name of a relocation code instead of the numeric value.
7276         (Target_arm::scan_reloc_for_stub): Use relocation property table
7277         instead of calling Target_arm::reloc_uses_thumb_bit().
7278
7279 2010-02-02  Doug Kwan  <dougkwan@google.com>
7280
7281         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7282         types of relaxed input section.
7283
7284 2010-02-02  Doug Kwan  <dougkwan@google.com>
7285
7286         * Makefile.am (HFILES): Add arm-reloc-property.h.
7287         (DEFFILES): New.
7288         (TARGETSOURCES): Add arm-reloc-property.cc
7289         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7290         (libgold_a_SOURCES): $(DEFFILES)
7291         * Makefile.in: Regenerate.
7292         * arm-reloc-property.cc: New file.
7293         * arm-reloc-property.h: New file.
7294         * arm-reloc.def: New file.
7295         * arm.cc: Update comments.
7296         (arm-reloc-property.h): New included header.
7297         (arm_reloc_property_table): New global variable.
7298         (Target_arm::do_select_as_default_target): New method definition.
7299         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7300         arm-reloc-property to targ_extra_obj.
7301         * parameters.cc (set_parameters_target): Call
7302         Target::select_as_default_target().
7303         * target.h (Target::select_as_default_target): New method definition.
7304         (Target::do_select_as_default_target): Same.
7305
7306 2010-02-01  Doug Kwan  <dougkwan@google.com>
7307
7308         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7309         first_output_text_section_.
7310         (Arm_exidx_fixup::first_output_text_section): New method definition.
7311         (Arm_exidx_fixup::first_output_text_section_): New data member.
7312         (Arm_exidx_fixup::process_exidx_section): Record the first text
7313         output section seen.
7314         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7315         and entsize in output section header.
7316
7317 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7318
7319         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7320         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7321         (Arm_relocate_functions::thm_alu11): New Method.
7322         (Arm_relocate_functions::thm_pc8): New Method.
7323         (Arm_relocate_functions::thm_pc12): New Method.
7324         (Target_arm::Scan::local): Handle the relocations.
7325         (Target_arm::Scan::global): Likewise.
7326         (Target_arm::Relocate::relocate): Likewise.
7327         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7328
7329 2010-01-29  Doug Kwan  <dougkwan@google.com>
7330
7331         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7332         of relocation types as ld.
7333
7334 2010-01-29  Doug Kwan  <dougkwan@google.com>
7335
7336         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7337         to public.
7338         (Arm_relocate_functions::thumb_branch_common): Ditto.
7339         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7340         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7341         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7342         Arm_relocate_functions::jump24): Remove.
7343         (Target_arm::Relocate::relocate): Adjust code to call
7344         Arm_relocation_functions::arm_branch_common and
7345         Arm_relocation_functions::thumb_branch_common instead of their removed
7346         wrappers.  Merge switch-cases together to reduce source code size.
7347
7348 2010-01-29  Doug Kwan  <dougkwan@google.com>
7349
7350         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7351         output_local_symbol_count_needs_update_.
7352         (Arm_relobj::output_local_symbol_count_needs_update,
7353          Arm_relobj::set_output_local_symbol_count_needs_update,
7354          Arm_relobj::update_output_local_symbol_count): New methods.
7355         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7356         member.
7357         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7358         of pointed function as in a R_ARM_PREL31 relocation.
7359         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7360         for output local symbol count updating.
7361         (Target_arm::do_relax): Update output local symbol counts in objects
7362         if necessary.
7363         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7364
7365 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7366
7367         * arm.cc: Added support for the ARM relocations:
7368         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7369         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7370         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7371         movw_prel_nc).
7372         (Arm_relocate_functions::movw_rel): New method.
7373         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7374         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7375         thm_movw_prel_nc).
7376         (Arm_relocate_functions::thm_movw_rel): New method.
7377         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7378         thm_movt_prel).
7379         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7380         relocations.
7381         (Target_arm::Scan::global): Likewise.
7382         (Target_arm::Relocate::relocate): Likewise.
7383         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7384         Likewise.
7385
7386 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7387
7388         * arm.cc: Added support for ARM group relocations.
7389         (Target_arm::reloc_needs_sym_origin): New method.
7390         (Arm_relocate_functions::calc_grp_kn): New method.
7391         (Arm_relocate_functions::calc_grp_residual): New method.
7392         (Arm_relocate_functions::calc_grp_gn): New method.
7393         (Arm_relocate_functions::arm_grp_alu): New Method.
7394         (Arm_relocate_functions::arm_grp_ldr): New Method.
7395         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7396         (Arm_relocate_functions::arm_grp_ldc): New Method.
7397         (Target_arm::Scan::local): Handle the ARM group relocations.
7398         (Target_arm::Scan::global): Likewise.
7399         (Target_arm::Relocate::relocate): Likewise.
7400         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7401         Likewise.
7402
7403 2010-01-26  Doug Kwan  <dougkwan@google.com>
7404
7405         * arm.cc (set): Include.
7406         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7407         pointer type.
7408         (Arm_output_section::Text_section_list): New type.
7409         (Arm_output_section::append_text_sections_to_list): New method.
7410         (Arm_output_section::fix_exidx_coverage): Ditto.
7411         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7412         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7413         Relobj::set_section_offset() instead of
7414         Sized_relobj::invalidate_section_offset().
7415         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7416         parameter for section headers. Ignore relocation sections for
7417         unallocated sections and EXIDX sections.
7418         (Target_arm::fix_exidx_coverage): New method.
7419         (Target_arm::output_section_address_less_than): New type.
7420         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7421         linked text section instead of the EXIDX section.
7422         (Arm_output_section::create_stub_group): Add an assertion to check
7423         that this is not an EXIDX output section.
7424         (Arm_output_section::append_text_sections_to_list): New method.
7425         (Arm_output_section::fix_exidx_coverage): Ditto.
7426         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7427         Arm_relobj::section_needs_reloc_stub_scanning.
7428         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7429         first pass.
7430         (Target_arm::fix_exidx_coverage): New method.
7431         * object.h (Relobj::set_output_section): New method.
7432         (Sized_relobj::invalidate_section_offset): Remove method.
7433         (Sized_relobj::do_invalidate_section_offset): Remove method.
7434         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7435
7436 2010-01-25  Doug Kwan  <dougkwan@google.com>
7437
7438         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7439         Fix warning due to signed and unsigned comparison on a 32-bit host.
7440
7441 2010-01-22  Doug Kwan  <dougkwan@google.com>
7442
7443         * arm.cc (Target_arm::do_relax): Record an output section for section
7444         offset adjustment it contains any stub table that has changed.
7445         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7446         offsets in an output section if necessary.
7447         * output.cc (Output_section::Output_section): Initialize
7448         section_offsets_need_adjustments_.
7449         (Output_section::add_input_section_for_script): Renamed to
7450         Output_section::add_simple_input_section.
7451         (Output_section::save_states): Add a comment.
7452         (Output_section::discard_states): New method defintion.
7453         (Output_section::adjust_section_offsets): Same.
7454         * output.h (Output_section::add_input_section_for_script): Renamed to
7455         Output_section::add_simple_input_section.
7456         (Output_section::discard_states): New method declaration.
7457         (Output_section::adjust_section_offsets): Same.
7458         (Output_section::section_offsets_need_adjustment,
7459         Output_section::set_section_offsets_need_adjustment): New method
7460         definitions.
7461         (Output_section::section_offsets_need_adjustment_): New data member.
7462         * script-sections.cc
7463         (Output_section_element_input::set_section_address): Adjust code for
7464         renaming of Output_section::add_input_section_for_script.
7465         (Orphan_output_section::set_section_address): Same.
7466
7467 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7468
7469         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7470         Fix_v4bx enum values .
7471         * gold/options.h (General_options): New option definitions.
7472         (General_options::fix_v4bx): New method.
7473         (General_options::Fix_v4bx): New enum.
7474         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7475         (General_options::parse_fix_v4bx_interworking): New method.
7476
7477 2010-01-22  Doug Kwan  <dougkwan@google.com>
7478
7479         * arm.cc (Arm_exidx_fixup): New class.
7480
7481 2010-01-21  Doug Kwan  <dougkwan@google.com>
7482
7483         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7484         classes.
7485         (Arm_exidx_section_offset_map): New type.
7486
7487 2010-01-21  Doug Kwan  <dougkwan@google.com>
7488
7489         * arm.cc (Arm_exidx_input_section): New class.
7490         (Arm_relobj::exidx_input_section_by_link,
7491         Arm_relobj::exidx_input_section_by_shndx,
7492         Arm_relobj::make_exidx_input_section): New methods.
7493         (read_arm_attributes_section): Remove.
7494         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7495         information about them.
7496         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7497         to here.
7498
7499 2010-01-20  Doug Kwan  <dougkwan@google.com>
7500
7501         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7502         Input_section_specifier to Section_id.
7503         (Target_arm::new_arm_input_section: Adjust code for change of key
7504         type.
7505         (Target_arm::find_arm_input_section): Ditto.
7506         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7507         (Section_id): Remove.
7508         (Garbage_collection::Section_id_hash): Remove.
7509         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7510         (Section_id): Remove.
7511         (Icf::Section_id_hash): Remove.
7512         * object.h (Section_id, Const_section_id, Section_id_hash,
7513         Const_section_id_hash): New type definitions.
7514         * output.cc (Output_section::add_relaxed_input_section): Change to
7515         use Const_section_id instead of Input_section_specifier as key type.
7516         (Output_section::add_merge_input_section): Ditto.
7517         (Output_section::build_relaxation_map): Change to use Section_id
7518         instead of Input_section_specifier as key type.
7519         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7520         Ditto.
7521         (Output_section::convert_input_sections_to_relaxed_sections): Change
7522         to use Const_section_id instead of Input_section_specifier as key type.
7523         (Output_section::find_merge_section): Ditto.
7524         (Output_section::find_relaxed_input_section): Ditto.
7525         * output.h (Input_section_specifier): Remove class.
7526         (Output_section::Output_section_data_by_input_section_map): Change
7527         key type to Const_section_id.
7528         (Output_section::Output_relaxed_input_section_by_input_section_map):
7529         Ditto.
7530         (Output_section::Relaxation_map): Change key type to Section_id.
7531
7532 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7533
7534         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7535         (class Arm_v4bx_stub): New class.
7536         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7537         (Stub_factory::make_arm_v4bx_stub): New method.
7538         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7539         (Stub_table::empty): Handle v4bx stubs.
7540         (Stub_table::add_arm_v4bx_stub): New method.
7541         (Stub_table::find_arm_v4bx_stub): New method.
7542         (Arm_relocate_functions::v4bx): New method.
7543         (Target_arm::fix_v4bx): New method.
7544         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7545         (Stub_table::relocate_stubs): Likewise.
7546         (Stub_table::do_write): Likewise.
7547         (Stub_table::update_data_size_and_addralign): Likewise.
7548         (Stub_table::finalize_stubs):  Likewise.
7549         (Target_arm::Scan::local): Likewise.
7550         (Target_arm::Scan::global): Likewise.
7551         (Target_arm::do_finalize_sections): Likewise.
7552         (Target_arm::Relocate::relocate): Likewise.
7553         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7554         Likewise.
7555         (Target_arm::scan_reloc_for_stub): Likewise.
7556         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7557
7558 2010-01-19  Ian Lance Taylor  <iant@google.com>
7559
7560         * output.cc (Output_section_headers::do_sized_write): Write large
7561         segment count to sh_info field.
7562         (Output_file_header::do_sized_write): For large segment count,
7563         write PN_XNUM to e_phnum field.
7564
7565 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7566
7567         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7568         (Arm_relocate_functions::thm_jump8): New function.
7569         (Arm_relocate_functions::thm_jump11): New function.
7570         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7571         R_ARM_THM_JUMP11.
7572         (Target_arm::Scan::global): Likewise.
7573         (Target_arm::Relocate::relocate): Likewise.
7574         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7575         Likewise.
7576
7577 2010-01-14  Doug Kwan  <dougkwan@google.com>
7578
7579         * arm.cc (map, utility): Include headers.
7580         (Target_arm::apply_cortex_a8_workaround): New method.
7581         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7582         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7583         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7584         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7585         the --[no-]fix-cortex-a8 command line options.
7586         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7587         (Target_arm::relocate_stub): Use addend in instruction template.
7588         * options.h (DEFINE_bool): Set the user-set flag.
7589         (General_options): Add --[no-]-fix-cortex options.
7590         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7591         : Update fast look-up map after conversion.
7592
7593 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7594
7595         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7596         in the first pass of do_layout.
7597
7598 2010-01-13  Doug Kwan  <dougkwan@google.com>
7599
7600         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7601         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7602         apparent compiler problem of not folding static constant integral
7603         data members of elfcpp::Elf_sizes<32>.
7604
7605 2010-01-13  Doug Kwan  <dougkwan@google.com>
7606
7607         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7608         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7609         Arm_relobj::scan_section_for_cortex_a8_erratum,
7610         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7611         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7612         sections to scan for relocation stubs into a new method
7613         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7614         relocation and Cortex-A8 stub scanning.
7615         (Target_arm::do_relax): Force stubs to be after stubbed sections
7616         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7617         the beginning of a new relaxation pass.  Update a comment.
7618         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7619
7620 2010-01-12  Ian Lance Taylor  <iant@google.com>
7621
7622         * target-reloc.h (visibility_error): New inline function.
7623         (relocate_section): Call visibility_error.
7624         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7625         (MOSTLYCLEANFILES): Likewise.
7626         (protected_4_pic.o, protected_3.err): New targets.
7627         * testsuite/protected_4.cc: New file.
7628
7629 2010-01-12  Doug Kwan  <dougkwan@google.com>
7630
7631         * arm.cc (Cortex_a8_reloc): New class.
7632         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7633         and cortex_a8_relocs_info_.
7634         (Target_arm::fix_cortex_a8): New method definition.
7635         (Target_arm::Cortex_a8_relocs_info): New type.
7636         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7637         New data member declarations.
7638         (Target_arm::scan_reloc_for_stub): Record information about
7639         relocations for THUMB branches that might be exempted from the
7640         Cortex-A8 workaround.
7641         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7642         at the beginning of a relaxation pass.
7643
7644 2010-01-12  Doug Kwan  <dougkwan@google.com>
7645
7646         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7647         (Arm_relobj::Mapping_symbol_position,
7648          Arm_reloj::Mapping_symbol_position_less,
7649          Arm_relobj::Mapping_symbols_info): New types.
7650         (Target_arm::is_mapping_symbol_name): New method definition.
7651         (Arm_relobj::do_count_local_symbols): Save information about mapping
7652         symbols.
7653
7654 2010-01-11  Doug Kwan  <dougkwan@google.com>
7655
7656         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7657         Arm_relocate_functions::thumb32_branch_upper,
7658         Arm_relocate_functions::thumb32_branch_lower,
7659         Arm_relocate_functions::thumb32_cond_branch_offset,
7660         Arm_relocate_functions::thumb32_cond_branch_upper,
7661         Arm_relocate_functions::thumb32_cond_branch_lower,
7662         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7663         branch offset encoding.
7664         (Arm_relocate_functions::thumb_branch_common): Use new branch
7665         offset encoding methods to avoid code duplication.
7666         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7667         (Stub_addend_reader::operator()): Use new branch encoding method
7668         to avoid code duplication.
7669
7670 2010-01-11  Doug Kwan  <dougkwan@google.com>
7671
7672         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7673         (Target_arm::do_finalize_sections): Define special EXIDX section
7674         symbols only if referenced.
7675         * gc.h (Garbage_collection::add_reference): New method.
7676         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7677         code duplication.
7678
7679 2010-01-11  Ian Lance Taylor  <iant@google.com>
7680
7681         * script.cc (Version_script_info::build_expression_list_lookup):
7682         Change complaing about duplicate wildcard match from error to
7683         warning.
7684
7685         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7686         of 2009-12-30.
7687         (Version_script_info::Version_script_info): Initialize globs_,
7688         default_version_, default_is_global_, and exact_.  Don't
7689         initialize globals_ or locals_.
7690         (Version_script_info::build_lookup_tables): Build local symbols
7691         first.
7692         (Version_script_info::unquote): New function.
7693         (Version_script_info::add_exact_match): New function.
7694         (Version_script_info::build_expression_list_lookup): Remove lookup
7695         parameter.  Add is_global parameter.  Change all callers.  Handle
7696         wildcard pattern specially.  Unquote pattern.  Call
7697         add_exact_match.
7698         (Version_script_info::get_name_to_match): New function.
7699         (Version_script_info::get_symbol_version): New function.
7700         (Version_script_info::get_symbol_version_helper): Remove.
7701         (Version_script_info::check_unmatched_names): Call unquote.
7702         * script.h (class Version_script_info): Change get_symbol_version
7703         to be non-inline and add is_global parameter; change all callers.
7704         Rewrite symbol_is_local.  Update declarations.  Define struct
7705         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7706         Remove globals_ and locals_ members.  Add exact_, globs_,
7707         default_version_, is_global_.
7708         (Version_script_info::Glob): Remove pattern, add expression and
7709         is_global.  Update constructor.  Change all callers.
7710         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7711         default version.
7712         (Versions::symbol_section_contents): If a symbol is undefined, or
7713         defined in a dynamic object, set the version index to
7714         VER_NDX_LOCAL.
7715         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7716         symbol_is_local.
7717         (Symbol_table::add_from_pluginobj): Likewise.
7718         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7719
7720 2010-01-11  Doug Kwan  <dougkwan@google.com>
7721
7722         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7723         (incremental_dump_LDADD): Add linking option for libintl.
7724         * Makefile.in: Regenerate.
7725
7726 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7727
7728         PR gold/11144
7729         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7730         instead of -Ds.
7731         * testsuite/Makefile.in: Regenerated.
7732
7733 2010-01-10  Doug Kwan  <dougkwan@google.com>
7734
7735         * options.h (DEFINE_var): Use parentheses around argument varname__
7736         in macro body to avoid any unintended subsequent substitutions.
7737
7738 2010-01-10  Ian Lance Taylor  <iant@google.com>
7739
7740         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7741         candidates before doing symbol resolution.
7742
7743         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7744         ODR candidates if only one is weak.
7745
7746 2010-01-08  Ian Lance Taylor  <iant@google.com>
7747
7748         * script.cc (Version_script_info::build_expression_list_lookup):
7749         Don't warn about ambiguous version, just record the ambiguity.
7750         (Version_script_info::get_symbol_version_helper): Give error if
7751         version is ambiguous.
7752
7753 2010-01-08  Doug Kwan  <dougkwan@google.com>
7754
7755         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7756         prev_data_size_ and prev_addralign_.  Remove initializer for
7757         deleted data member has_been_changed_.
7758         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7759         to determine if the table is empty.
7760         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7761         Remove.
7762         (Stub_table::add_reloc_stub): Define method in class definition
7763         instead of just declaring it there.
7764         (Stub_table::add_cortex_a8_stub): New method definition.
7765         (Stub_table::update_data_size_and_addralign): Ditto.
7766         (Stub_table::finalize_stubs): Ditto.
7767         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7768         (Stub_table::do_addralign_): Return address alignment in the
7769         (Stub_table::do_reset_address_and_file_offset): Define method in
7770         class definition instead of declaring it there.  Set current data
7771         size to be the data size of the previous pass.
7772         (Stub_table::set_final_data_size): Use current data size as the
7773         final data size.
7774         (Stub_table::relocate_stub): Change parameter type of stub from
7775         Reloc_stub pointer to Stub pointer.
7776         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7777         (Stub_table::Cortex_a8_stub_list): New typedef.
7778         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7779          Stub_table::prev_addralign_): New data member.
7780         (Arm_relobj::Arm_relobj): Initialize data member
7781         section_has_cortex_a8_workaround_.
7782         (Arm_relobj::section_has_cortex_a8_workaround,
7783          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7784          definitions.
7785         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7786         declarations.
7787         (Target_arm::relocate_stub): Change parameter type of stub from
7788         Reloc_stub pointer to Stub pointer.
7789         (Insn_template::size, Insn_template::alignment): Handle
7790         THUMB16_SPECIAL_TYPE.
7791         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7792          Stub_table::update_data_size_and_addralign,
7793          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7794         definitions.
7795         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7796         (Stub_table::do_write): Ditto.
7797         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7798
7799 2010-01-08  Ian Lance Taylor  <iant@google.com>
7800
7801         PR 11108
7802         * symtab.h (class Symbol): Remove fields is_target_special_ and
7803         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7804         (Symbol::is_defined_in_discarded_section): New function.
7805         (Symbol::set_is_defined_in_discarded_section): New function.
7806         (Symbol::has_plt_offset): Rewrite.
7807         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7808         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7809         Don't initialize is_target_special_ or has_plt_offset_.
7810         Initialize is_defined_in_discarded_section_.
7811         (Symbol_table::add_from_relobj): If appropriate, set
7812         is_defined_in_discarded_section.
7813         * resolve.cc (Symbol::override_base_with_special): Don't test
7814         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7815         * target-reloc.h (relocate_section): Do special handling for
7816         symbols defined in discarded sections for global symbols as well
7817         as local symbols.
7818
7819 2010-01-08  Ian Lance Taylor  <iant@google.com>
7820
7821         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7822         the SHT_SYMTAB case.
7823
7824 2010-01-08  Ian Lance Taylor  <iant@google.com>
7825
7826         * object.cc (Sized_relobj::do_layout): Don't get confused if
7827         layout_eh_frame returns NULL.
7828
7829 2010-01-08  Ian Lance Taylor  <iant@google.com>
7830
7831         PR 11084
7832         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7833         dynamic symbol table, use the normal symbol table.
7834         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7835         symbol table.
7836
7837 2010-01-08  Ian Lance Taylor  <iant@google.com>
7838
7839         PR 11072
7840         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7841         sections.
7842
7843 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7844
7845         * version.cc (print_version): Change to "Copyright 2010".
7846
7847 2010-01-08  Ian Lance Taylor  <iant@google.com>
7848
7849         PR 10287
7850         PR 11063
7851         * i386.cc (class Target_i386): Change return type of plt_section
7852         to be non-const.
7853         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7854         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7855         tls_desc_rel_ field.
7856         (Output_data_plt_i386::rel_tls_desc): New function.
7857         (Target_i386::rel_tls_desc_section): New function.
7858         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7859         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7860         R_386_TLS_DESC reloc in rel_tls_desc_section.
7861         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7862         Define struct Tlsdesc_info.
7863         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7864         (Target_x86_64::do_reloc_symbol_index): New function.
7865         (Target_x86_64::add_tlsdesc_info): New function.
7866         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7867         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7868         tlsdesc_rel_ field.
7869         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7870         all callers.
7871         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7872         (Target_x86_64::rela_tlsdesc_section): New function.
7873         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7874         handling.
7875         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7876         (Target_x86_64::do_reloc_addend): New function.
7877         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7878         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7879         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7880         (Output_reloc::type): New function.
7881         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7882         (Output_reloc::is_target_specific): New function.
7883         (Output_reloc::target_arg): New function.
7884         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7885         absolute relocs and target specific relocs.
7886         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7887         add_target_specific.
7888         (class Output_data_reloc) [SHT_RELA]: Likewise.
7889         * output.cc (Output_reloc::Output_reloc): Add four new versions
7890         for absolute relocs and target specific relocs.
7891         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7892         (Output_reloc::get_symbol_index): Likewise.
7893         (Output_reloc::local_section_offset): Check that local_sym_index_
7894         is not TARGET_CODE or 0.
7895         (Output_reloc::symbol_value): Likewise.
7896         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7897         reloc.
7898         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7899         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7900         functions.
7901         * layout.cc (add_target_dynamic_tags): Use output section for
7902         DT_PLTRELSZ and DT_JMPREL.
7903
7904 2010-01-07  Ian Lance Taylor  <iant@google.com>
7905
7906         PR 11061
7907         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7908         function.
7909         (class Output_data_reloc_generic): Define.
7910         (class Output_data_reloc_base): Change base class to
7911         Output_data_reloc_generic.  Change add() method to call
7912         bump_relative_reloc_count for a relative reloc.  Remove
7913         sort_relocs_ field.
7914         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7915         to sort_relocs().
7916         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7917         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7918         appropriate.
7919         * layout.h (class Layout): Update declaration.
7920
7921 2010-01-07  Ian Lance Taylor  <iant@google.com>
7922
7923         * output.h (class Output_data): Add const version of
7924         output_section and do_output_section.
7925         (class Output_section_data): Add const version of
7926         do_output_section.
7927         (class Output_section): Likewise.
7928         * layout.cc (Layout::add_target_dynamic_tags): New function.
7929         * layout.h (class Layout): Update declarations.
7930         * arm.cc (Target_arm::do_finalize_sections): Use
7931         add_target_dynamic_tags.
7932         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7933         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7934         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7935         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7936
7937 2010-01-07  Ian Lance Taylor  <iant@google.com>
7938
7939         PR 11042
7940         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7941         object as needed.
7942
7943 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7944             Ian Lance Taylor  <iant@google.com>
7945
7946         PR 11019
7947         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7948         Xindex::read_symtab_xindex.
7949
7950 2010-01-07  Doug Kwan  <dougkwan@google.com>
7951
7952         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7953         (Insn_template::thumb16_bcond_insn): New method declaration.
7954         (Insn_template): Fix spelling.
7955         (Stub::thumb16_special): New method declaration.
7956         (Stub::do_write): Define virtual method which was previously pure
7957         virtual.
7958         (Stub::do_thumb16_special): New method declaration.
7959         (Stub::do_fixed_endian_write): New template member.
7960         (Reloc_stub::do_write): Remove.
7961         (Reloc_stub::do_fixed_endian_write): Remove.
7962         (Cortex_a8_stub): New class definition.
7963         (Stub_factory::make_cortex_a8_stub): New method definition.
7964         (Stub_factory::Stub_factory): Add missing static storage class
7965         qualifier for elf32_arm_stub_a8_veneer_blx.
7966
7967 2010-01-07  Ian Lance Taylor  <iant@google.com>
7968
7969         PR 10980
7970         * options.h (class General_options): Add --warn-unresolved-symbols
7971         and --error-unresolved-symbols.
7972         * errors.cc (Errors::undefined_symbol): Implement
7973         --warn-unresolved-symbols.
7974
7975         * options.h (class General_options): Add -z text and -z textoff.
7976         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7977
7978 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7979
7980         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7981         (Garbage_collection::cident_sections): New function.
7982         (Garbage_collection::add_cident_section): New function.
7983         (Garbage_collection::cident_sections_): New member.
7984         (gc_process_relocs): Add references to sections whose names are C
7985         identifiers.
7986         * gold.h (cident_section_start_prefix): New constant.
7987         (cident_section_stop_prefix): New constant.
7988         (is_cident): New function.
7989         * layout.cc (Layout::define_section_symbols): Replace string constants
7990         with the newly defined constants.
7991         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7992         C identifiers.
7993         * testsuite/Makefile.am: Add gc_orphan_section_test.
7994         * testsuite/Makefile.in: Regenerate.
7995         * testsuite/gc_orphan_section_test.cc: New file.
7996         * testsuite/gc_orphan_section_test.sh: New file.
7997
7998 2010-01-06  Ian Lance Taylor  <iant@google.com>
7999
8000         PR 10980
8001         * options.h (class General_options): Add --warn-shared-textrel.
8002         * layout.cc (Layout::finish_dynamic_section): Implement
8003         --warn-shared-textrel.
8004
8005         PR 10980
8006         * options.h (class General_options): Add --warn-multiple-gp.
8007
8008 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8009
8010         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8011         $(THREADSLIB) and $(LIBDL).
8012         * Makefile.in: Rebuild.
8013
8014 2010-01-06  Ian Lance Taylor  <iant@google.com>
8015
8016         PR 10980
8017         * options.cc (General_options::parse_section_start): New function.
8018         (General_options::section_start): New function.
8019         (General_options::General_options): Initialize all members.
8020         * options.h: Include <map>
8021         (class General_options): Add --section-start.  Add section_starts_
8022         member.
8023         * layout.cc (Layout::attach_allocated_section_to_segment): If
8024         --section-start was used, set the address of the segment.  Remove
8025         local sort_sections.
8026         (Layout::relaxation_loop_body): If the address of the load segment
8027         has been set by --section-start, don't use it.
8028         * output.h (Output_segment::update_flags_for_output_section): New
8029         function.
8030         * output.cc (Output_segment::add_output_section): Call
8031         update_flags_for_output_section.
8032
8033 2010-01-05  Ian Lance Taylor  <iant@google.com>
8034
8035         PR 10980
8036         * options.h (class General_options): Add --undefined-version.
8037         * script.cc (struct Version_expression): Add was_matched_by_symbol
8038         field.
8039         (Version_script_info::matched_symbol): New function.
8040         (Version_script_info::get_symbol_version_helper): Call
8041         matched_symbol.
8042         (Version_script_info::check_unmatched_names): New function.
8043         * script.h (class Version_script_info): Update declarations.
8044         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8045
8046         * options.h (class General_options): Use DEFINE_bool_alias for
8047         allow_multiple_definition.
8048         * resolve.cc (Symbol_table::should_override): Don't test
8049         allow_multiple_definition.
8050
8051         PR 10980
8052         * options.h (class General_options): Add --cref.
8053         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8054         until after printing cref table.
8055         * cref.cc: Include "symtab.h".
8056         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8057         (Cref_table_compare::operator()): New function.
8058         (Cref_inputs::gather_cref): New function.
8059         (filecol): New static const.
8060         (Cref_inputs::print_cref): New function.
8061         (Cref::print_cref): New function.
8062         * cref.h: Include <cstdio>.
8063         (class Cref): Update declarations.
8064         * mapfile.h (Mapfile::file): New function.
8065         * object.h (class Object): Define Symbols.  Declare virtual
8066         do_get_global_symbols.
8067         (Object::get_global_symbols): New function.
8068         * object.cc (Input_objects::add_object): Pass object to cref_ if
8069         --cref.
8070         (Input_objects::archive_start): Likewise.
8071         (Input_objects::archive_stop): Likewise.
8072         (Input_objects::print_cref): New function.
8073         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8074         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8075         --cref.
8076         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8077         function.
8078         * plugin.h (class Sized_pluginobj): Update declarations.
8079
8080 2010-01-05  Ian Lance Taylor  <iant@google.com>
8081
8082         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8083         to is_default_version.  Rename insdef to insdefault.
8084         (Symbol_table::add_from_relobj): Rename def to is_default_version
8085         and local to is_forced_local.
8086         (Symbol_table::add_from_pluginobj): Likewise.
8087         (Symbol_table::add_from_dynobj): Likewise.
8088         (Symbol_table::define_special_symbol): Rename insdef to
8089         insdefault.
8090
8091 2010-01-04  Ian Lance Taylor  <iant@google.com>
8092
8093         PR 10980
8094         * options.h (class General_options): Add
8095         --allow-multiple-definition and -z muldefs.
8096         * resolve.cc (Symbol_table::should_override): Don't warn about a
8097         multiple symbol definition if --allow-multiple-definition or -z
8098         muldefs.
8099
8100         PR 10980
8101         * options.h (class General_options): Add --add-needed and
8102         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8103         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8104         error if --copy-dt-needed-entries aka --add-needed is used and
8105         would cause a change in behaviour.
8106
8107         PR 10980
8108         * options.h (class General_options): Add -G as a short version of
8109         --shared.  Add no-op options -assert, -g, and -i.
8110
8111 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8112
8113         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8114         check for .text or .gnu.linkonce.t sections.
8115         * icf.cc (Icf::find_identical_sections): Ditto.
8116         Change the detection for mangled function name within the section
8117         name.
8118         * icf.h (is_section_foldable_candidate): New function.
8119
8120 2009-12-30  Ian Lance Taylor  <iant@google.com>
8121
8122         PR 10980
8123         * options.h (class General_options): Permit two dashes with
8124         --retain-symbols-file.
8125
8126 2009-12-30  Ian Lance Taylor  <iant@google.com>
8127
8128         PR 10979
8129         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8130         don't put the file header and segment headers in the text
8131         segment.
8132
8133         PR 10979
8134         * common.cc (Sort_commons::operator()): Stabilize sort when both
8135         entries are NULL.
8136         (Symbol_table::do_allocate_commons_list): When allocating common
8137         symbols, skip a symbol which is no longer common.
8138         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8139         an object before checking its type.
8140         * testsuite/common_test_2.c: New file.
8141         * testsuite/common_test_3.c: New file.
8142         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8143         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8144         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8145         (common_test_2_pic.o, common_test_2.so): New targets.
8146         (common_test_3_pic.o, common_test_3.so): New targets.
8147         * testsuite/Makefile.in: Rebuild.
8148
8149         PR 10979
8150         * script.cc (read_input_script): If we see a new SECTIONS clause,
8151         and we have added an input section, give an error.
8152         * layout.h (class Layout): Add have_added_input_section function.
8153         Add have_added_input_section_ field.
8154         * layout.cc (Layout::Layout): Initialize
8155         have_added_input_section_.
8156         (Layout::layout): Set have_added_input_section_.
8157         (Layout::layout_eh_frame): Likewise.
8158
8159 2009-12-30  Ian Lance Taylor  <iant@google.com>
8160
8161         PR 10931
8162         * options.h (class General_options): Add --sort-common option.
8163         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8164         * common.cc (Sort_common): Add sort_order parameter to
8165         constructor.  Add sort_order_ field.
8166         (Sort_commons::operator): Check sort_order_.
8167         (Symbol_table::allocate_commons): Determine the sort order.
8168         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8169         Change all callers.
8170         (Symbol_table::do_allocate_commons_list): Likewise.
8171
8172 2009-12-30  Ian Lance Taylor  <iant@google.com>
8173
8174         PR 10916
8175         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8176         symbols from this object, don't change the visibility of an
8177         undefined symbol.
8178         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8179
8180 2009-12-30  Ian Lance Taylor  <iant@google.com>
8181
8182         PR 10861
8183         * script.h (class Version_script_info): Define Language enum.
8184         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8185         new fields globals_, locals_, and is_finalized_.
8186         * script.cc: Various formatting fixes.
8187         (class Parser_closure): Change language_stack_ from a vector of
8188         std::string to one of Version_script_info::Language.  Adjust all
8189         uses accordingly.
8190         (class Lazy_demangler): Remove.
8191         (struct Version_expression): Change language from std::string to
8192         Version_script_info::Language.
8193         (Version_script_info::Version_script_info): New function.
8194         (Version_script_info::~Version_script_info): Don't call clear.
8195         (Version_script_info::finalize): New function.
8196         (Version_script_info::build_lookup_tables): New function.
8197         (Version_script_info::build_expression_list_lookup): New
8198         function.
8199         (Version_script_info::get_symbol_version_helper): Rewrite to use
8200         lookup tables.
8201         (Version_script_info::print_expression_list): Adjust to use
8202         Version_script_info::Language.
8203         (script_push_lex_into_version_mode): Check that the version script
8204         has not been finalized.
8205         (version_script_push_lang): Change language string to
8206         Version_script_info::Language.
8207         * options.cc (Command_line::version_script): New function.
8208         * options.h (class General_options): Add finalize_dynamic_list
8209         function.  Change version_script from declaration to definition.
8210         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8211         * testsuite/version_script.map: Remove duplicate def of foo.
8212         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8213         version_script.map.
8214         * testsuite/Makefile.in: Rebuild.
8215
8216 2009-12-30  Ian Lance Taylor  <iant@google.com>
8217
8218         PR 10843
8219         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8220         if the input symbol index is 0, make the output symbol index 0.
8221
8222 2009-12-30  Ian Lance Taylor  <iant@google.com>
8223
8224         PR 10670
8225         * options.h (class General_options): Add -x/--discard-all.
8226         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8227         --discard-all.  If the local symbol needs a dynamic entry, check
8228         that before handling --discard-locals.
8229
8230 2009-12-30  Ian Lance Taylor  <iant@google.com>
8231
8232         PR 10450
8233         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8234         flags to PF_R.
8235         (Output_segment::add_output_section): Don't change the flags if
8236         the type is PT_TLS.
8237
8238         PR 10450
8239         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8240         GNU hash table if they need a dynamic value.  Otherwise, don't add
8241         them if they are defined in a dynamic object or are forced local.
8242
8243 2009-12-29  Ian Lance Taylor  <iant@google.com>
8244
8245         PR 10450
8246         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8247         .gnu.hash table for a 32-bit target.
8248
8249         PR 10450
8250         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8251         regular and a dynamic object only needs a dynamic symbol table
8252         entry if it is externally visible.
8253
8254         PR 10450
8255         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8256         constructor.  Add global_offset_table_ field.
8257         (Target_i386::got_section): Set global_offset_table_.
8258         (Target_i386::do_finalize_sections): Set global_offset_table_
8259         size.
8260         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8261         in constructor.  Add global_offset_table_ field.
8262         (Target_x86_64::got_section): Set global_offset_table_.
8263         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8264         size.
8265
8266         * layout.cc (Layout::Layout): Initialize increase_relro_.
8267         (Layout::get_output_section): Add is_relro, is_last_relro, and
8268         is_first_non_relro parameters.  Change all callers.
8269         (Layout::choose_output_section): Likewise.
8270         (Layout::add_output_section_data): Likewise.
8271         (Layout::make_output_section): Likewise.
8272         (Layout::set_segment_offsets): Clear increase_relro when using a
8273         linker script.
8274         * layout.h (class Layout): Add increase_relro method.  Add
8275         increase_relro_ field.  Update declarations.
8276         * output.cc (Output_section::Output_section): Initialize
8277         is_last_relro_ and is_first_non_relro_.
8278         (Output_segment::add_output_section): Group relro sections is
8279         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8280         (Output_segment::maximum_alignment): Remove relro handling.
8281         (Output_segment::set_section_addresses): Add increase_relro
8282         parameter.  Change all callers.  Add initial alignment to align
8283         relro sections on separate page.  Remove old relro handling.
8284         (Output_segment::set_section_list_addresses): Remove in_relro
8285         parameter.  Change all callers.
8286         (Output_segment::set_offset): Add increase parameter.  Change all
8287         callers.  Remove old relro handling.
8288         * output.h (class Output_section): Add new methods: is_last_relro,
8289         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8290         Add is_last_relro_ and is_first_non_relro_ fields.
8291         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8292         Create separate .got.plt section.  Call increase_relro.
8293         * x86_64.cc (Target_x86_64::got_section): Likewise.
8294         * testsuite/relro_script_test.t: Add .got.plt.
8295
8296         PR 10450
8297         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8298         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8299         (Layout::finalize): Call set_dynamic_symbol_size.
8300         (Layout::set_dynamic_symbol_size): New function.
8301         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8302         set_dynamic_symbol_size.
8303
8304         PR 10450
8305         * output.h (class Output_section): Add is_entsize_zero_ field.
8306         * output.cc (Output_section::Output_section): Initialize
8307         is_entsize_zero_.
8308         (Output_section::set_entsize): If two different entsizes are
8309         requested, force it to zero.
8310         (Output_section::add_input_section): Set flags for .debug_str
8311         before updating section flags.  Set entsize.
8312         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8313         and SHF_STRING if all input sections have those flags.
8314
8315 2009-12-29   Rafael Espindola  <espindola@google.com>
8316
8317         * main.cc (main): Fix the sys time reporting.
8318         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8319         reporting.
8320
8321 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8322
8323         * options.cc (General_options::parse_version): Allow -v to exit
8324         without an error if there is nothing to link.
8325
8326 2009-12-29  Ian Lance Taylor  <iant@google.com>
8327
8328         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8329         using a version of gcc before 4.1.
8330         * configure: Rebuild.
8331
8332 2009-12-28  Chris Demetriou  <cgd@google.com>
8333
8334         * attributes.cc (Output_attributes_section_data::do_write): Use
8335         std::vector::front rather than std::vector::data.
8336
8337 2009-12-28  Ian Lance Taylor  <iant@google.com>
8338
8339         * symtab.h (class Symbol_table): Add enum Defined.
8340         * resolve.cc (Symbol_table::should_override): Add defined
8341         parameter.  Change all callers.  Test whether object is NULL
8342         before calling a method on it.
8343         (Symbol_table::report_resolve_problem): Add defined parameter.
8344         Change all callers.
8345         (Symbol_table::should_override_with_special): Likewise.
8346         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8347         parameter.  Change all callers.
8348         (Symbol_table::do_define_in_output_data): Likewise.
8349         (Symbol_table::define_in_output_segment): Likewise.
8350         (Symbol_table::do_define_in_output_segment): Likewise.
8351         (Symbol_table::define_as_constant): Likewise.
8352         (Symbol_table::do_define_as_constant): Likewise.
8353         * script.h (class Symbol_assignment): Add is_defsym parameter to
8354         constructor; change all callers.
8355         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8356         parameter.  Change all callers.  Add is_defsym_ field.
8357         (class Parser_closure): Add parsing_defsym parameter to
8358         constructor; change all callers.  Add parsing_defsym accessor
8359         function.  Add parsing_defsym_ field.
8360
8361 2009-12-28  Ian Lance Taylor  <iant@google.com>
8362
8363         * gold.cc (queue_middle_tasks): Fix formatting.
8364         * object.cc (Relobj::is_section_name_included): Likewise.
8365
8366 2009-12-23  Ian Lance Taylor  <iant@google.com>
8367
8368         * i386.cc (Target_i386::do_calls_non_split): Recognize
8369         -fsplit-stack prologue for a function with a static chain.
8370         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8371         -fsplit-stack prologue when using %r11.
8372
8373 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8374
8375         * options.cc (General_options::parse_version): Make -v continue and do
8376         the link like GNU ld does.
8377
8378 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8379
8380         * Makefile.am (CCFILES): Add timer.cc.
8381         (HFILES): Add timer.h.
8382         * configure.ac: Check for sysconf and times.
8383         * main.cc: include timer.h.
8384         (main): Use Timer instead of get_run_time.
8385         * timer.cc: New.
8386         * timer.h: New.
8387         * workqueue.cc: include timer.h.
8388         (Workqueue::find_and_run_task):
8389         Report user, sys and wall time.
8390         * Makefile.in: Regenerate.
8391         * config.in: Regenerate.
8392         * configure: Regenerate.
8393
8394 2009-12-16  Doug Kwan  <dougkwan@google.com>
8395
8396         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8397         sections.
8398         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8399         relaxed input sections.
8400         * output.cc (Output_section::find_relaxed_input_section): Change
8401         return type to Output_relaxed_input_section pointer.  Adjust code
8402         for new type of relaxed_input_section_map_.
8403         * output.h (Output_section::find_relaxed_input_section): Change
8404         return type to Output_relaxed_input_section pointer.
8405         (Output_section::Output_relaxed_input_section_by_input_section_map):
8406         New type.
8407         (Output_section::relaxed_input_section_map_): Change type to
8408         Output_section::Output_relaxed_input_section_by_input_section_map.
8409         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8410         input section.
8411
8412 2009-12-15  Ian Lance Taylor  <iant@google.com>
8413
8414         * layout.cc (Layout::create_shstrtab): Only write out after input
8415         sections if we are compressing debug sections.
8416
8417 2009-12-15  Ian Lance Taylor  <iant@google.com>
8418
8419         * archive.cc (Archive::add_symbols): Only look up a symbol without
8420         a version if there is, in fact, a version.
8421
8422 2009-12-14  Ian Lance Taylor  <iant@google.com>
8423
8424         Revert -Wshadow changes, all changes from:
8425         2009-12-11  Doug Kwan  <dougkwan@google.com>
8426         2009-12-11  Nick Clifton  <nickc@redhat.com>
8427         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8428
8429 2009-12-11  Doug Kwan  <dougkwan@google.com>
8430
8431         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8432         due to -Wshadow.
8433         * attributes.cc (Object_attribute::size): Ditto.
8434         (Attributes_section_data::size): Ditto.
8435         (Attributes_section_data::Attributes_section_data): Ditto.
8436         (Output_attributes_section_data::do_write): Ditto.
8437         * attributes.h (Object_attribute::set_type): Ditto.
8438         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8439
8440 2009-12-11  Nick Clifton  <nickc@redhat.com>
8441
8442         * archive.cc: Fix shadowed variable warnings.
8443         * arm.cc: Likewise.
8444         * compressed_output.cc: Likewise.
8445         * compressed_output.h: Likewise.
8446         * configure: Likewise.
8447         * dwarf_reader.cc: Likewise.
8448         * dynobj.cc: Likewise.
8449         * dynobj.h: Likewise.
8450         * ehframe.cc: Likewise.
8451         * ehframe.h: Likewise.
8452         * errors.cc: Likewise.
8453         * expression.cc: Likewise.
8454         * fileread.cc: Likewise.
8455         * fileread.h: Likewise.
8456         * freebsd.h: Likewise.
8457         * i386.cc: Likewise.
8458         * icf.cc: Likewise.
8459         * incremental.h: Likewise.
8460         * layout.cc: Likewise.
8461         * layout.h: Likewise.
8462         * mapfile.cc: Likewise.
8463         * merge.cc: Likewise.
8464         * merge.h: Likewise.
8465         * object.cc: Likewise.
8466         * object.h: Likewise.
8467         * options.h: Likewise.
8468         * output.cc: Likewise.
8469         * output.h: Likewise.
8470         * parameters.cc: Likewise.
8471         * plugin.cc: Likewise.
8472         * powerpc.cc: Likewise.
8473         * reduced_debug_output.cc: Likewise.
8474         * reduced_debug_output.h: Likewise.
8475         * reloc.cc: Likewise.
8476         * reloc.h: Likewise.
8477         * resolve.cc: Likewise.
8478         * script-sections.cc: Likewise.
8479         * script.cc: Likewise.
8480         * script.h: Likewise.
8481         * sparc.cc: Likewise.
8482         * symtab.cc: Likewise.
8483         * symtab.h: Likewise.
8484         * target-select.cc: Likewise.
8485         * target-select.h: Likewise.
8486         * token.h: Likewise.
8487         * workqueue.cc: Likewise.
8488         * workqueue.h: Likewise.
8489         * x86_64.cc: Likewise.
8490
8491 2009-12-10  Doug Kwan  <dougkwan@google.com>
8492
8493         * arm.cc (attributes.h): New include.
8494         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8495         (Arm_relobj::~Arm_relobj): Delete object pointed by
8496         attributes_section_data_.
8497         (Arm_relobj::attributes_section_data): New method definition.
8498         (Arm_relobj::attributes_section_data_): New data member declaration.
8499         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8500         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8501         attributes_section_data_.
8502         (Arm_dynobj::attributes_section_data): New method definition.
8503         (Arm_dynobj::attributes_section_data_): New data member declaration.
8504         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8505         initialization value of may_use_blx_ to false.
8506         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8507         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8508         object attributes to compute results instead of hard-coding.
8509         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8510         Target_arm::get_secondary_compatible_arch,
8511         Target_arm::set_secondary_compatible_arch
8512         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8513         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8514         New method declarations.
8515         (Target_arm::get_aeabi_object_attribute): New method definition.
8516         (Target_arm::attributes_section_data_): New data member declaration.
8517         (read_arm_attributes_section): New template definition.
8518         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8519         (Arm_dynobj::do_read_symbols): Ditto.
8520         (Target_arm::do_finalize_sections): Merge attributes sections from
8521         input.  Check for BLX use after attributes section merging.
8522         Fix __exidx_start and __exidx_end visibility.  Create an
8523         .ARM.attributes section if necessary.
8524         (Target_arm::get_secondary_compatible_arch,
8525         Target_arm::set_secondary_compatible_arch,
8526         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8527         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8528         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8529         New method definitions.
8530
8531 2009-12-09  Ian Lance Taylor  <iant@google.com>
8532
8533         * plugin.cc (Plugin::load): Don't cast from void* to a function
8534         pointer.
8535
8536 2009-12-09  Ian Lance Taylor  <iant@google.com>
8537
8538         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8539         information fields.
8540
8541 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8542
8543         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8544         Replace two_file_shared_1.so with two_file_shared_2.so.
8545         * testsuite/Makefile.in: Regenerated.
8546
8547 2009-12-08  Doug Kwan  <dougkwan@google.com>
8548
8549         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8550         (HFILES): Add attributes.h and int_encoding.h.
8551         * Makefile.in: Regenerate.
8552         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8553         function definitions to int_encoding.cc
8554         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8555         prototypes to int_encoding.h
8556         * reduced_debug_output.cc (int_encoding.h): New include.
8557         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8558         function definitions to int_encoding.cc
8559         (insert_into_vector, read_from_pointer): Move template definitions to
8560         int_encoding.h
8561         * attributes.cc: New file.
8562         * attributes.h: New file.
8563         * int_encoding.cc: New file.
8564         * int_encoding.h: New file.
8565
8566 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8567
8568         PR gold/11055
8569         * incremental-dump.cc (dump_incremental_inputs): New.
8570         (main): Use dump_incremental_inputs.
8571
8572 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8573
8574         PR gold/10893
8575         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8576         checking elfcpp::STT_FUNC.
8577         (Target_i386::Relocate::relocate): Likewise.
8578         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8579
8580         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8581         symbols from shared libraries into normal FUNC symbols.
8582
8583         * symtab.h (Symbol): Add is_func and use it.
8584
8585 2009-12-05  Doug Kwan  <dougkwan@google.com>
8586
8587         * arm.cc (Target_arm::arm_info): Initialize new fields
8588         attributes_section and attributes_vendor.
8589         * i386.cc (Target_i386::i386_info): Same.
8590         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8591         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8592         fields attributes_section and attributes_vendor.
8593         * sparc.cc (Target_sparc::sparc_info): Same.
8594         * target.h (Target::attributes_section, Target::attributes_vendor,
8595         Target::is_attributes_section, Target::attribute_arg_type,
8596         Target::attributes_order): New method definitions.
8597         (Target::Target_info::attributes_section,
8598         Target::Target_info::attributes_vendor): New fields.
8599         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8600         virtual method definitions.
8601         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8602         attributes_section and attributes_vendor.
8603         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8604
8605 2009-12-05  Doug Kwan  <dougkwan@google.com>
8606
8607         * arm.cc: Update comments about interworking and stub generation.
8608         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8609         considered as non-PIC.
8610         (Arm_relocate_functions::base_abs): Fix formatting.
8611         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8612         of function to use GOT entry address instead of offset.
8613         (Target_arm::Scan::global): Issue an error if a symbol would need a
8614         PLT does not get one because it is untyped.  Remove code to create
8615         dynamic symbols for relative branches.
8616         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8617         takes unsigned integer instead of boolean.
8618
8619 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8620
8621         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8622         (two_file_test_LDADD): Likewise.
8623         (common_test_1_LDADD): Likewise.
8624         (exception_test_LDADD) Likewise.
8625         (weak_test_LDADD): Likewise.
8626         (many_sections_test_LDADD): Likewise.
8627         (initpri1_LDADD): Likewise.
8628         (script_test_1_LDADD): Likewise.
8629         (script_test_2_LDADD): Likewise.
8630         (justsyms_LDADD): Likewise.
8631         (binary_test_LDADD): Likewise.
8632         (large_LDADD): Likewise.
8633         * testsuite/Makefile.in: Regenerated.
8634
8635 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8636
8637         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8638         (Symbol_table::override_with_special): Likewise.
8639         (Symbol_table::add_from_object): Likewise.
8640
8641 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8642
8643         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8644         Don't set the data_offset twice.
8645
8646 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8647
8648         * testsuite/Makefile.in: Regenerate.
8649
8650 2009-12-03  Doug Kwan  <dougkwan@google.com>
8651
8652         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8653         (Target_arm::do_finalize_sections): Add parameter for symbol table
8654         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8655         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8656         parameter for symbol table pointer.
8657         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8658         an additional parameter for a pointer to symbol table.
8659         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8660         parameter for a symbol table pointer.
8661         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8662         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8663         Ditto.
8664         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8665         parameter for a symbol table pointer.
8666
8667 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8668
8669         * incremental.cc (Incremental_inputs_header)
8670         (Incremental_inputs_header_write, Incremental_inputs_entry)
8671         (Incremental_inputs_entry_write): Move ...
8672         * incremental.h (Incremental_inputs_header)
8673         (Incremental_inputs_header_write, Incremental_inputs_entry)
8674         (Incremental_inputs_entry_write): here.
8675
8676 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8677
8678         * incremental.cc (make_sized_incremental_binary): Set the target.
8679         Error if it is incompatible.
8680         * output.h (Output_file): Add filename method.
8681
8682 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8683
8684         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8685         from the get_* methods.
8686
8687 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8688
8689         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8690         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8691         Write 0 for the data_offset of scripts.
8692
8693 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8694
8695         * testsuite/Makefile.am: Add the incremental_test.sh test.
8696         * testsuite/incremental_test.sh: New.
8697         * testsuite/incremental_test_1.c: New.
8698         * testsuite/incremental_test_2.c: New.
8699
8700 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8701
8702         * incremental-dump.cc (main): Fix typos.
8703
8704 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8705
8706         PR gold/11025
8707         * incremental-dump.cc (main): Use llu to print 64 bit values.
8708
8709 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8710             H.J. Lu  <hongjiu.lu@intel.com>
8711
8712         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8713         $(LIBDL).
8714         (incremental_dump_LDADD): Likewise.
8715         * Makefile.in: Regenerated.
8716
8717 2009-11-25  Doug Kwan  <dougkwan@google.com>
8718
8719         Revert:
8720
8721         2009-11-25  Doug Kwan  <dougkwan@google.com>
8722
8723                 * arm.cc (Target_arm::Target_arm): Move method definition
8724                 outside of class definition.  Add code to handle
8725                 --target1-rel, --target1-abs and --target2= options.
8726                 (Target_arm::get_reloc_reloc_type): Change method to be
8727                 non-static and const.
8728                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8729                 New data member declaration.
8730                 (Target_arm::Scan::local, Target_arm::Scan::global,
8731                 Target_arm::Relocate::relocate,
8732                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8733                 Adjust call to Target_arm::get_real_reloc_type.
8734                 (Target_arm::get_real_reloc_type): Use command line options
8735                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8736                 * options.h (--target1-rel, --target1-abs, --target2): New
8737                 ARM-only options.
8738
8739 2009-11-25  Doug Kwan  <dougkwan@google.com>
8740
8741         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8742         class definition.  Add code to handle --target1-rel, --target1-abs
8743         and --target2= options.
8744         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8745         and const.
8746         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8747         member declaration.
8748         (Target_arm::Scan::local, Target_arm::Scan::global,
8749         Target_arm::Relocate::relocate,
8750         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8751         call to Target_arm::get_real_reloc_type.
8752         (Target_arm::get_real_reloc_type): Use command line options to
8753         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8754         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8755         options.
8756
8757 2009-11-25  Doug Kwan  <dougkwan@google.com>
8758
8759         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8760         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8761         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8762         formatting.
8763         (Arm_relocate_functions::thm_call): Replace body with a call to
8764         Arm_relocate_functions::thumb_branch_common.
8765         (Arm_relocate_functions::thm_jump24,
8766         Arm_relocate_functions::thm_xpc22): New method definitions.
8767         (Arm_relocate_functions::thumb_branch_common): New method definition.
8768         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8769         operator.
8770         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8771         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8772
8773 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8774
8775         * Makefile.am: Build incremental-dump
8776         * Makefile.in: Regenerate.
8777         * incremental-dump.cc: New.
8778         * incremental.cc (Incremental_inputs_header_data,
8779         Incremental_inputs_entry_data): Move to incremental.h
8780         * incremental.h: (Incremental_inputs_header_data,
8781         Incremental_inputs_entry_data): Move from incremental.cc
8782
8783 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8784
8785         * incremental.cc (Incremental_inputs_header,
8786         Incremental_inputs_header_write, Incremental_inputs_entry,
8787         Incremental_inputs_entry_write): Add a typedef with the data type.
8788
8789 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8790
8791         * incremental.cc (Incremental_inputs_header,
8792         Incremental_inputs_header_write, Incremental_inputs_entry,
8793         Incremental_inputs_entry_write): Update comment about which
8794         type has the filed descriptions.
8795
8796 2009-11-15  Doug Kwan  <dougkwan@google.com>
8797
8798         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8799         (Arm_relocate_functions::arm_branch_common): Change method defintion
8800         in class definition to a method declaration and update list of formal
8801         parameters.
8802         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8803         Arm_relocation_functions::jump24): Adjust call to
8804         Arm_relocate_functions::arm_branch_common.  Update list of formal
8805         parameters.
8806         (Arm_relocate_functions::xpc25): New method definition.
8807         (Arm_relocate_functions::arm_branch_common): Move method defintion
8808         out from class definition.  Use stubs for mode-switching and extending
8809         branch ranges.
8810         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8811         specially.  Change code to enable use of stubs in ARM branches.
8812
8813 2009-11-10  Doug Kwan  <dougkwan@google.com>
8814
8815         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8816         in method declaration.
8817         (Target_arm::relocate_stub): New method declaration.
8818         (Target_arm::default_target): Change to return a pointer instead of
8819         a const reference.
8820         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8821         Target_arm::default_target.
8822         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8823         method definition.
8824         (Target_arm::relocate_section): Adjust view.
8825         (Target_arm::relocate_stub): New method definition.
8826
8827 2009-11-10  Doug Kwan  <dougkwan@google.com>
8828
8829         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8830         a format warning.
8831         * incremental.cc (open_incremental_binary): Initialized local
8832         variables to avoid warnings.
8833         * object.cc (make_elf_object): Ditto.
8834         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8835         a format warning.
8836
8837 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8838
8839         PR gold/10930
8840         * testsuite/plugin_test.c: Include "config.h".
8841
8842 2009-11-09  Doug Kwan  <dougkwan@google.com>
8843
8844         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8845         (arm_symbol_value): Remove.
8846         (Arm_relocate_functions::arm_branch_common,
8847         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8848         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8849         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8850         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8851         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8852         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8853         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8854         Arm_relocate_functions::thm_mobw_abs_nc,
8855         Arm_relocate_functions::thm_mov_abs,
8856         Arm_relocate_functions::movw_prel_nc,
8857         Arm_relocate_functions::thm_movt_abs,
8858         Arm_relocate_functions::movt_prel,
8859         Arm_relocate_functions::thm_movw_prel_nc,
8860         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8861         (Target_arm::Relocate::relocate): Only decompose address into two
8862         parts if relocation type uses the thumb-bit and pass the actual
8863         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8864         calls to methods in Arm_relocate_functions for this change.
8865
8866 2009-11-08  Ian Lance Taylor  <iant@google.com>
8867
8868         PR 10925
8869         * reloc.cc: Instantiate
8870         Sized_relobj::initialize_input_to_output_maps and
8871         Sized_relobj:free_input_to_output_maps.
8872
8873 2009-11-06  Ian Lance Taylor  <iant@google.com>
8874
8875         PR 10876
8876         * defstd.cc (in_segment): Set only_if_ref true for "end".
8877
8878 2009-11-06  Doug Kwan  <dougkwan@google.com>
8879
8880         * arm.cc (class Reloc_stub): Correct a comment.
8881         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8882         (Target_arm::scan_section_for_stubs): New method declaration.
8883         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8884         Change methods from private to protected.
8885         (Target_arm::do_may_relax): New method definition.
8886         (Target_arm::do_relax, Target_arm::group_sections,
8887         Target_arm::scan_reloc_for_stub,
8888         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8889         (Target_arm::arm_input_section_map_): New data member declaration.
8890         (Target_arm::scan_reloc_for_stub,
8891         Target_arm::scan_reloc_section_for_stubs,
8892         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8893         Target_arm::do_relax): New method definitions.
8894
8895 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8896
8897         * configure.ac: Check for (struct stat)::st_mtim
8898         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8899         * config.in: Regenerate.
8900         * configure: Regenerate.
8901
8902 2009-11-05  Ian Lance Taylor  <iant@google.com>
8903
8904         PR 10910
8905         * output.cc (Output_segment::add_output_section): Add missing
8906         return statement.
8907
8908 2009-11-04  Ian Lance Taylor  <iant@google.com>
8909
8910         PR 10880
8911         * object.h (class Object): Add is_needed and set_is_needed
8912         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8913         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8914         defined in a dynamic object and referenced by a regular object,
8915         set is_needed for the dynamic object.
8916         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8917         if the file is marked with as_needed and it is not needed.
8918
8919 2009-11-04  Ian Lance Taylor  <iant@google.com>
8920
8921         PR 10887
8922         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8923         tags if data is discarded by linker script.
8924         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8925         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8926         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8927         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8928
8929 2009-11-04  Ian Lance Taylor  <iant@google.com>
8930
8931         * layout.cc (Layout::get_output_section): Add is_interp and
8932         is_dynamic_linker_section parameters.  Change all callers.
8933         (Layout::choose_output_section): Likewise.
8934         (Layout::make_output_section): Likewise.
8935         (Layout::add_output_section_data): Add is_dynamic_linker_section
8936         parameter.  Change all callers.
8937         * layout.h (class Layout): Update declarations.
8938         * output.h (class Output_section): Add is_interp, set_is_interp,
8939         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8940         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8941         generate_code_fills_at_write_ to a bitfield.
8942         * output.cc (Output_section::Output_sections): Initialize new
8943         fields.
8944         (Output_segment::add_output_section): Add do_sort parameter.
8945         Change all callers.
8946
8947 2009-11-03  Ian Lance Taylor  <iant@google.com>
8948
8949         PR 10860
8950         * options.h (class General_options): Add --warn-common.
8951         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8952         merging two common symbols.
8953         (Symbol_table::should_override): Handle --warn-common when merging
8954         a common symbol with a defined symbol.  Use report_resolve_problem
8955         for multiple definitions.
8956         (Symbol_table::report_resolve_problem): New function.
8957         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8958
8959 2009-11-03  Doug Kwan  <dougkwan@google.com>
8960
8961         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8962         stub_factory_.
8963         (Target_arm::stub_factory): New method definition.
8964         (Target_arm::new_arm_input_section,
8965         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8966         Target_arm::reloc_uses_thumb_bit): New method declarations.
8967         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8968         New type definitions.
8969         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8970         member declarations.
8971         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8972         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8973         New method definitions.
8974
8975 2009-11-03  Ian Lance Taylor  <iant@google.com>
8976
8977         * options.h (class General_options): Add --warn_constructors.
8978
8979 2009-11-03  Ian Lance Taylor  <iant@google.com>
8980
8981         PR 10893
8982         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8983         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8984
8985 2009-11-03  Ian Lance Taylor  <iant@google.com>
8986
8987         PR 10895
8988         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8989         --msgid-bugs-address.
8990         (install-pdf): New target.
8991         (install-data_yes): Look up one directory to find mkinstalldirs.
8992
8993 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8994
8995         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8996         tree.
8997
8998 2009-10-30  Doug Kwan  <dougkwan@google.com>
8999
9000         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9001
9002 2009-10-30  Doug Kwan  <dougkwan@google.com>
9003
9004         * arm.cc (Stub_addend_reader): New struct template definition
9005         and partial specializations.
9006         (Stub_addend_reader::operator()): New method definition for a
9007         partially specialized template.
9008
9009 2009-10-30  Doug Kwan  <dougkwan@google.com>
9010
9011         * arm.cc (Arm_relobj::processor_specific_flags): New method
9012         definition.
9013         (Arm_relobj::do_read_symbols): New method declaration.
9014         (Arm_relobj::processor_specific_flags_): New data member declaration.
9015         (Arm_dynobj): New class definition.
9016         (Target_arm::do_finalize_sections): Add input_objects parameter.
9017         (Target_arm::do_adjust_elf_header): New method declaration.
9018         (Target_arm::are_eabi_versions_compatible,
9019         (Target_arm::merge_processor_specific_flags): New method declaration.
9020         (Target_arm::do_make_elf_object): New overloaded method definitions
9021         and declaration.
9022         (Arm_relobj::do_read_symbols): New method definition.
9023         (Arm_dynobj::do_read_symbols): Ditto.
9024         (Target_arm::do_finalize_sections): Add input_objects parameters.
9025         Merge processor-specific flags from all input objects.
9026         (Target_arm::are_eabi_versions_compatible,
9027         Target_arm::merge_processor_specific_flags,
9028         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9029         New method definitions.
9030         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9031         Input_objects pointer type parameter.
9032         * layout.cc (Layout::finalize): Pass input objects to target's.
9033         finalize_sections function.
9034         * output.cc (Output_file_header::do_sized_write): Set ELF file
9035         header's processor-specific flags.
9036         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9037         Input_objects pointer type parameter.
9038         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9039         * target.h (Input_objects): New forward class declaration.
9040         (Target::processor_specific_flags,
9041         Target::are_processor_specific_flags_sect): New method definitions.
9042         (Target::finalize_sections): Add input_objects parameter.
9043         (Target::Target): Initialize processor_specific_flags_ and
9044         are_processor_specific_flags_set_.
9045         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9046         parameter.
9047         (Target::set_processor_specific_flags): New method definition.
9048         (Target::processor_specific_flags_,
9049         Target::are_processor_specific_flags_set_): New data member
9050         declarations.
9051         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9052         Input_objects pointer type parameter.
9053
9054 2009-10-30  Doug Kwan  <dougkwan@google.com>
9055
9056         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9057
9058 2009-10-28  Ian Lance Taylor  <iant@google.com>
9059
9060         * object.h (class Relobj): Drop options parameter from
9061         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9062         do_scan_relocs, do_relocate.  Change all callers.
9063         (class Sized_relobj): Drop options parameters from
9064         do_gc_process_relocs, do_scan_relocs, do_relocate,
9065         do_relocate_sections, relocate_sections, emit_relocs_scan,
9066         emit_relocs_scan_reltype.  Change all callers.
9067         (struct Relocate_info): Remove options field and all references to
9068         it.
9069         * reloc.h (class Read_relocs): Remove options constructor
9070         parameter and options_ field.  Change all callers.
9071         (class Gc_process_relocs, class Scan_relocs): Likewise.
9072         (class Relocate_task): Likewise.
9073         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9074         all callers.
9075         (scan_relocatable_relocs): Likewise.
9076         * target.h (class Sized_target): Remove options parameter from
9077         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9078         all callers.
9079         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9080         callers.
9081         * arm.cc: Update functions to remove options parameters.
9082         * i386.cc: Likewise.
9083         * powerpc.cc: Likewise.
9084         * sparc.cc: Likewise.
9085         * x86_64.cc: Likewise.
9086         * testsuite/testfile.cc: Likewise.
9087
9088 2009-10-28  Doug Kwan  <dougkwan@google.com>
9089
9090         * arm.cc (Arm_relobj): New class definition.
9091         (Arm_relobj::scan_sections_for_stubs,
9092         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9093         New method definitions.
9094
9095 2009-10-28  Cary Coutant  <ccoutant@google.com>
9096
9097         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9098         (Plugin::cleanup_done_): New member.
9099         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9100         (Plugin_manager::cleanup_done_): Remove.
9101         (Plugin_manager::add_input_file): Edit error message.
9102         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9103         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9104
9105 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9106
9107         * fileread.cc: (File_read::View::~View): Use the new
9108         data_ownership_ filed.
9109         (File_read::~File_read): Dispose the new whole_file_view_.
9110         (File_read::open): Mmap the whole file if needed.
9111         (File_read::open): Use whole_file_view_ instead of contents_.
9112         (File_read::find_view): Use whole_file_view_ if applicable.
9113         (File_read::do_read): Use whole_file_view_ instead of contents_.
9114         (File_read::make_view): Use whole_file_view_ instead of contents_,
9115         update File_read::View::View call.
9116         (File_read::find_or_make_view): Update File_read::View::View
9117         call.
9118         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9119         remove contents_
9120         (File_read::View::Data_ownership): New enum.
9121         (File_read::View::View): Replace bool mapped_ with Data_ownership
9122         argument.
9123         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9124         (File_read::View::data_ownership_): New field.
9125         (File_read::contents_): Remove (replaced by whole_file_view_).
9126         (File_read::whole_file_view_): New field.
9127         * options.h (class General_options): Add --keep-files-mapped.
9128
9129 2009-10-27  Cary Coutant  <ccoutant@google.com>
9130
9131         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9132         * testsuite/Makefile.am (plugin_test_5): New test case.
9133         * testsuite/Makefile.in: Regenerate.
9134
9135 2009-10-25  Doug Kwan  <dougkwan@google.com>
9136
9137         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9138         from private to protected to allow access by child class.
9139         (Sized_relobj::do_relocate_sections): New method declaration.
9140         (Sized_relobj::relocate_sections): Virtualize.
9141         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9142         Sized_relobj::relocate_sections.  Instantiate template explicitly
9143         for different target sizes and endianity.
9144
9145 2009-10-24  Doug Kwan  <dougkwan@google.com>
9146
9147         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9148         (Arm_input_section::as_arm_input_section): New method.
9149         (Arm_output_section): New class definition.
9150         (Arm_output_section::create_stub_group,
9151         Arm_output_section::group_sections): New method definitions.
9152
9153 2009-10-22  Doug Kwan  <dougkwan@google.com>
9154
9155         * arm.cc (Arm_input_section): New class definition.
9156         (Arm_input_section::init, Arm_input_section:do_write,
9157         Arm_input_section::set_final_data_size,
9158         Arm_input_section::do_reset_address_and_file_offset): New method
9159         definitions.
9160
9161 2009-10-21  Doug Kwan  <dougkwan@google.com>
9162
9163         * arm.cc (Stub_table, Arm_input_section): New forward class
9164         declarations.
9165         (Stub_table): New class defintion.
9166         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9167         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9168         New method definition.
9169
9170 2009-10-21  Doug Kwan  <dougkwan@google.com>
9171
9172         * arm.cc: Update copyright comments.
9173         (Target_arm): New forward class template declaration.
9174         (Arm_address): New type.
9175         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9176         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9177         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9178         constants.
9179         (Insn_template): Same.
9180         (DEF_STUBS): New macro.
9181         (Stub_type): New enum type.
9182         (Stub_template): New class definition.
9183         (Stub): Same.
9184         (Reloc_stub): Same.
9185         (Stub_factory): Same.
9186         (Target_arm::Target_arm): Initialize may_use_blx_ and
9187         should_force_pic_veneer_.
9188         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9189         Target_arm::should_force_pic_veneer,
9190         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9191         Target_arm::using_thumb_only, Target_arm:;default_target): New
9192         method defintions.
9193         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9194         New data member declarations.
9195         (Insn_template::size, Insn_template::alignment): New method defintions.
9196         (Stub_template::Stub_template): New method definition.
9197         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9198         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9199         (Stub_factory::Stub_factory): New method definition.
9200         * gold.h (string_hash): New template.
9201         * output.h (Input_section_specifier::hash_value): Use
9202         gold::string_hash.
9203         (Input_section_specifier::string_hash): Remove.
9204         * stringpool.cc (Stringpool_template::string_hash): Use
9205         gold::string_hash.
9206
9207 2009-10-20  Doug Kwan  <dougkwan@google.com>
9208
9209         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9210         symbols of relaxed input sections.
9211         * output.h (Output_section::find_relaxed_input_section): Make
9212         method public.
9213
9214 2009-10-16  Doug Kwan  <dougkwan@google.com>
9215
9216         * dynobj.cc (Versions::Versions): Initialize version_script_.
9217         Only insert base version symbol definition for a shared object
9218         if version script defines any version versions.
9219         (Versions::define_base_version): New method definition.
9220         (Versions::add_def): Check that base version is not needed.
9221         (Versions::add_need): Define base version lazily.
9222         * dynobj.h (Versions::define_base_version): New method declaration.
9223         (Versions::needs_base_version_): New data member declaration.
9224         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9225         (check_DATA): Add no_version_test.stdout.
9226         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9227         New make rules.
9228         * testsuite/Makefile.in: Regenerate.
9229         * testsuite/no_version_test.c: New file.
9230         * testsuite/no_version_test.sh: Ditto.
9231
9232 2009-10-16  Doug Kwan  <dougkwan@google.com>
9233
9234         * expression.cc (class Segment_start_expression): New class definition.
9235         (Segment_start_expression::value): New method definition.
9236         (script_exp_function_segment_start): Return a new
9237         Segment_start_expression.
9238         * gold/script-c.h (script_saw_segment_start_expression): New function
9239         prototype.
9240         * script-sections.cc (Script_sections::Script_sections): Initialize
9241         SAW_SEGMENT_START_EXPRESSION_ to false.
9242         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9243         and -Tbbs options to specify section addresses if given in
9244         command line and no SEGMENT_START expression is seen in a script.
9245         * script-sections.h (Script_sections::saw_segment_start_expression,
9246         Script_sections::set_saw_segment_start_expression): New method
9247         definition.
9248         (Script_sections::saw_segment_start_expression_): New data member
9249         declaration.
9250         * script.cc (script_saw_segment_start_expression): New function.
9251         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9252         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9253         script_test_7.sh and script_test_8.sh.
9254         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9255         script_test_8.stdout.
9256         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9257         (script_test_6, script_test_6.stdout, script_test_7,
9258         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9259         * Makefile.in: Regenerate.
9260         * testsuite/script_test_6.sh: New file.
9261         * testsuite/script_test_6.t: Same.
9262         * testsuite/script_test_7.sh: Same.
9263         * testsuite/script_test_7.t: Same.
9264         * testsuite/script_test_8.sh: Same.
9265
9266 2009-10-16  Doug Kwan  <dougkwan@google.com>
9267
9268         * output.cc (Output_segment::set_section_list_address): Cast
9269         expressions to unsigned long long type to avoid format warnings.
9270
9271 2009-10-15  Ian Lance Taylor  <iant@google.com>
9272
9273         * script.cc (Script_options::add_symbol_assignment): Always add a
9274         dot assignment to script_sections_.
9275         * script-sections.cc (Script_sections::add_dot_assignment):
9276         Initialize if necessary.
9277
9278         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9279         program headers with no load segment if there is a linker script.
9280
9281         * layout.cc (Layout::set_segment_offsets): Align the file offset
9282         to the segment aligment for -N or -n with no load segment.
9283         * output.cc (Output_segment::add_output_section): Don't crash if
9284         the first section is a TLS section.
9285         (Output_segment::set_section_list_addresses): Print an error
9286         message if the address moves backward in a linker script.
9287         * script-sections.cc
9288         (Output_section_element_input::set_section_addresses): Don't
9289         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9290         (Orphan_output_section::set_section_addresses): Likewise.
9291
9292 2009-10-15  Doug Kwan  <dougkwan@google.com>
9293
9294         * layout.cc (Layout::finish_dynamic_section): Generate tags
9295         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9296         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9297         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9298
9299 2009-10-14  Ian Lance Taylor  <iant@google.com>
9300
9301         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9302         fields.
9303         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9304         data_shdr fields of relinfo.
9305         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9306         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9307         R_386_TLS_LDO_32, adjust based on section flags.
9308         (Target_i386::Relocate::fix_up_ldo): Remove.
9309
9310 2009-10-13  Ian Lance Taylor  <iant@google.com>
9311
9312         Add support for -pie.
9313         * options.h (class General_options): Add -pie and
9314         --pic-executable.
9315         (General_options::output_is_position_independent): Test -pie.
9316         (General_options::output_is_executable): Return true if not shared
9317         and not relocatable.
9318         (General_options::output_is_pie): Remove.
9319         * options.cc (General_options::finalize): Reject incompatible uses
9320         of -pie.
9321         * gold.cc (queue_middle_tasks): A -pie link is not static.
9322         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9323         * symtab.cc (Symbol::final_value_is_known): Return false if
9324         output_is_position_independent.
9325         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9326         output_is_position_independent.
9327         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9328         output_is_position_independent.
9329         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9330         output_is_position_independent.
9331         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9332         two_file_pie_test.
9333         (basic_pie_test.o, basic_pie_test): New targets.
9334         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9335         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9336         (two_file_pie_test): New target.
9337         * testsuite/Makefile.in: Rebuild.
9338         * README: Remove note saying that -pie is not supported.
9339
9340 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9341
9342         * options.h (class General_options): Add -init and -fini.
9343         * layout.cc (Layout::finish_dynamic_section): Emit
9344         given init and fini functions.
9345
9346 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9347
9348         * gc.h (gc_process_relocs): Check if icf is enabled using new
9349         function.
9350         * gold.cc (queue_initial_tasks): Likewise.
9351         (queue_middle_tasks): Likewise.
9352         * object.cc (do_layout): Likewise.
9353         * symtab.cc (is_section_folded): Likewise.
9354         * main.cc (main): Likewise.
9355         * reloc.cc (Read_relocs::run): Likewise.
9356         (Sized_relobj::do_scan_relocs): Likewise.
9357         * icf.cc (is_function_ctor_or_dtor): New function.
9358         (Icf::find_identical_sections): Check if function is ctor or dtor when
9359         safe icf is chosen.
9360         * options.h (General_options::icf): Change option to be an enum.
9361         (Icf_status): New enum.
9362         (icf_enabled): New method.
9363         (icf_safe_folding): New method.
9364         (set_icf_status): New method.
9365         (icf_status_): New variable.
9366         * (options.cc) (General_options::finalize): Set icf_status_.
9367         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9368         icf_test and icf_keep_unique_test to use the --icf enum flag.
9369         * testsuite/icf_safe_test.sh: New file.
9370         * testsuite/icf_safe_test.cc: New file.
9371
9372 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9373
9374         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9375         includes to gc.h and icf.h.
9376         * arm.cc: Include gc.h.
9377         * gold.cc: Likewise.
9378         * i386.cc: Likewise.
9379         * powerpc.cc: Likewise.
9380         * sparc.cc: Likewise.
9381         * x86_64.cc: Likewise.
9382         * gc.h: Include icf.h.
9383
9384 2009-10-11  Ian Lance Taylor  <iant@google.com>
9385
9386         * plugin.cc: Include "gold.h" before other header files.
9387
9388 2009-10-10  Chris Demetriou  <cgd@google.com>
9389
9390         * options.h (Input_file_argument::Input_file_type): New enum.
9391         (Input_file_argument::is_lib_): Replace with...
9392         (Input_file_argument::type_): New member.
9393         (Input_file_argument::Input_file_argument): Take Input_file_type
9394         'type' rather than boolean 'is_lib' as second argument.
9395         (Input_file_argument::is_lib): Use type_.
9396         (Input_file_argument::is_searched_file): New function.
9397         (Input_file_argument::may_need_search): Handle is_searched_file.
9398         * options.cc (General_options::parse_library): Support -l:filename.
9399         (General_options::parse_just_symbols): Update for Input_file_argument
9400         changes.
9401         (Command_line::process): Likewise.
9402         * archive.cc (Archive::get_file_and_offset): Likewise.
9403         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9404         * script.cc (read_script_file, script_add_file): Likewise.
9405         * fileread.cc (Input_file::Input_file): Likewise.
9406         (Input_file::will_search_for): Handle is_searched_file.
9407         (Input_file::open): Likewise.
9408         * readsyms.cc (Read_symbols::get_name): Likewise.
9409         * testsuite/Makefile.am (searched_file_test): New test.
9410         * testsuite/Makefile.in: Regenerate.
9411         * testsuite/searched_file_test.cc: New file.
9412         * testsuite/searched_file_test_lib.cc: New file.
9413
9414 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9415             Ian Lance Taylor  <iant@google.com>
9416
9417         * descriptor.cc: Include <cstdio> and "binary-io.h".
9418         (Descriptors::open): Open the files in binary mode always.
9419         * script.cc (Lex::get_token): Treat \r as whitespace.
9420
9421 2009-10-09  Ian Lance Taylor  <iant@google.com>
9422
9423         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9424
9425 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9426             Ian Lance Taylor  <iant@google.com>
9427
9428         * configure.ac: Check for readv function also.
9429         * fileread.cc (readv): Define if not HAVE_READV.
9430         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9431         does not exist.
9432         * config.in: Regenerate.
9433         * configure: Regenerate.
9434
9435 2009-10-09  Doug Kwan  <dougkwan@google.com>
9436
9437         * layout.cc (Layout::make_output_section): Call target hook to make
9438         ordinary output section.
9439         (Layout::finalize): Adjust parameter list of call the
9440         Target::may_relax().
9441         * layout.h (class Layout::section_list): New method.
9442         * merge.h (Output_merge_base::entsize): Change visibility to public.
9443         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9444         New methods.
9445         (Output_merge_string::do_is_string): New method.
9446         * object.cc (Sized_relobj::do_setup): renamed from
9447         Sized_relobj::set_up.
9448         * object.h (Sized_relobj::adjust_shndx,
9449         Sized_relobj::initializ_input_to_output_maps,
9450         Sized_relobj::free_input_to_output_maps): Change visibilities to
9451         protected.
9452         (Sized_relobj::setup): Virtualize.
9453         (Sized_relobj::do_setup): New method declaration.
9454         (Sized_relobj::invalidate_section_offset,
9455         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9456         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9457         * options.cc (parse_int): New function.
9458         * options.h (parse_int): New declaration.
9459         (DEFINE_int): New macro.
9460         (stub_group_size): New option.
9461         * output.cc (Output_section::Output_section): Initialize memebers
9462         merge_section_map_, merge_section_by_properties_map_,
9463         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9464         (Output_section::add_input_section): Handled deferred code-fill
9465         generation and remove an old comment.
9466         (Output_section::add_relaxed_input_section): New method definition.
9467         (Output_section::add_merge_input_section): Use merge section by
9468         properties map to speed to search.  Update merge section maps
9469         as appropriate.
9470         (Output_section::build_relaxation_map): New method definition.
9471         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9472         Same.
9473         (Output_section::relax_input_section): Renamed to
9474         Output_section::convert_input_sections_to_relaxed_sections and change
9475         interface to take a vector of pointers to relaxed sections.
9476         (Output_section::find_merge_section,
9477         Output_section::find_relaxed_input_section): New method definitions.
9478         (Output_section::is_input_address_mapped,
9479         Output_section::output_offset, Output_section::output_address):
9480         Use output section data maps to speed up searching.
9481         (Output_section::find_starting_output_address): Add comments.
9482         (Output_section::do_write,
9483         Output_section::write_to_postprocessing_buffer): Do code-fill
9484         generation as appropriate.
9485         (Output_section::get_input_sections): Invalidate relaxed input section
9486         map.
9487         (Output_section::restore_states): Adjust type of checkpoint .
9488         Invalidate relaxed input section map.
9489         * output.h (Output_merge_base): New class declaration.
9490         (Input_section_specifier): New class defintion.
9491         (class Output_relaxed_input_section) Change base class to
9492         Output_section_data_build.
9493         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9494         base class initializer.
9495         (Output_section::add_relaxed_input_section): New method declaration.
9496         (Output_section::Input_section): Change visibility to protected.
9497         (Output_section::Input_section::relobj,
9498         Output_section::Input_section::shndx): Handle relaxed input sections.
9499         Output_section::input_sections) Change visibility to protected.  Also
9500         define overload to return a non-const pointer.
9501         (Output_section::Merge_section_properties): New class defintion.
9502         (Output_section::Merge_section_by_properties_map,
9503         Output_section::Output_section_data_by_input_section_map,
9504         Output_section::Relaxation_map): New types.
9505         (Output_section::relax_input_section): Rename method to
9506         Output_section::convert_input_sections_to_relaxed_sections and change
9507         interface to take a vector of relaxed section pointers.
9508         (Output_section::find_merge_section,
9509         Output_section::find_relaxed_input_section,
9510         Output_section::build_relaxation_map,
9511         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9512         New method declarations.
9513         (Output_section::merge_section_map_
9514         Output_section::merge_section_by_properties_map_,
9515         Output_section::relaxed_input_section_map_,
9516         Output_section::is_relaxed_input_section_map_valid_,
9517         Output_section::generate_code_fills_at_write_): New data members.
9518         * script-sections.cc
9519         (Output_section_element_input::set_section_addresses): Call
9520         current_data_size and addralign methods of relaxed input sections.
9521         (Orphan_output_section::set_section_addresses): Call current_data_size
9522         and addralign methods of relaxed input sections.
9523         * symtab.cc (Symbol_table::compute_final_value): Extract template
9524         from the body of Symbol_table::sized_finalize_symbol.
9525         (Symbol_table::sized_finalized_symbol): Call
9526         Symbol_table::compute_final_value.
9527         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9528         (Symbol_table::compute_final_value): New templated method declaration.
9529         * target.cc (Target::do_make_output_section): New method defintion.
9530         * target.h (Target::make_output_section): New method declaration.
9531         (Target::relax): Add more parameters for input objects, symbol table
9532         and layout.  Adjust call to do_relax.
9533         (Target::do_make_output_section): New method declaration.
9534         (Target::do_relax): Add parameters for input objects, symbol table
9535         and layout.
9536
9537 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9538
9539         * pread.c: Include stdio.h.
9540
9541 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9542
9543         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9544         defined.
9545
9546 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9547
9548         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9549         Change read_shndx type to unsigned int.
9550         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9551         int.
9552         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9553         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9554         Change read_shndx type to unsigned int.
9555         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9556         int.
9557         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9558         * layout.cc (Layout::create_symtab_sections): Cast the result of
9559         local_symcount * symsize to off_t in the gold_assert.
9560
9561 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9562
9563         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9564         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9565         R_ARM_BASE_ABS.
9566         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9567         (Arm_relocate_functions::thm_abs5): New function.
9568         (Arm_relocate_functions::abs12): New function.
9569         (Arm_relocate_functions::abs16): New function.
9570         (Arm_relocate_functions::base_abs): New function.
9571         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9572         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9573         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9574         R_ARM_BASE_ABS.
9575         (Scan::global): Likewise.
9576         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9577         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9578         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9579         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9580         R_ARM_BASE_ABS.
9581
9582 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9583
9584         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9585         (Arm_relocate_functions::movt_prel): New function.
9586         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9587         (Arm_relocate_functions::thm_movt_prel): New function.
9588         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9589         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9590         (Scan::global, Relocate::relocate): Likewise.
9591         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9592
9593 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9594
9595         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9596         Incremental_checker.
9597         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9598         unsigned int.
9599         (class Incremental_inputs_header): New class.
9600         (Incremental_inputs_header_writer): Edit comment.
9601         (Incremental_inputs_entry): New class.
9602         (Incremental_inputs_entry_writer): Edit comment.
9603         (Sized_incremental_binary::do_find_incremental_inputs_section):
9604         Add *strtab_shndx parameter, fill it.
9605         (Sized_incremental_binary::do_check_inputs): New method.
9606         (Incremental_checker::can_incrementally_link_output_file): Use
9607         Sized_incremental_binary::check_inputs.
9608         (Incremental_inputs::report_command_line): Save command line in
9609         command_line_.
9610         * incremental.h:
9611         (Incremental_binary::find_incremental_inputs_section): New
9612         method.
9613         (Incremental_binary::do_find_incremental_inputs_section): Add
9614         strtab_shndx parameter.
9615         (Incremental_binary::do_check_inputs): New pure virtual method.
9616         (Sized_incremental_binary::do_check_inputs): Declare.
9617         (Incremental_checker::Incremental_checker): Add incremental_inputs
9618         parameter, use it to initialize incremental_inputs_.
9619         (Incremental_checker::incremental_inputs_): New field.
9620         (Incremental_checker::command_line): New method.
9621         (Incremental_checker::inputs): New method.
9622         (Incremental_checker::command_line_): New field.
9623
9624 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9625
9626         * incremental.cc: Include <cstdarg> and "target-select.h".
9627         (vexplain_no_incremental): New function.
9628         (explain_no_incremental): New function.
9629         (Incremental_binary::error): New method.
9630         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9631         method.
9632         (make_sized_incremental_binary): New function.
9633         (open_incremental_binary): New function.
9634         (can_incrementally_link_file): Add checks if output is ELF and has
9635         inputs section.
9636         * incremental.h: Include "elfcpp_file.h" and "output.h".
9637         (Incremental_binary): New class.
9638         (Sized_incremental_binary): New class.
9639         (open_incremental_binary): Declare.
9640         * object.cc (is_elf_object): Use
9641         elfcpp::Elf_recognizer::is_elf_file.
9642         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9643         * output.h (Output_file::filesize): New method.
9644
9645 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9646
9647         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9648         New function.
9649         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9650         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9651         function.
9652         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9653         function.
9654         (Arm_relocate_functions::movw_abs_nc): New function.
9655         (Arm_relocate_functions::movt_abs): New function.
9656         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9657         (Arm_relocate_functions::thm_movt_abs): New function.
9658         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9659         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9660         (Scan::global): Likewise.
9661         (Relocate::relocate): Likewise.
9662         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9663
9664 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9665
9666         * arm.cc (Arm_relocate_functions::got_prel) New function.
9667         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9668         (Relocate::relocate): Likewise.
9669         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9670
9671 2009-10-06  Ian Lance Taylor  <iant@google.com>
9672
9673         * options.h (class General_options): Define
9674         split_stack_adjust_size parameter.
9675         * object.h (class Object): Add uses_split_stack_ and
9676         has_no_split_stack_ fields.  Add uses_split_stack and
9677         has_no_split_stack accessor functions.  Declare
9678         handle_split_stack_section.
9679         (class Reloc_symbol_changes): Define.
9680         (class Sized_relobj): Define Function_offsets.  Declare
9681         split_stack_adjust, split_stack_adjust_reltype, and
9682         find_functions.
9683         * object.cc (Object::handle_split_stack_section): New function.
9684         (Sized_relobj::do_layout): Call handle_split_stack_section.
9685         * dynobj.cc (Sized_dynobj::do_layout): Call
9686         handle_split_stack_section.
9687         * reloc.cc (Sized_relobj::relocate_sections): Call
9688         split_stack_adjust for executable sections in split_stack
9689         objects.  Pass reloc_map to relocate_section.
9690         (Sized_relobj::split_stack_adjust): New function.
9691         (Sized_relobj::split_stack_adjust_reltype): New function.
9692         (Sized_relobj::find_functions): New function.
9693         * target-reloc.h: Include "object.h".
9694         (relocate_section): Add reloc_symbol_changes parameter.  Change
9695         all callers.
9696         * target.h (class Target): Add calls_non_split method.  Declare
9697         do_calls_non_split virtual method.  Declare match_view and
9698         set_view_to_nop.
9699         * target.cc: Include "elfcpp.h".
9700         (Target::do_calls_non_split): New function.
9701         (Target::match_view): New function.
9702         (Target::set_view_to_nop): New function.
9703         * gold.cc (queue_middle_tasks): Give an error if mixing
9704         split-stack and non-split-stack objects with -r.
9705         * i386.cc (Target_i386::relocate_section): Add
9706         reloc_symbol_changes parameter.
9707         (Target_i386::do_calls_non_split): New function.
9708         * x86_64.cc (Target_x86_64::relocate_section): Add
9709         reloc_symbol_changes parameter.
9710         (Target_x86_64::do_calls_non_split): New function.
9711         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9712         parameter.
9713         * powerpc.cc (Target_powerpc::relocate_section): Add
9714         reloc_symbol_changes parameter.
9715         * sparc.cc (Target_sparc::relocate_section): Add
9716         reloc_symbol_changes parameter.
9717         * configure.ac: Call AM_CONDITIONAL for the default target.
9718         * configure: Rebuild.
9719         * testsuite/Makefile.am (TEST_AS): New variable.
9720         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9721         (check_DATA): Add split_i386 and split_x86_64 files.
9722         (SPLIT_DEFSYMS): Define.
9723         (split_i386_[1234n].o): New targets.
9724         (split_i386_[124]): New targets.
9725         (split_i386_[1234r].stdout): New targets.
9726         (split_x86_64_[1234n].o): New targets.
9727         (split_x86_64_[124]): New targets.
9728         (split_x86_64_[1234r].stdout): New targets.
9729         (MOSTLYCLEANFILES): Add new executables.
9730         * testsuite/split_i386.sh: New file.
9731         * testsuite/split_x86_64.sh: New file.
9732         * testsuite/split_i386_1.s: New file.
9733         * testsuite/split_i386_2.s: New file.
9734         * testsuite/split_i386_3.s: New file.
9735         * testsuite/split_i386_4.s: New file.
9736         * testsuite/split_i386_n.s: New file.
9737         * testsuite/split_x86_64_1.s: New file.
9738         * testsuite/split_x86_64_2.s: New file.
9739         * testsuite/split_x86_64_3.s: New file.
9740         * testsuite/split_x86_64_4.s: New file.
9741         * testsuite/split_x86_64_n.s: New file.
9742         * testsuite/testfile.cc (Target_test): Update relocation_section
9743         function.
9744         * testsuite/Makefile.in: Rebuild.
9745
9746 2009-10-06  Ian Lance Taylor  <iant@google.com>
9747
9748         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9749         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9750         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9751         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9752         the address on ldo_addrs_.
9753         (Target_i386::Relocate::fix_up_ldo): New function.
9754
9755 2009-10-06   Rafael Espindola  <espindola@google.com>
9756
9757         * plugin.cc (add_input_library): New.
9758         (Plugin::load): Add add_input_library to tv.
9759         (Plugin_manager::add_input_file): Add the is_lib argument.
9760         (add_input_file): Update call to Plugin_manager::add_input_file.
9761         (add_input_library): New.
9762         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9763
9764 2009-09-30  Doug Kwan  <dougkwan@google.com>
9765
9766         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9767         symbol and call Symbol::may_need_copy_reloc to determine if
9768         a copy reloc is needed.
9769         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9770         nocopyreloc is given in command line.
9771         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9772         given in command line.
9773         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9774         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9775         of the removed Target_i386::may_need_copy_reloc.
9776         * options.h (copyreloc): New option with default value false.
9777         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9778         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9779         instead of the removed Target_powerpc::may_need_copy_reloc.
9780         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9781         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9782         instead of the removed Target_sparc::may_need_copy_reloc.
9783         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9784         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9785         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9786         instead of the removed Target_x86_64::may_need_copy_reloc.
9787
9788 2009-09-30  Ian Lance Taylor  <iant@google.com>
9789
9790         * object.h (class Object): Remove target_ field, and target,
9791         sized_target, and set_target methods.
9792         (Object::sized_target): Remove.
9793         (class Sized_relobj): Update declarations.  Remove sized_target.
9794         * object.cc (Sized_relobj::setup): Remove target parameter.
9795         Change all callers.
9796         (Input_objects::add_object): Don't do anything with the target.
9797         (make_elf_sized_object): Add punconfigured parameter.  Change all
9798         callers.  Set or test parameter target.
9799         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9800         Change all callers.
9801         * parameters.cc (Parameters::set_target): Change parameter type to
9802         be non-const.
9803         (Parameters::default_target): Remove.
9804         (set_parameters_target): Change parameter type to be non-const.
9805         (parameters_force_valid_target): New function.
9806         (parameters_clear_target): New function.
9807         * parameters.h (class Parameters): Update declarations.  Remove
9808         default_target method.  Add sized_target and clear_target
9809         methods.  Change target_ to be non-const.
9810         (set_parameters_target): Update declaration.
9811         (parameters_force_valid_target): Declare.
9812         (parameters_clear_target): Declare.
9813         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9814         as NULL if we aren't searching.
9815         (Add_symbols::run): Don't check for compatible target.
9816         * fileread.cc (Input_file::open_binary): Call
9817         parameters_force_valid_target.
9818         * gold.cc (queue_middle_tasks): Likewise.
9819         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9820         set_target on object.
9821         * dynobj.h (class Sized_dynobj): Update declarations.
9822         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9823         make_elf_object returns NULL.
9824         (Archive::include_member): Don't check whether object target is
9825         compatible.
9826         * output.cc (Output_section::add_input_section): Get target from
9827         parameters.
9828         (Output_section::relax_input_section): Likewise.
9829         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9830         parameters.
9831         (Sized_relobj::do_scan_relocs): Likewise.
9832         (Sized_relobj::relocate_sections): Likewise.
9833         * resolve.cc (Symbol_table::resolve): Likewise.
9834         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9835         parameter.  Change all callers.
9836         (Symbol_table::add_from_object): Get target from parameters.
9837         (Symbol_table::add_from_relobj): Don't check object target.
9838         (Symbol_table::add_from_dynobj): Likewise.
9839         (Symbol_table::define_special_symbol): Get target from
9840         parameters.
9841         * symtab.h (class Symbol_table): Update declaration.
9842         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9843         parameter.  Change all callers.  Clear parameter target.
9844         (Binary_test): Test target here.
9845         * testsuite/object_unittest.cc (gold_testsuite): Remove
9846         target_test_pointer parameter.  Change all callers.
9847         (Object_test): Test target here.
9848
9849 2009-09-26  Ian Lance Taylor  <iant@google.com>
9850
9851         * testsuite/initpri1.c: Don't try to use constructor priorities if
9852         compiling with gcc before 4.3.
9853
9854 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9855
9856         * testsuite/retain_symbols_file_test.sh (check_present): Change
9857         output file name to retain_symbols_file_test.stdout.
9858         (check_absent): Likewise.
9859
9860 2009-09-18  Craig Silverstein  <csilvers@google.com>
9861
9862         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9863         * options.cc: Include <cerrno> and <fstream>.
9864         (General_options::finalize): Parse -retain-symbols-file tag.
9865         * options.h: New flag.
9866         (General_options): New method should_retain_symbol, new
9867         variable symbols_to_retain.
9868         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9869         should_retain_symbol map.
9870         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9871         * testsuite/Makefile.in: Regenerate.
9872         * testsuite/retain_symbols_file_test.sh: New file.
9873
9874 2009-09-18  Nick Clifton  <nickc@redhat.com>
9875
9876         * po/es.po: Updated Spanish translation.
9877
9878 2009-09-17  Doug Kwan  <dougkwan@google.com>
9879
9880         * debug.h (DEBUG_RELAXATION): New constant.
9881         (DEBUG_ALL): Add DEBUG_RELAXATION.
9882         (debug_string_to_enum): Add relaxation debug option.
9883         * layout.cc
9884         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9885         Layout::Relaxation_debug_check::read_sections,
9886         Layout::Relaxation_debug_check::read_sections): New method definitions.
9887         (Layout::Layout): Initialize data members
9888         record_output_section_data_from_scrips_,
9889         script_output_section_data_list_ and relaxation_debug_check_.
9890         (Layout::save_segments, Layout::restore_segments,
9891         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9892         Layout::relaxation_loop_body): New method definitions.
9893         (Layout::finalize): Support relaxation.  Move section layout code to
9894         Layout::relaxation_loop_body.
9895         (Layout::set_asection_address_from_script): Move code for orphan
9896         section placement out.
9897         (Layout::place_orphan_sections_in_script): New method definition.
9898         * layout.h (Output_segment_headers, Output_file_header):
9899         New forward class declarations.
9900         (Layout::~Layout): Define.
9901         (Layout::new_output_section_data_from_script): New method definition.
9902         (Layout::place_orphan_sections_in_script): New method declaration.
9903         (Layout::Segment_states): New type declaration.
9904         (Layout::save_segments, Layout::restore_segments,
9905         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9906         Layout::relaxation_loop_body): New method declarations.
9907         (Layout::Output_section_data_list): New type declaration.
9908         (Layout::Relaxation_debug_check): New class definition.
9909         (Layout::record_output_section_data_from_script_,
9910         Layout::script_output_section_data_list_, Layout::segment_states_,
9911         Layout::relaxation_debug_check_): New data members.
9912         * output.cc: (Output_section_headers::do_size): New method definition.
9913         (Output_section_headers::Output_section_headers): Move size
9914         computation to Output_section_headers::do_size.
9915         (Output_segment_headers::do_size): New method definition.
9916         (Output_file_header::Output_file_header): Move size computation to
9917         Output_file_header::do_size and call it.
9918         (Output_file_header::do_size): New method definition.
9919         (Output_data_group::Output_data_group): Adjust call to
9920         Output_section_data.
9921         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9922         (Output_symtab_xindex::do_write): Add array bound check.
9923         (Output_section::Input_section::print_to_mapfile): Handle
9924         RELAXED_INPUT_SECTION_CODE.
9925         (Output_section::Output_section): Initialize data member checkpoint_.
9926         (Output_section::~Output_section): Delete checkpoint object pointed
9927         by checkpoint_.
9928         (Output_section::add_input_section): Always add an Input_section if
9929         relaxing.
9930         (Output_section::add_merge_input_section): Add assert.
9931         (Output_section::relax_input_section): New method definition.
9932         (Output_section::set_final_data_size): Set load address to zero for
9933         an unallocated section.
9934         (Output_section::do_address_and_file_offset_have_reset_values):
9935         New method definition.
9936         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9937         Handle relaxed input section.
9938         (Output_section::sort_attached_input_sections): Checkpoint input
9939         section list lazily.
9940         (Output_section::get_input_sections): Change type of input_sections to
9941         list of Simple_input_section pointers.  Checkpoint input section list
9942         lazily.  Also handle relaxed input sections.
9943         (Output_section::add_input_section_for_script): Take a reference to
9944         a Simple_input_section object instead of Relobj pointer and section
9945         index as parameter.  Handle relaxed input sections.
9946         (Output_section::save_states, Output_section::restore_states): New
9947         method definitions.
9948         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9949         (Output_data::is_data_size_fixed): New method definition.
9950         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9951         if it is fixed.
9952         (Output_data::address_and_file_offset_have_reset_values): New method
9953         definition.
9954         (Output_data::do_address_and_file_offset_have_reset_values): New method
9955         definition.
9956         (Output_data::set_data_size): Check that data size is not fixed.
9957         (Output_data::fix_data_size): New method definition.
9958         (Output_data::is_data_size_fixed_): New data member.
9959         (Output_section_headers::set_final_data_size): New method definition.
9960         (Output_section_headers::do_size): New method declaration.
9961         (Output_segment_headers::set_final_data_size): New method definition.
9962         (Output_segment_headers::do_size): New method declaration.
9963         (Output_file_header::set_final_data_size)::New method definition.
9964         (Output_file_header::do_size)::New method declaration.
9965         (Output_section_data::Output_section_data): Add new parameter
9966         is_data_size_fixed and use it to fix data size.
9967         (Output_data_const::Output_data_const): Adjust call to base class
9968         constructor and fix data size.
9969         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9970         base class constructor and fix data size.
9971         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9972         base class constructor and fix data size.
9973         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9974         class constructor and fix data size.
9975         (Output_data_group::set_final_data_size): New method definition.
9976         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9977         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9978         class constructor and fix data size.
9979         (Output_relaxed_input_section): New class definition.
9980         (Output_section::Simple_input_section): New class definition.
9981         (Output_section::get_input_sections): Adjust parameter list.
9982         (Output_section::add_input_section_for_script): Same.
9983         (Output_section::save_states, Output_section::restore_states,
9984         Output_section::do_address_and_file_offset_have_reset_values,
9985         (Output_section::Input_section::Input_section): Handle
9986         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9987         Output_relaxed_input_section.
9988         (Output_section::Input_section::is_input_section,
9989         Output_section::Input_section::set_output_section): Handle relaxed
9990         input section.
9991         (Output_section::Input_section::is_relaxed_input_section,
9992         Output_section::Input_section::output_section_data,
9993         Output_section::Input_section::relaxed_input_section): New method
9994         definitions.
9995         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9996         value.
9997         (Output_section::Input_section::u1_): Update comments.
9998         (Output_section::Input_section::u2_): Add new union member poris.
9999         (Output_section::Checkpoint_output_section): New classs definition.
10000         (Output_section::relax_input_section): New method declaration.
10001         (Output_section::checkpoint_): New data member.
10002         (Output_segment): Update comments.
10003         (Output_segment::Output_segment): Un-privatize copy constructor.
10004         (Output_segment::operator=): Un-privatize.
10005         * script-sections.cc (Output_section_element::Input_section_list):
10006         Change element type to Output_section::Simple_input_section.
10007         (Output_section_element_dot_assignment::set_section_addresses):
10008         Register output section data for relaxation clean up.
10009         (Output_data_exression::Output_data_expression): Adjust call to base
10010         constructor to fix data size.
10011         (Output_section_element_data::set_section_addresses): Register
10012         Output_data_expression object for relaxation clean up.
10013         (struct Input_section_info): Replace Relobj pointer and section index
10014         pair with Output_section::Simple_input_section and Convert struct to a
10015         class.
10016         (Input_section_sorter::operator()): Adjust access to
10017         Input_section_info data member to use accessors.
10018         (Output_section_element_input::set_section_addresses): Use layout
10019         parameter.  Adjust code to use Output_section::Simple_input_section
10020         and Input_secction_info classes.  Register filler for relaxation
10021         clean up.
10022         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10023         and section index pair with Output_section::Simple_input_section
10024         class.  Adjust code accordingly.
10025         (Phdrs_element::release_segment): New method definition.
10026         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10027         segment list.
10028         (Script_sections::release_segments): New method definition.
10029         * gold/script-sections.h (Script_sections::release_segments): New
10030         method declaration.
10031         * gold/target.h (Target::may_relax, Target::relax,
10032         Target::do_may_relax, Target::do_relax): New method definitions.
10033
10034 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10035
10036         * arm.cc (has_signed_unsigned_overflow): New function.
10037         (Arm_relocate_functions::abs8): New function.
10038         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10039         (Target_arm::Scan::global): Likewise.
10040         (Target_arm::relocate::relocate): Likewise.
10041         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10042         Likewise.
10043
10044 2009-09-16  Cary Coutant  <ccoutant@google.com>
10045
10046         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10047         * testsuite/Makefile.in: Regenerate.
10048
10049 2009-09-11  Nick Clifton  <nickc@redhat.com>
10050
10051         * po/gold.pot: Updated by the Translation project.
10052
10053 2009-09-08  Cary Coutant  <ccoutant@google.com>
10054
10055         * output.cc (Output_file::open): Add execute permission to empty file.
10056         * testsuite/Makefile.am (permission_test): New test.
10057         * testsuite/Makefile.in: Regenerate.
10058
10059 2009-09-02  Ian Lance Taylor  <iant@google.com>
10060
10061         * output.cc (Output_file::resize): Call map_no_anonymous rather
10062         than map.
10063
10064 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10065
10066         * gold.cc: Include "incremental.h".
10067         (queue_initial_tasks): Call Incremental_checker methods.
10068         * incremental.cc: Include "output.h".
10069         (Incremental_checker::can_incrementally_link_output_file): New
10070         method.
10071         * incremental.h (Incremental_checker): New class.
10072
10073         * output.cc (Output_file::open_for_modification): New method.
10074         (Output_file::map_anonymous): Changed return type to bool.  Record
10075         map in base_ field.
10076         (Output_file::map_no_anonymous): New method, broken out of map.
10077         (Output_file::map): Use map_no_anonymous and map_anonymous.
10078         * output.h (class Output_file): Update declarations.
10079
10080 2009-08-24  Cary Coutant  <ccoutant@google.com>
10081
10082         * options.h (Command_line::Pre_options): New class.
10083         (Command_line::pre_options): New member.
10084         * options.cc (gold::options::ready_to_register): New variable.
10085         (One_option::register_option): Do nothing if not registering options.
10086         Assert if same short option registered twice.
10087         (General_options::General_options): Turn off option registration when
10088         done constructing.
10089         (Command_line::Pre_options::Pre_options): New constructor.
10090
10091 2009-08-24  Cary Coutant  <ccoutant@google.com>
10092
10093         * options.h (General_options::no_keep_memory): Remove incorrect
10094         short option.
10095
10096 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10097
10098         * Makefile.am (am__skiplex, am__skipyacc): New.
10099         * Makefile.in: Regenerate.
10100
10101 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10102
10103         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10104         (INCLUDES): ... this.
10105         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10106         (AM_CPPFLAGS): Renamed from ...
10107         (INCLUDE): ... this.
10108         * Makefile.in, testsuite/Makefile.in: Regenerate.
10109
10110         * Makefile.in: Regenerate.
10111         * aclocal.m4: Likewise.
10112         * config.in: Likewise.
10113         * configure: Likewise.
10114         * testsuite/Makefile.in: Likewise.
10115
10116         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10117         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10118         * Makefile.in: Regenerate.
10119         * testsuite/Makefile.in: Regenerate.
10120
10121 2009-08-19  Cary Coutant  <ccoutant@google.com>
10122
10123         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10124         symbols in shared libraries overridden by hidden or internal symbols
10125         in the main program.
10126
10127 2009-08-19  Chris Demetriou  <cgd@google.com>
10128
10129         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10130         checking source file names in error messages.
10131
10132 2009-08-18  Doug Kwan  <dougkwan@google.com>
10133
10134         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10135         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10136         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10137         an elfcpp::Ehdr as parameter.
10138         * object.cc (Object::set_target): Remove the version that looks up
10139         a target and sets it.
10140         (Sized_relobj::setup): Take a Target object instead of
10141         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10142         (make_elf_sized_object): Find target and ask target to
10143         make an ELF object.
10144         * object.h: (Object::set_target): Remove the version that looks up
10145         a target and sets it.
10146         (Sized_relobj::setup): Take a Target object instead of
10147         an elfcpp:Ehdr as parameter.
10148         * target.cc: Include dynobj.h.
10149         (Target::do_make_elf_object_implementation): New.
10150         (Target::do_make_elf_object): New.
10151         * target.h (Target::make_elf_object): New template declaration.
10152         (Target::do_make_elf_object): New method declarations.
10153         (Target::do_make_elf_object_implementation): New template declaration.
10154
10155 2009-08-14  Ian Lance Taylor  <iant@google.com>
10156
10157         * gold.h (FUNCTION_NAME): Define.
10158         (gold_unreachable): Use FUNCTION_NAME.
10159
10160 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10161
10162         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10163         symbol in the --keep-unique list is not found.
10164
10165 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10166
10167         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10168         been maked as --keep-unique.
10169         (Icf::unfold_section): New function.
10170         * icf.h (Icf::unfold_section): New function.
10171         * options.h (General_options::keep_unique): New option.
10172         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10173         * testsuite/Makefile.in: Regenerate.
10174         * testsuite/icf_keep_unique_test.sh: New file.
10175         * testsuite/icf_keep_unique_test.cc: New file.
10176
10177 2009-08-12  Cary Coutant  <ccoutant@google.com>
10178
10179         PR 10471
10180         * resolve.cc (Symbol_table::resolve): Check for references from
10181         dynamic objects to hidden and internal symbols.
10182         * testsuite/Makefile.am (hidden_test.sh): New test.
10183         * testsuite/Makefile.in: Regenerate.
10184         * testsuite/hidden_test.sh: New script.
10185         * testsuite/hidden_test_1.c: New test source.
10186         * testsuite/hidden_test_main.c: New test source.
10187
10188 2009-08-11  Doug Kwan  <dougkwan@google.com>
10189
10190         * arm.cc: Update comments.
10191         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10192         segment to locate the .ARM.exidx section if present.
10193
10194 2009-08-09  Doug Kwan  <dougkwan@google.com>
10195
10196         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10197         patch.
10198
10199 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10200         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10201         compiler warnings.
10202
10203 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10204
10205         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10206         valid tls_segment only for non-debug-section relocations.
10207         * testsuite/Makefile.am: Add gc_tls_test.
10208         * testsuite/Makefile.in: Regenerate.
10209         * testsuite/gc_tls_test.cc: New file.
10210         * testsuite/gc_tls_test.sh: New file.
10211
10212 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10213
10214         * icf.cc: New file.
10215         * icf.h: New file.
10216         * Makefile.am (CCFILES): Add icf.cc.
10217         (HFILES): Add icf.h
10218         * Makefile.in: Regenerate.
10219         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10220         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10221         section, symbol and addend information for the relocs.
10222         * gold.cc (queue_middle_tasks): Call identical code folding.
10223         * gold.h: Add defines for multimap.
10224         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10225         to the call of finalize_local_symbols.
10226         * main.cc (main): Create object of class Icf.
10227         * object.cc (Sized_relobj::do_layout): Allow this function to be
10228         called twice during icf.
10229         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10230         to sections marked as identical by icf.
10231         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10232         when available.
10233         (Sized_relobj::do_section_entsize): New function.
10234         * object.h (Object::section_entsize): New function.
10235         (Object::do_section_entsize): New pure virtual function.
10236         (Relobj::finalize_local_symbols): Add new parameter.
10237         (Relobj::do_section_entsize): New function.
10238         * options.h (General_options::icf): New option.
10239         (General_options::icf_iterations): New option.
10240         (General_options::print_icf_sections): New option.
10241         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10242         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10243         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10244         icf.
10245         * symtab.cc (Symbol_table::is_section_folded): New function.
10246         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10247         to sections marked as identical by icf.
10248         * symtab.h (Symbol_table::set_icf): New function.
10249         (Symbol_table::icf): New function.
10250         (Symbol_table::is_section_folded): New function.
10251         (Symbol_table::icf_): New data member.
10252         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10253         * testsuite/Makefile.am: Add commands to build icf_test.
10254         * testsuite/Makefile.in: Regenerate.
10255         * testsuite/icf_test.sh: New file.
10256         * testsuite/icf_test.cc: New file.
10257
10258 2009-07-24  Chris Demetriou  <cgd@google.com>
10259
10260         * layout.cc (is_compressible_debug_section): Fix incorrect
10261         comment about compressed section names.
10262
10263 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10264
10265         PR 10419
10266         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10267
10268 2009-07-16  Ian Lance Taylor  <iant@google.com>
10269
10270         PR 10400
10271         * layout.h: #include <map>.
10272         (class Kept_section): Change from struct to class.  Add accessors
10273         and setters.  Add section size to Comdat_group mapping.  Change
10274         Comdat_group to std::map.  Add is_comdat_ field.  Add
10275         linkonce_size field in union.
10276         (class Layout): Update declaration of find_or_add_kept_section.
10277         Don't declare find_kept_object.
10278         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10279         parameter.  Add object, shndx, is_comdat, and is_group_name
10280         parameters.  Change all callers.  Adjust for new Kept_section.
10281         (Layout::find_kept_object): Remove.
10282         * object.cc (Sized_relobj::include_section_group): Update use of
10283         Kept_section.  Rename secnum to shndx.  Only record
10284         Kept_comdat_section if sections are the same size.
10285         (Sized_relobj::include_linkonce_section): Update use of
10286         Kept_section.  Only record Kept_comdat_section if sections are the
10287         same size.  Set size of linkonce section.
10288         (Sized_relobj::map_to_kept_section): Update call to
10289         get_kept_comdat_section.
10290         * object.h (class Sized_relobj): Rename fields in
10291         Kept_comdat_section to drop trailing underscores; change object
10292         field to Relobj*.  Change Kept_comdat_section_table to store
10293         struct rather than pointer.
10294         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10295         Add kept_object and kept_shndx parameters.  Change all callers.
10296         (Sized_relobj::get_kept_comdat_section): Change return type to
10297         bool.  Add kept_object and kept_shndx parameters.  Change all
10298         callers.
10299         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10300         Layout::find_or_add_kept_section.
10301
10302 2009-07-09  Ian Lance Taylor  <iant@google.com>
10303
10304         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10305         Reserve space in the hash table.
10306
10307 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10308
10309         * fileread.cc (File_read::get_mtime): New method.
10310         * fileread.h (Timespec): New structure.
10311         (File_read::get_mtime): New method.
10312         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10313         Renamed from timestamp_nsec.
10314         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10315         Elf_Xword.
10316         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10317         timestamp_nsec.
10318         (Incremental_inputs::report_archive): Save mtime; style fix.
10319         (Incremental_inputs::report_obejct): Save mtime; style fix.
10320         (Incremental_inputs::report_script): Save mtime; style fix.
10321         (Incremental_inputs::finalize_inputs): Style fix.
10322         (Incremental_inputs::finalize): Style fix.
10323         (Incremental_inputs::create_input_section_data): Store inputs
10324         mtime.
10325         * incremental.h (Incremental_inputs::report_script): Add mtime
10326         argument.
10327         (Incremental_inputs::Input_info::Input_info): Intialize only one
10328         union member.
10329         (Incremental_inputs::Input_info::archive): Move to nameless
10330         union.
10331         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10332         (Incremental_inputs::Input_info::script): Move to nameless union.
10333         (Incremental_inputs::mtime): New field.
10334         * script.cc (read_input_script): Pass file mtime to
10335         Incremental_input.
10336         * script.h (Script_info::inputs): Style fix.
10337
10338 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10339
10340         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10341         instead of 32.
10342
10343 2009-06-24  Ian Lance Taylor  <iant@google.com>
10344
10345         PR 10156
10346         * layout.cc (Layout::choose_output_section): If we find an
10347         existing section, update the flags.
10348         (Layout::create_notes): New function, broken out of
10349         Layout::finalize.
10350         (Layout::finalize): Don't create note sections.
10351         (Layout::create_note): Don't crash if linker script discards
10352         section.
10353         (Layout::create_gold_note): Likewise.
10354         (Layout::create_build_id): Likewise.  Don't set
10355         after_input_sections on the section.
10356         (Layout::create_executable_stack_info): Remove target parameter.
10357         Change caller.
10358         * layout.h (class Layout): Declare create_notes.  Update
10359         declaration of create_executable_stack_info.
10360         * gold.cc (queue_middle_tasks): Call create_notes.
10361         * output.cc (Output_section::update_flags_for_input_section): Move
10362         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10363         invalid.
10364         * output.h (Output_data::mark_address_invalid): New function.
10365         (class Output_section): Only declare, not define,
10366         update_flags_for_input_section.  Remove set_flags.
10367
10368 2009-06-24  Ian Lance Taylor  <iant@google.com>
10369
10370         * script-sections.cc (Output_section_definition::
10371         set_section_addresses): Rename shadowing local load_address to
10372         laddr.
10373
10374 2009-06-24  Ian Lance Taylor  <iant@google.com>
10375
10376         PR 10244
10377         * reloc.cc (relocate_sections): Skip empty relocation sections.
10378
10379 2009-06-23  Ian Lance Taylor  <iant@google.com>
10380
10381         PR 10156
10382         * layout.cc (Layout::create_note): Use choose_output_section
10383         rather than make_output_section.
10384
10385 2009-06-23  Ian Lance Taylor  <iant@google.com>
10386
10387         PR 10237
10388         * options.cc (General_options::parse_V): Set printed_version_.
10389         (General_options::General_options): Initialize printed_version_.
10390         * options.h (class General_options): Add printed_version_ field.
10391         * gold.cc (queue_initial_tasks): If there are no input files,
10392         don't give a fatal error if we printed the version information.
10393         (queue_middle_tasks): If using -r with a shared object, give a
10394         fatal error rather than an ordinary error.
10395
10396 2009-06-23  Ian Lance Taylor  <iant@google.com>
10397
10398         PR 10219
10399         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10400         (Layout::make_output_section): Set have_stabstr_section_ if we see
10401         a .stab*str section.
10402         (Layout::finalize): Call link_stabs_sections.
10403         (Layout::link_stabs_sections): New file.
10404         * layout.h (class Layout): Add have_stabstr_section_ field.
10405         Declare link_stabs_sections.
10406
10407 2009-06-23  Doug Kwan  <dougkwan@google.com>
10408
10409         * Makefile.am (libgold_a_LIBADD): New.
10410         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10411         * Makefile.in: Regenerate.
10412         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10413         * configure: Regenerate.
10414         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10415         * fileread.cc: Include sys/state.h
10416         * gold.h: Declare memmem and strndup if found missing.
10417         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10418
10419 2009-06-23  Ian Lance Taylor  <iant@google.com>
10420
10421         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10422         * configure: Rebuild.
10423
10424 2009-06-23  Ian Lance Taylor  <iant@google.com>
10425
10426         PR 10147
10427         * object.cc (Object::section_contents): Don't try to get a view if
10428         the section has length zero.
10429         (Object::handle_gnu_warning_section): If the section is empty, use
10430         the name of the section as the warning.
10431
10432 2009-06-23  Ian Lance Taylor  <iant@google.com>
10433
10434         PR 10133
10435         * stringpool.h (class Stringpool_template): Add optimize_ field.
10436         (Stringpool_template::set_optimize): New function.
10437         * stringpool.cc (Stringpool_template::Stringpool_template):
10438         Initialize optimize_ field.
10439         (Stringpool_template::set_string_offsets): Test local optimize
10440         fild rather than parameter.
10441         * layout.cc (Layout::Layout): Call set_optimize on the section
10442         name stringpool.
10443
10444 2009-06-22  Ian Lance Taylor  <iant@google.com>
10445
10446         PR 10030
10447         * yyscript.y: Parse TARGET.
10448         * script.cc (script_set_target): New function.
10449         * script-c.h (script_set_target): Declare.
10450         * options.cc (General_options::string_to_object_format): Rename
10451         from string_to_object_format in anonymous namespace.  Change
10452         callers.
10453         * options.h (class General_options): Declare
10454         string_to_object_format.
10455
10456 2009-06-22  Ian Lance Taylor  <iant@google.com>
10457
10458         * script-sections.cc (Script_sections::create_segments): Don't put
10459         program headers in a PT_LOAD segment if -n or -N.
10460
10461 2009-06-22  Ian Lance Taylor  <iant@google.com>
10462
10463         PR 10141
10464         * options.h (class General_options): Add -z lazy and -z now.  Sort
10465         -z options into alphabetical order.
10466         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10467
10468 2009-06-21  Ian Lance Taylor  <iant@google.com>
10469
10470         * layout.cc (Layout::make_output_section): Call
10471         Target::new_output_section.
10472         (Layout::attach_allocated_section_to_segment): Put large section
10473         sections in a separate load segment with the large segment flag
10474         set.
10475         (Layout::segment_precedes): Sort large data segments after other
10476         load segments.
10477         (align_file_offset): New static function.
10478         (Layout::set_segment_offsets): Use align_file_offset.
10479         * output.h (class Output_section): Add is_small_section_ and
10480         is_large_section_ fields.
10481         (Output_section::is_small_section): New function.
10482         (Output_section::set_is_small_section):  New function.
10483         (Output_section::is_large_section): New function.
10484         (Output_section::set_is_large_section): New function.
10485         (Output_section::is_large_data_section): New function.
10486         (class Output_segment): Add is_large_data_segment_ field.
10487         (Output_segment::is_large_data_segment): New function.
10488         (Output_segment::set_is_large_data_segment): New function.
10489         * output.cc (Output_section::Output_section): Initialize new
10490         fields.
10491         (Output_segment::Output_segment): Likewise.
10492         (Output_segment::add_output_section): Add assertion that large
10493         data sections always go in large data segments.  Force small data
10494         sections to the end of the list of data sections.  Force small BSS
10495         sections to the start of the list of BSS sections.  For large BSS
10496         sections to the end of the list of BSS sections.
10497         * symtab.h (class Symbol): Declare is_common_shndx.
10498         (Symbol::is_defined): Check Symbol::is_common_shndx.
10499         (Symbol::is_common): Likewise.
10500         (class Symbol_table): Define enum Commons_section_type.  Update
10501         declarations.  Add small_commons_ and large_commons_ fields.
10502         * symtab.cc (Symbol::is_common_shndx): New function.
10503         (Symbol_table::Symbol_table): Initialize new fields.
10504         (Symbol_table::add_from_object): Put small and large common
10505         symbols in the right list.
10506         (Symbol_table::sized_finalized_symbol): Check
10507         Symbol::is_common_shndx.
10508         (Symbol_table::sized_write_globals): Likewise.
10509         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10510         common symbol lists.  Don't call do_allocate_commons_list if the
10511         list is empty.
10512         (Symbol_table::do_allocate_commons_list): Remove is_tls
10513         parameter.  Add comons_section_type parameter.  Change all
10514         callers.  Handle small and large common symbols.
10515         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10516         Symbol::is_common_shndx.
10517         * resolve.cc (symbol_to_bits): Likewise.
10518         * target.h (Target::small_common_shndx): New function.
10519         (Target::small_common_section_flags): New function.
10520         (Target::large_common_shndx): New function.
10521         (Target::large_common_section_flags): New function.
10522         (Target::new_output_section): New function.
10523         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10524         small_common_section_flags, and large_common_section_flags
10525         fields.
10526         (Target::do_new_output_section): New virtual function.
10527         * arm.cc (Target_arm::arm_info): Initialize new fields.
10528         * i386.cc (Target_i386::i386_info): Likewise.
10529         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10530         Likewise.
10531         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10532         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10533         (Target_x86_64::do_new_output_section): New function.
10534         * configure.ac: Define conditional MCMODEL_MEDIUM.
10535         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10536         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10537         (large_LDFLAGS): Define.
10538         * testsuite/large.c: New file.
10539         * testsuite/testfile.cc (Target_test::test_target_info):
10540         Initialize new fields.
10541         * configure, testsuite/Makefile.in: Rebuild.
10542
10543 2009-06-05  Doug Kwan  <dougkwan@google.com>
10544
10545         * Makefile.am (CCFILES): Add target.cc.
10546         * Makefile.in: Regenerate.
10547         * i386.cc (class Target_i386): Define new virtual method to
10548         override do_is_local_label_name in parent.
10549         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10550         local symbols if --discard-locals or -X is given.
10551         * options.h (class General_options): Declare new options
10552         '--discard-locals' and '-X' for discarding locals.
10553         * target.h (class Target): Define new methods is_local_label_name.
10554         Declare new virtual method do_is_local_label_name.
10555         * target.cc: New file.
10556         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10557         (check_SCRIPTS): Add discard_locals_test.sh.
10558         (check_DATA): Add discard_local_tests.syms.
10559         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10560         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10561         * testsuite/Makefile.in: Regenerate.
10562         * testsuite/discard_locals_test.c: New file.
10563         * testsuite/discard_locals_test.sh: Same.
10564
10565 2009-06-05  Doug Kwan  <dougkwan@google.com>
10566
10567         * object.cc (Sized_relobj::Sized_relobj): Initialize
10568         discarded_eh_frame_shndx_ to -1U.
10569         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10570         section.
10571         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10572         a discarded .eh_frame section.
10573         (Sized_relobj::do_finalize_local_symbols): Ditto.
10574         * object.h (class Sized_relobj): Declare new member
10575         discarded_eh_frame_shndx_.
10576         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10577         (local_labels_test.o, local_labels_test): New rules.
10578         * testsuite/Makefile.in: Regenerate.
10579
10580 2009-06-04  Doug Kwan  <dougkwan@google.com>
10581
10582         * layout.cc (Layout::section_name_mapping): Add mapping for
10583         special ARM sections.
10584
10585 2009-06-03  Doug Kwan  <dougkwan@google.com>
10586
10587         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10588         (utils::has_overflow): Same.
10589
10590 2009-06-03  Ian Lance Taylor  <iant@google.com>
10591
10592         * layout.cc (Layout::section_name_mapping): New array, replacing
10593         Layout::linkonce_mapping.
10594         (Layout::section_name_mapping_count): New variable, replacing
10595         Layout::linkonce_mapping_count.
10596         (Layout::linkonce_output_name): Remove.
10597         (Layout::output_section_name): Rewrite.
10598         * layout.h (class Layout): Rename Linkonce_mapping to
10599         Section_name_mapping, linkonce_mapping to section_name_mapping,
10600         linkonce_mapping_count to section_name_mapping_count.  Don't
10601         declare linkonce_output_name.
10602
10603 2009-06-03  Doug Kwan  <dougkwan@google.com>
10604
10605         * gold/arm.cc (namespace utils): New.
10606         (Target_arm::reloc_is_non_pic): Define new method.
10607         (class Arm_relocate_functions): New.
10608         (Target_arm::Relocate::relocate): Handle relocation types used by
10609         Android.
10610
10611 2009-06-03  Ian Lance Taylor  <iant@google.com>
10612
10613         * arm.cc (Target_arm::scan::global): Use || instead of |.
10614
10615 2009-06-02  Doug Kwan  <dougkwan@google.com>
10616
10617         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10618         issued_non_pic_error_.
10619         (class Target_arm::Scan): Declare new method check_non_pic.
10620         Define new method symbol_needs_plt_entry.
10621         Declare new data member issued_non_pic_error_.
10622         (class Target_arm::Relocate): Declare new method
10623         should_apply_static_reloc.
10624         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10625         (Target_arm::Scan::check_non_pic): Define new method.
10626         (Target_arm::Scan::local): Handle a small subset of reloc types used
10627         by Android.
10628         (Target_arm::Scan::local): Same.
10629         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10630
10631 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10632
10633         * incremental.cc (Incremental_inputs::report_command_line): Filter
10634         out --incremental-* options.
10635
10636 2009-05-29  Doug Kwan  <dougkwan@google.com>
10637
10638         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10639         template class.
10640         (class Target_arm): Update comment.
10641         (Target_arm::Target_arm): Initialize new data members GOT_,
10642         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10643         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10644         and Target_arm::rel_dyn_section.
10645         Declare new_enum Target_arm::Got_type.
10646         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10647         and DYNBSS_.
10648         Update commments for member do_dynsym_value.
10649         (Target_arm::got_size, Target_arm::plt_section,
10650         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10651         new methods inside class defintion.
10652         (Target_arm::got_section): Define new method.
10653         (Target_arm::rel_dyn_section): Same.
10654         (Output_data_plt_arm): New template class.
10655         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10656         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10657         (Output_data_plt_arm::add_entry): Same.
10658         (Output_data_plt_arm::first_plt_entry): Define new
10659         static data member for PLT instruction template.
10660         (Output_data_plt_arm::plt_entry): Same.
10661         (Output_data_plt_arm::do_write): Define new method.
10662         (Target_arm::make_plt_entry): Same.
10663         (Target_arm::do_finalize_sections): Same.
10664         (Target_arm::do_dynsym_value): Same.
10665
10666 2009-05-28  Doug Kwan  <dougkwan@google.com>
10667
10668         * Makefile.am (TARGETSOURCES): Add arm.cc.
10669         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10670         * Makefile.in: Regenerate.
10671         * arm.cc: New file.
10672         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10673
10674 2009-05-26  Doug Kwan  <dougkwan@google.com>
10675
10676         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10677         (General_options::check_excluded_libs): Strip off directories in
10678         archive name before matching like GNU ld does.
10679         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10680         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10681         (exclude_libs_test_LDFLAGS): Add linker option
10682         -Wl,--exclude-libs,libexclude_libs_test_3
10683         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10684         an explicit archive without using -l.
10685         (alt/libexclude_libs_test_3.a): New make rule.
10686         * testsuite/Makefile.in: Regenerate.
10687         * testsuite/exclude_libs_test.c : Declare lib3_default().
10688         (main): Call it.
10689         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10690         * exclude_libs_test_3.c: New file.
10691
10692 2009-05-26  Nick Clifton  <nickc@redhat.com>
10693
10694         * po/id.po: New Indonesian translation.
10695         * po/gold.pot: Updated template file.
10696
10697 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10698
10699         * testsuite/Makefile.am: Add -ffunction-sections to compile
10700         gc_comdat_test files.  Add -Wl,--gc-sections to build
10701         gc_comdat_test.
10702         * testsuite/Makefile.in: Regenerate.
10703         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10704
10705 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10706
10707         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10708         kept comdat section was garbage collected.
10709         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10710         * testsuite/Makefile.in: Regenerate.
10711         * testsuite/gc_comdat_test.sh: New file.
10712         * testsuite/gc_comdat_test_1.cc: New file.
10713         * testsuite/gc_comdat_test_2.cc: New file.
10714
10715 2009-05-19  Doug Kwan  <dougkwan@google.com>
10716
10717         * archive.cc (Archive::Archive): Move constructor from archive.h
10718         to here.  Initialize no_export_.
10719         (Archive::get_elf_object_for_member): Set no_export flag of object.
10720         * archive.h (Archive::Archive): Move constructor body to
10721         archive.cc.
10722         (Archive::no_export): New method.
10723         (Archive::no_export_): New field.
10724         * object.h (Object::Object): Initialize no_export_ to false.
10725         (Object::no_export, Object::set_no_export): New methods.
10726         (Object::no_export_): New field.
10727         * options.cc (General_options::parse_exclude_libs): New method.
10728         (General_options::check_excluded_libs) Same.
10729         * options.h (exclude_libs): New option.
10730         (General_options::check_excluded_libs): New method declaration.
10731         (General_options::excluded_libs_): New field.
10732         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10733         default or protected visibility if an object has no-export flag set.
10734         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10735         (check_SCRIPTS): Add exclude_libs_test.sh.
10736         (check_DATA): Add exclude_libs_test.syms.
10737         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10738         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10739         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10740         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10741         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10742         libexclude_libs_test_2.a): New rules.
10743         * testsuite/Makefile.in: Regenerate.
10744         * testsuite/exclude_libs_test.c: New file.
10745         * testsuite/exclude_libs_test.sh: Ditto.
10746         * testsuite/exclude_libs_test_1.c: Ditto.
10747         * testsuite/exclude_libs_test_2.c: Ditto.
10748
10749 2009-05-15  Ian Lance Taylor  <iant@google.com>
10750
10751         * configure.ac: Check for declarations for cases where libiberty.h
10752         checks HAVE_DECL_xxx.
10753         * configure, config.in: Rebuild.
10754
10755 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10756
10757         * gold.h (Incremental_argument_list): Remove (invalid) forward
10758         declaration.
10759         * incremental.cc (Incremental_inputs::report_achive): New method.
10760         (Incremental_inputs::report_object): New method.
10761         (Incremental_inputs::report_script): New method.
10762         (Incremental_inputs::finalize_inputs): New method.
10763         (Incremental_inputs::finalize): Call finalize_inputs().
10764         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10765         Create inputs entries.
10766         * incremental.h (Incremental_input_type): New enum.
10767         (Incremental_inputs::Incremental_input): Initialize new fields.
10768         (Incremental_inputs::report_inputs): New method.
10769         (Incremental_inputs::report_achive): New method.
10770         (Incremental_inputs::report_object): New method.
10771         (Incremental_inputs::report_script): New method.
10772         (Incremental_inputs::finalize_inputs): New method.
10773         (Incremental_inputs::Input_info): New struct.
10774         (Incremental_inputs::Input_info_map): New typedef.
10775         (Incremental_inputs::lock_): New field.
10776         (Incremental_inputs::Inputs_): New field.
10777         (Incremental_inputs::Inputs_map): New field.
10778         * main.cc (main): Call Incremental_input::report_inputs.
10779         * options.h (Input_argument_list): Typedef moved from
10780         Input_arguments.
10781         (Input_file_group::Files): Remove, use ::Input_argument_list.
10782         (Input_file_group::Input_argument_list): Remove, use
10783         ::Input_argument_list.
10784         * plugin.cc (Plugin_manager::add_input_file): Add error in
10785         incremental build.
10786         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10787         functions.
10788         * script.cc (read_input_script): Call
10789         Incremental_input::report_script.
10790         * script.h (Script_info): New class.
10791
10792 2009-04-27  Ian Lance Taylor  <iant@google.com>
10793
10794         * x86_64.cc (do_adjust_output_section): Set entsize to
10795         plt_entry_size.
10796
10797 2009-04-23  Elliott Hughes  <enh@google.com>
10798
10799         * output.cc (Output_file::close): After short writes, continue
10800         writing from the correct offset in the buffer being written.
10801
10802 2009-04-23  Chris Demetriou  <cgd@google.com>
10803
10804         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10805         * configure: Regenerate.
10806         * config.in: Regenerate.
10807         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10808         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10809
10810 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10811
10812         * incremental.cc (Incremental_inputs_header_data): Renamed from
10813         Incremental_input_header_data.
10814         (Incremental_inputs_header_data::data_size): New field.
10815         (Incremental_inputs_header_data::put_input_file_count): Renamed
10816         from input_file_count.
10817         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10818         from command_line_offset.
10819         (Incremental_inputs_header_data::put_reserved): Renamed from
10820         put_reserved.
10821         (Incremental_inputs_entry_data): Renamed from
10822         Incremental_input_entry_data.
10823         (Incremental_inputs_entry_data::data_size): New field.
10824         (Incremental_inputs::report_command_line): New method.
10825         (Incremental_inputs::finalize): New method.
10826         (Incremental_inputs::create_incremental_inputs_data): New method.
10827         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10828         * incremental.h: New file.
10829         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10830         (Layout::finalize): Create incremental inputs section in
10831         incremental builds.
10832         (Layout::create_incremental_info_sections): New method.
10833         * layout.h (Layout::incremental_inputs): New method.
10834         (Layout::create_incremental_info_sections): New method.
10835         (Layout::incremental_inputs_): New field.
10836         * main.cc (main): Notify Incremental_input of the command line.
10837
10838 2009-04-01  Ian Lance Taylor  <iant@google.com>
10839             Mikolaj Zalewski  <mikolajz@google.com>
10840
10841         * gold.h (reserve_unordered_map): Define, three versions, one for
10842         each version of Unordered_map.
10843         * layout.cc (Layout::Layout): Remove options parameter.  Add
10844         number_of_input_files parameter.  Don't initialize options_.
10845         Initialize number_of_input_files_ and resized_signatures_.  Move
10846         sections_are_attached_.
10847         (Layout::layout_group): Reserve space for group_signatures_.
10848         (Layout::find_or_add_kept_section): Change name parameter to be a
10849         reference.  Resize signatures_ map when it gets large enough.
10850         (Layout::layout_eh_frame): Use parameters->options() instead of
10851         this->options_.
10852         (Layout::make_output_section): Likewise.
10853         (Layout::attach_allocated_section_to_segment): Likewise.
10854         (Layout::finalize, Layout::create_executable_stack): Likewise.
10855         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10856         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10857         * layout.h (class Layout): Update declarations.  Remove options_
10858         field.  Add number_of_input_files_ and resized_signatures_
10859         fields.  Move sections_are_attached_ field.
10860         * main.cc (main): Pass number of input files to Layout
10861         constructor.  Don't pass options.
10862
10863 2009-03-30  Ian Lance Taylor  <iant@google.com>
10864
10865         * ffsll.c (ffsll): Correct implementation.
10866
10867 2009-03-27  Ian Lance Taylor  <iant@google.com>
10868
10869         * ffsll.c: New file.
10870         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10871         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10872         * ftruncate.c (ftruncate): Declare before definition.
10873         * mremap.c (mremap): Likewise.
10874         * pread.c (pread): Likewise.
10875         * configure, Makefile.in, config.in: Rebuild.
10876
10877         * mremap.c: New file.
10878         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10879         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10880         (mremap): Declare if HAVE_MREMAP is not defined.
10881         * configure, Makefile.in, config.in: Rebuild.
10882
10883 2009-03-27  Cary Coutant  <ccoutant@google.com>
10884
10885         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10886         position independent.
10887         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10888         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10889
10890 2009-03-24  Cary Coutant  <ccoutant@google.com>
10891
10892         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10893         an executable.
10894         (needs_dynamic_reloc): Likewise.
10895
10896 2009-03-24  Ian Lance Taylor  <iant@google.com>
10897
10898         * yyscript.y (file_cmd): Recognize EXTERN.
10899         (extern_name_list, extern_name_list_body): New nonterminals.
10900         * script.cc (script_add_extern): Define.
10901         * script-c.h (script_add_extern): Declare.
10902
10903 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10904
10905         * object.cc (is_elf_object): Define.
10906         * object.h (is_elf_object): Declare.
10907         * archive.cc (Archive::get_elf_object_for_member): Call
10908         is_elf_object.
10909         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10910
10911 2009-03-24  Elliott Hughes  <enh@google.com>
10912
10913         * output.cc (Output_file::map_anonymous): Define.
10914         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10915         try an anonymous one.  Report the size if the mmap fails.
10916         * output.h (class Output_file): Declare map_anonymous.
10917
10918 2009-03-24  Ian Lance Taylor  <iant@google.com>
10919
10920         * target-select.cc (instantiate_target): Don't acquire the lock if
10921         the instantiated_target_ field has already been set.
10922
10923 2009-03-23  Ian Lance Taylor  <iant@google.com>
10924
10925         * gold-threads.h (class Initialize_lock): Define.
10926         * gold-threads.cc (class Initialize_lock_once): Define.
10927         (initialize_lock_control): New static variable.
10928         (initialize_lock_pointer): New static variable.
10929         (initialize_lock_once): New static function.
10930         (Initialize_lock::Initialize_lock): Define.
10931         (Initialize_lock::initialize): Define.
10932         * target-select.h: Include "gold-threads.h".
10933         (class Target_selector): Add lock_ and initialize_lock_ fields.
10934         Don't define instantiate_target, just declare it.
10935         * target-select.cc (Target_selector::Target_selector): Initialize
10936         new fields.
10937         (Target_selector::instantiate_target): Define.
10938         * descriptors.h: Include "gold-threads.h".
10939         (class Descriptors): Add initialize_lock_ field.
10940         * descriptors.cc (Descriptors::Descriptors): Initialize new
10941         field.
10942         (Descriptors::open): Use initialize_lock_ field
10943         * errors.h (class Errors): Add initialize_lock_ field.
10944         * errors.cc (Errors::Errors): Initialize new field.
10945         (Errors::initialize_lock): Use initialize_lock_ field.
10946         * powerpc.cc (class Target_selector_powerpc): Remove
10947         instantiated_target_ field.  In do_recognize call
10948         instantiate_target rather than do_instantiate_target.  In
10949         do_instantiate_target just allocate a new target.
10950         * sparc.cc (class Target_selector_sparc): Likewise.
10951
10952         * freebsd.h: New file.
10953         * i386.cc: Include "freebsd.h".
10954         (Target_i386): Derive from Target_freebsd rather than
10955         Sized_target.
10956         (Target_selector_i386): Derive from Target_selector_freebsd rather
10957         than Target_selector.
10958         * x86_64.cc: Include "freebsd.h".
10959         (Target_x86_64): Derive from Target_freebsd rather than
10960         Sized_target.
10961         (Target_selector_x86_64): Derive from Target_selector_freebsd
10962         rather than Target_selector.
10963         * target.h (class Target): Add adjust_elf_header and
10964         do_adjust_elf_header.
10965         * output.cc (Output_file_header:: do_sized_write): Call target
10966         adjust_elf_header routine.
10967         * configure.tgt: Set targ_osabi.
10968         * configure.ac: Define GOLD_DEFAULT_OSABI.
10969         * parameters.cc (Parameters::default_target): Pass
10970         GOLD_DEFAULT_OSABI to select_target.
10971         * target-select.h (class Target_selector): Make instantiate_target
10972         protected rather than private.
10973         * Makefile.am (HFILES): Add freebsd.h.
10974         * configure, Makefile.in, config.in: Rebuild.
10975
10976         * merge.cc (do_add_input_section): Correct pend value.  Change
10977         message about last entry not being null terminated from error to
10978         warning.
10979
10980 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10981
10982         * incremental.cc: New file.
10983         * Makefile.am (CCFILES): Add incremental.cc.
10984         * Makefile.in: Rebuild.
10985
10986 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10987
10988         * layout.cc (Layout::output_section_name): Preserve names
10989         of '.note.' sections.
10990
10991 2009-03-19  Ian Lance Taylor  <iant@google.com>
10992
10993         * descriptors.cc (Descriptors::open): Check that the options are
10994         valid before using them.
10995
10996 2009-03-18  Ian Lance Taylor  <iant@google.com>
10997
10998         * script-sections.h: Include <list>.
10999         (class Script_sections): Change Sections_elements from std::vector
11000         to std::list.  Typedef public Elements_iterator.  Add
11001         orphan_section_placement_, data_segment_align_start_, and
11002         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11003         field.
11004         * script-sections.cc (class Orphan_section_placement): New class.
11005         (class Sections_element): Add virtual functions is_relro and
11006         orphan_section_init.  Remove virtual function place_orphan_here.
11007         (class Output_section_definition): Add is_relro and
11008         orphan_section_init.  Remove place_orphan_here.
11009         (class Orphan_output_section): Likewise.
11010         (Script_sections::Script_sections): Update for field changes.
11011         (Script_sections::data_segment_align): Set saw_data_segment_align_
11012         and data_segment_align_start_, not data_segment_align_index.
11013         (Script_sections::data_segment_relro_end): Check
11014         saw_data_segment_align_.  Use data_segment_align_start_ rather
11015         than data_segment_align_index_.
11016         (Script_sections::place_orphan): Rewrite to use
11017         Orphan_section_placement.
11018
11019 2009-03-17  Ian Lance Taylor  <iant@google.com>
11020
11021         * archive.cc (Archive::add_symbols): Check for a version attached
11022         to the symbol name in the archive map.
11023         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11024         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11025         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11026         (ver_test_11.a): New target.
11027         * testsuite/Makefile.in: Rebuild.
11028
11029         * configure.ac: Check for chsize and posix_fallocate.  Replace
11030         ftruncate.
11031         * ftruncate.c: New file, from gnulib.
11032         * output.cc (posix_fallocate): Define dummy version if not
11033         HAVE_POSIX_FALLOCATE.
11034         (Output_file::map): Call posix_fallocate rather than lseek and
11035         write.
11036         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11037         * configure, Makefile.in, config.in: Rebuild.
11038
11039 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11040
11041         * layout.h (Layout::create_note): Add section_name parameter.
11042         * layout.cc (Layout::create_note): Likewise.
11043         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11044
11045 2009-03-17  Ian Lance Taylor  <iant@google.com>
11046
11047         * descriptors.cc: Include "options.h".
11048         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11049         (Descriptors::open): Always use O_CLOEXEC when opening a new
11050         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11051         then set FD_CLOEXEC.
11052
11053         * sparc.cc (class Target_sparc): Add has_got_section.
11054         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11055         make sure we have a GOT section.
11056
11057         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11058         (Target_sparc::Scan::local): Likewise.
11059         (Target_sparc::Scan::global): Likewise.
11060         (Target_sparc::Relocate::relocate): Likewise.
11061         (Target_sparc::Relocate::relocate_tls): Likewise.
11062
11063         * symtab.cc (Symbol_table::define_default_version): New function,
11064         broken out of add_from_object.
11065         (Symbol_table::add_from_object): Call define_default_version.
11066         (Symbol_table::define_special_symbol): Add resolve_oldsym
11067         parameter.  Change all callers.  If the version for a symbol comes
11068         from a version script, resolve it with the symbol with the same
11069         name with no version.  Also add the symbol without a version if
11070         appropriate.
11071         (do_define_in_output_data): If resolving with oldsym, don't delete
11072         sym.
11073         (do_define_in_output_segment): Likewise.
11074         (do_define_as_constant): Likewise.
11075         * symtab.h (class Symbol_table): Update declarations.
11076
11077 2009-03-13  Ian Lance Taylor  <iant@google.com>
11078
11079         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11080         (Read_symbols::requeue): New function.
11081         (Read_symbols::do_read_symbols): If make_elf_object fails because
11082         the target type is not configured, and the file was searched for,
11083         issue a warning and retry with the next directory.
11084         (Add_symbols::run): If the file has an incompatible format, and
11085         it was searched for, requeue the Read_symbols task.  On error,
11086         release the object.
11087         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11088         dirindex parameter to constructor.  Change all callers.  Declare
11089         incompatible_warning and requeue.
11090         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11091         input_argument_ and input_group_ fields.  Add them to
11092         constructor.  Change all callers.
11093         (class Read_script): Add dirindex_ field.  Add it to constructor.
11094         Change all callers.
11095         * archive.cc (Archive::setup): Remove input_objects parameter.
11096         Change all callers.
11097         (Archive::get_file_and_offset): Likewise.
11098         (Archive::read_all_symbols): Likewise.
11099         (Archive::read_symbols): Likewise.
11100         (Archive::get_elf_object_for_member): Remove input_objects
11101         parameter.  Add punconfigured parameter.  Change all callers.
11102         (Archive::add_symbols): Change return type to bool.  Check return
11103         value of include_member.
11104         (Archive::include_all_members): Likewise.
11105         (Archive::include_member): Change return type to bool.  Return
11106         false if first included object has incompatible target.  Set
11107         included_member_ field.
11108         (Add_archive_symbols::run): If add_symbols returns false, requeue
11109         Read_symbols task.
11110         * archive.h (class Archive): Add included_member_ field.
11111         Initialize it in constructor.  Add input_file and searched_for
11112         methods.  Update declarations.
11113         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11114         input_argument_ fields.  Add them to constructor.  Change all
11115         callers.
11116         * script.cc: Include "target-select.h".
11117         (class Parser_closure): Add skip_on_incompatible_target_ and
11118         found_incompatible_target_ fields.  Add
11119         skip_on_incompatible_target parameter to constructor.  Change all
11120         callers.  Add methods skip_on_incompatible_target,
11121         clear_skip_on_incompatible_target, found_incompatible_target, and
11122         set_found_incompatible_target.
11123         (read_input_script): Add dirindex parameter.  Change all callers.
11124         If parser finds an incompatible target, requeue Read_symbols
11125         task.
11126         (script_set_symbol): Clear skip_on_incompatible_target in
11127         closure.
11128         (script_add_assertion, script_parse_option): Likewise.
11129         (script_start_sections, script_add_phdr): Likewise.
11130         (script_check_output_format): New function.
11131         * script.h (read_input_script): Update declaration.
11132         * script-c.h (script_check_output_format): Declare.
11133         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11134         (ignore_cmd): Remove OUTPUT_FORMAT.
11135         * fileread.cc (Input_file::Input_file): Add explicit this.
11136         (Input_file::will_search_for): New function.
11137         (Input_file::open): Add pindex parameter.  Change all callers.
11138         * fileread.h (class Input_file): Add input_file_argument method.
11139         Declare will_search_for.  Update declarations.
11140         * object.cc (make_elf_object): Add punconfigured parameter.
11141         Change all callers.
11142         * object.h (class Object): Make input_file public.  Add
11143         searched_for method.
11144         (make_elf_object): Update declaration.
11145         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11146         restart search.
11147         * dirsearch.h (class Dirsearch): Update declaration.
11148         * options.h (class General_options): Add --warn-search-mismatch.
11149         * parameters.cc (Parameters::is_compatible_target): New function.
11150         * parameters.h (class Parameters): Declare is_compatible_target.
11151         * workqueue.cc (Workqueue::add_blocker): New function.
11152         * workqueue.h (class Workqueue): Declare add_blocker.
11153
11154         * fileread.cc (Input_file::open): Remove options parameter.
11155         Change all callers.
11156         (Input_file::open_binary): Likewise.
11157         * script.cc (read_input_script): Likewise.
11158         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11159         options parameter from constructor.  Change all callers.
11160         (class Read_script): Likewise.
11161         * fileread.h (class Input_file): Update declarations.
11162         * script.h (read_input_script): Update declaration.
11163
11164 2009-03-10  Nick Clifton  <nickc@redhat.com>
11165
11166         * po/es.po: New Spanish translation.
11167
11168 2009-03-06  Cary Coutant  <ccoutant@google.com>
11169
11170         * options.cc (parse_short_option): Keep dash_z from registering itself.
11171
11172 2009-03-03  Ian Lance Taylor  <iant@google.com>
11173
11174         PR 9918
11175         * target-reloc.h (relocate_section): Pass output_section to
11176         relocate.
11177         * i386.cc (Target_i386::should_apply_static_reloc): Add
11178         output_section parameter.  Change all callers.
11179         (Target_i386::Relocate::relocate): Add output_section parameter.
11180         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11181         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11182         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11183         * testsuite/two_file_shared.sh: New script.
11184         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11185         (check_DATA): Add two_file_shared.dbg.
11186         (two_file_shared.dbg): New target.
11187         * testsuite/Makefile.in: Rebuild.
11188
11189 2009-03-01  Ian Lance Taylor  <iant@google.com>
11190
11191         * configure.ac: Check for byteswap.h.
11192         * configure: Rebuild.
11193         * config.in: Rebuild.
11194
11195 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11196
11197         * layout.cc (Layout::find_or_add_kept_section): New function.
11198         (Layout::add_comdat): Removed.
11199         * layout.h (struct Kept_section): Move out of class Layout.
11200         Remove trailing underscores from field names.  Add group_sections
11201         field.  Rename group_ field to is_group.  Change all uses.
11202         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11203         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11204         comdat_groups_ field.
11205         (Sized_relobj::include_section_group): Use
11206         find_or_add_kept_section and Kept_section::group_sections.
11207         (Sized_relobj::include_linkonce_section): Likewise.
11208         * object.cc (class Sized_relobj): Don't define Comdat_group or
11209         Comdat_group_table.  Remove find_comdat_group and
11210         add_comdat_group.  Remove comdat_groups_ field.
11211         * plugin.cc (include_comdat_group): Use
11212         Layout::find_or_add_kept_section.
11213
11214 2009-02-28  Ian Lance Taylor  <iant@google.com>
11215
11216         * README: --gc-sections and map files are now supported.  Document
11217         some build requirements.
11218
11219         PR 6992
11220         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11221         relocatable link set the value of the section symbol to zero.
11222         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11223         relocatable link don't include the section address in the local
11224         symbol value.
11225
11226 2009-02-27  Ian Lance Taylor  <iant@google.com>
11227
11228         PR 6811
11229         * options.h (class Search_directory): Add is_system_directory.
11230         (class General_options): Declare is_in_system_directory.
11231         * options.cc (get_relative_sysroot): Make static.
11232         (get_default_sysroot): Make static.
11233         (General_optoins::is_in_system_directory): New function.
11234         * fileread.cc (Input_file::is_in_system_directory): New function.
11235         * fileread.h (class Input_file): Declare is_in_system_directory.
11236         * object.h (class Object): Add is_in_system_directory.
11237         (class Input_objects): Remove system_library_directory_ field.
11238         * object.cc (Input_objects::add_object): Don't set
11239         system_library_directory_.
11240         (input_objects::found_in_system_library_directory): Remove.
11241         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11242         parameter.  Change all callers.
11243         (Symbol_table::sized_write_globals): Likewise.
11244         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11245         Call Object::is_in_system_directory.
11246         * symtab.h (class Symbol_table): Update declarations.
11247
11248         PR 5990
11249         * descriptors.h (Open_descriptor): Add is_on_stack field.
11250         * descriptors.cc (Descriptors::open): If the descriptor is on the
11251         top of the stack, remove it.  Initialize is_on_stack field.
11252         (Descriptors::release): Only add pod to stack if it is not on the
11253         stack already.
11254         (Descriptors::close_some_descriptor): Clear stack_next and
11255         is_on_stack fields.
11256
11257         PR 7091
11258         * output.cc (Output_section::find_starting_output_address): Rename
11259         from starting_output_address; add PADDR parameter; change return
11260         type.
11261         * output.h (class Output_section): Declare
11262         find_starting_output_address instead of starting_output_address.
11263         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11264         section symbol for which we can't find a merge section.
11265
11266         PR 9836
11267         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11268         hidden or internal, force the symbol to be local.
11269         * resolve.cc (Symbol::override_visibility): Define.
11270         (Symbol::override_base): Use override_visibility.
11271         (Symbol_table::resolve): Likewise.
11272         (Symbol::override_base_with_special): Likewise.
11273         (Symbol_table::override_with_special): If the visibility is hidden
11274         or internal, force the symbol to be local.
11275         * symtab.h (class Symbol): Add set_visibility and
11276         override_visibility.
11277         * testsuite/ver_test_1.sh: New file.
11278         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11279         (check_DATA): Add ver_test_1.syms.
11280         (ver_test_1.syms): New target.
11281         * testsuite/Makefile.in: Rebuild.
11282
11283 2009-02-25  Cary Coutant  <ccoutant@google.com>
11284
11285         * layout.cc (Layout::choose_output_section): Don't rename sections
11286         when using a linker script that has a SECTIONS clause.
11287         * Makefile.in: Regenerate.
11288
11289         * testsuite/Makefile.am (script_test_5.sh): New test case.
11290         * testsuite/Makefile.in: Regenerate.
11291         * testsuite/script_test_5.cc: New file.
11292         * testsuite/script_test_5.sh: New file.
11293         * testsuite/script_test_5.t: New file.
11294
11295 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11296
11297         * archive.cc (Archive::include_member): Update calls to add_symbols.
11298         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11299         the Layout argument.
11300         * dynobj.h (do_add_symbols): Add the Layout argument.
11301         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11302         Layout argument.
11303         * object.h (Object::add_symbols): Add the Layout argument.
11304         (Object::do_add_symbols): Add the Layout argument.
11305         (Sized_relobj::do_add_symbols): Add the Layout argument.
11306         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11307         Unify the two versions.
11308         (Add_plugin_symbols): Remove.
11309         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11310         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11311         (Add_plugin_symbols): Remove.
11312         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11313         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11314         (Add_symbols::run): Make it work with Pulginobj.
11315
11316 2009-02-06  Ian Lance Taylor  <iant@google.com>
11317
11318         * object.cc (Sized_relobj::do_layout): Make info message start
11319         with lower case letter.
11320
11321 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11322
11323         * binary.cc: Fix file comment.
11324
11325         * options.h (enum Incremental_disposition): Define.
11326         (class General_options): Add new options: --incremental,
11327         --incremental_changed, --incremental_unchanged,
11328         --incremental_unknown.  Add incremental_disposition_ and
11329         implicit_incremental_ fields.
11330         (General_options::incremental_disposition): New function.
11331         (class Position_dependent_options): Add incremental_disposition
11332         option.
11333         (Position_dependent_options::copy_from_options): Set incremental
11334         dispositions.
11335         * options.cc (General_options::parse_incremental_changed): New
11336         function.
11337         (General_options::parse_incremental_unchanged): New function.
11338         (General_options::parse_incremental_unknown): New function.
11339         (General_options::General_options): Initialize new fields
11340         incremental_disposition_ and implicit_incremental_.
11341         (General_options::finalize): Check for uasge of --incremental-*
11342         without --incremental.
11343
11344 2009-02-06  Chris Demetriou  <cgd@google.com>
11345
11346         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11347         pointer and to report location as the file name associated with
11348         the symbol.
11349         (gold_undefined_symbol_at_location): New function to replace the
11350         old gold_undefined_symbol functionality.
11351         * target-reloc.h (relocate_section): Update to use
11352         gold_undefined_symbol_at_location.
11353         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11354         Call gold_undefined_symbol function rather than gold_error.
11355         * errors.h (Errors::undefined_symbol): Take location as a
11356         string, rather than calculating it from a relocation.
11357         * errors.cc (Errors::fatal): Print "fatal error:" before the
11358         formatted message.
11359         (Errors::error, Errors::error_at_location): Print "error: "
11360         before the formatted message.
11361         (Errors::undefined_symbol): Take location as a string, rather
11362         than calculating it from a relocation.
11363         (gold_undefined_symbol_at_location): New function akin to
11364         old gold_undefined_symbol, calculates location from relocation.
11365         (gold_undefined_symbol): Change to take only a Symbol pointer
11366         and to report location as the file name associated with the symbol.
11367         * testsuite/debug_msg.sh: Update for changed error messages.
11368         * testsuite/undef_symbol.sh: Likewise.
11369
11370 2009-02-04  Duncan Sands  <baldrick@free.fr>
11371
11372         PR 9812
11373         * reduced_debug_output.h
11374         (Output_reduced_debug_abbrev_section::failed): Use format for
11375         gold_warning.
11376         (Output_reduced_debug_info_section::faild): Likewise.
11377
11378 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11379
11380         * script.cc (Lazy_demangler): New class.
11381         (Version_script_info::get_symbol_version_helper): Demangle a
11382         symbol only once.
11383
11384 2009-01-29  Cary Coutant  <ccoutant@google.com>
11385
11386         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11387         to __tls_get_addr.
11388         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11389
11390 2009-01-28  Ian Lance Taylor  <iant@google.com>
11391
11392         * version.cc (version_string): Bump to 1.9.
11393
11394         * gold.h: Include <cstring> and <stdint.h>.
11395         * version.cc: Include <cstdio>.
11396         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11397         warning.
11398         * reduced_debug_output.cc (insert_into_vector): Rename from
11399         Insert_into_vector; change all callers.  Use Swap_unaligned to
11400         avoid aliasing issue; remove union since it is unnecessary.
11401
11402 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11403
11404         * Makefile.am (CCFILES): Add gc.cc.
11405         (HFILES): Add gc.h.
11406         * Makefile.in: Regenerate.
11407         * gold.cc (Gc_runner): New class.
11408         (queue_initial_tasks): Call garbage collection related tasks
11409         when corresponding options are invoked.
11410         (queue_middle_gc_tasks): New function.
11411         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11412         processed early before laying out sections during garbage collection.
11413         * gold.h (queue_middle_gc_tasks): New function.
11414         (is_prefix_of): Move from "layout.cc".
11415         * i386.cc (Target_i386::gc_process_relocs): New function.
11416         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11417         * main.cc (main): Create object of class "Garbage_collection".
11418         * object.cc (Relobj::copy_symbols_data): New function.
11419         (Relobj::is_section_name_included): New function.
11420         (Sized_relobj::do_layout): Allow this function to be called twice
11421         during garbage collection and defer layout of section during the
11422         first call.
11423         * object.h (Relobj::get_symbols_data): New function.
11424         (Relobj::is_section_name_included): New function.
11425         (Relobj::copy_symbols_data): New function.
11426         (Relobj::set_symbols_data): New function.
11427         (Relobj::get_relocs_data): New function.
11428         (Relobj::set_relocs_data): New function.
11429         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11430         (Relobj::gc_process_relocs): New function.
11431         (Relobj::do_gc_process_relocs): New pure virtual function.
11432         (Relobj::sd_): New data member.
11433         (Sized_relobj::is_output_section_offset_invalid): New function.
11434         (Sized_relobj::do_gc_process_relocs): New function.
11435         * options.h (General_options::gc_sections): Modify to not be a no-op.
11436         (General_options::print_gc_sections): New option.
11437         * plugin.cc (Plugin_finish::run): Remove function call to
11438         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11439         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11440         * reloc.cc (Read_relocs::run): Add task to process relocs and
11441         determine unreferenced sections when doing garbage collection.
11442         (Gc_process_relocs): New class.
11443         (Sized_relobj::do_gc_process_relocs): New function.
11444         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11445         sections that are garbage collected.
11446         * reloc.h (Gc_process_relocs): New class.
11447         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11448         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11449         symbols whose corresponding sections are garbage collected.
11450         (Symbol_table::Symbol_table): Add new parameter for the garbage
11451         collection object.
11452         (Symbol_table::gc_mark_undef_symbols): New function.
11453         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11454         (Symbol_table::gc_mark_dyn_syms): New function.
11455         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11456         as garbage.
11457         (Symbol_table::add_from_object): Likewise.
11458         (Symbol_table::add_from_relobj): When building shared objects, do not
11459         treat externally visible symbols as garbage.
11460         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11461         table information for static and relocatable links.
11462         * symtab.h (Symbol_table::set_gc): New function.
11463         (Symbol_table::gc): New function.
11464         (Symbol_table::gc_mark_undef_symbols): New function.
11465         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11466         (Symbol_table::gc_mark_dyn_syms): New function.
11467         (Symbol_table::gc_): New data member.
11468         * target.h (Sized_target::gc_process_relocs): New pure virtual
11469         function.
11470         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11471         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11472
11473 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11474
11475         * options.h (General_options::gc_sections): Define as a no-op for now.
11476         (General_options::no_keep_memory): Ditto.
11477         (General_options::Bshareable): Define.
11478         * options.cc (General_options::finalize): Honor -Bshareable.
11479
11480 2009-01-20  Andreas Schwab  <schwab@suse.de>
11481
11482         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11483         read the value in the contents, since we don't use it.  Use the
11484         template endianness when writing.
11485         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11486
11487 2009-01-19  Andreas Schwab  <schwab@suse.de>
11488
11489         * configure.tgt (powerpc64-*): Fix targ_obj.
11490
11491 2009-01-15  Ian Lance Taylor  <iant@google.com>
11492
11493         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11494         local symbols when stripping all symbols.
11495
11496 2009-01-14  Cary Coutant  <ccoutant@google.com>
11497
11498         * output.cc (Output_reloc): Add explicit instantiations.
11499
11500 2009-01-14  Cary Coutant  <ccoutant@google.com>
11501
11502         * archive.cc (Archive::get_elf_object_for_member): Remove call
11503         to File_read::claim_for_plugin.
11504         * descriptors.cc (Descriptors::open): Remove reference to
11505         is_claimed.
11506         (Descriptors::claim_for_plugin): Remove.
11507         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11508         (Descriptors::is_claimed): Remove.
11509         (claim_descriptor_for_plugin): Remove.
11510         * fileread.cc (File_read::claim_for_plugin): Remove.
11511         * fileread.h (File_read::claim_for_plugin): Remove.
11512         (File_read::descriptor): Reopen descriptor if necessary.
11513         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11514         (Plugin_manager::all_symbols_read): Add task parameter. Change
11515         all callers.
11516         (Plugin_manager::get_input_file): New function.
11517         (Plugin_manager::release_input_file): New function.
11518         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11519         corresponding data member.
11520         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11521         and pass to base constructor. Change all callers.
11522         (get_input_file, release_input_file): New functions.
11523         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11524         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11525         (Plugin_manager::all_symbols_read): Add task parameter.
11526         (Plugin_manager::get_input_file): New function.
11527         (Plugin_manager::release_input_file): New function.
11528         (Plugin_manager::task_): New data member.
11529         (Pluginobj::Pluginobj): Add filesize parameter.
11530         (Pluginobj::filename): New function.
11531         (Pluginobj::descriptor): New function.
11532         (Pluginobj::filesize): New function.
11533         (Pluginobj::filesize_): New data member.
11534         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11535         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11536         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11537
11538         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11539         with archive libraries.
11540         * testsuite/Makefile.in: Regenerate.
11541         * testsuite/plugin_test.c (struct sym_info): New type.
11542         (get_input_file, release_input_file): New static variables.
11543         (onload): Capture new transfer vector entries.
11544         (claim_file_hook): Stop reading at end of file according to filesize.
11545         Factor out parsing of readelf output into separate function.
11546         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11547         APIs and get the source file name from the symbol table.  Convert
11548         source file name to corresponding object file name.  Print info
11549         message when adding new input files.
11550         (parse_readelf_line): New function.
11551         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11552         * testsuite/plugin_test_2.sh: Likewise.
11553         * testsuite/plugin_test_3.sh: Likewise.
11554         * testsuite/plugin_test_4.sh: New test case.
11555
11556 2009-01-07  Ian Lance Taylor  <iant@google.com>
11557
11558         * version.cc (version_string): Bump to 1.8.
11559
11560 2008-12-23  Cary Coutant  <ccoutant@google.com>
11561
11562         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11563         * plugin.cc (Plugin_manager::finish): Rename as
11564         layout_deferred_objects.  Move cleanup to separate function.
11565         (Plugin_manager::cleanup): New function.
11566         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11567         separately.
11568         * plugin.h (Plugin_manager::finish): Rename as
11569         layout_deferred_objects.
11570         (Plugin_manager::cleanup): New function.
11571         (Plugin_manager::cleanup_done): New field.
11572
11573 2008-12-23  Cary Coutant  <ccoutant@google.com>
11574
11575         * plugin.cc (is_visible_from_outside): New function.
11576         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11577         so we don't return "IR only" status for exported symbols or -r links.
11578
11579         * testsuite/Makefile.am (plugin_test_3): New test case.
11580         * testsuite/Makefile.in: Regenerate.
11581         * testsuite/plugin_test_3.sh: New file.
11582
11583 2008-12-22  Cary Coutant  <ccoutant@google.com>
11584
11585         * object.cc (Sized_relobj::layout_section): New function.
11586         (Sized_relobj::do_layout): Defer layout of input sections until after
11587         plugin has provided replacement files.
11588         (Sized_relobj::do_layout_deferred_sections): New function.
11589         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11590         (Relobj::layout_deferred_sections): New function.
11591         (Relobj::do_layout_deferred_sections): New function.
11592         (Sized_relobj::do_layout_deferred_sections): New function.
11593         (Sized_relobj::layout_section): New function.
11594         (Sized_relobj::Deferred_layout): New structure.
11595         (Sized_relobj::deferred_layout_): New field.
11596         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11597         Change all callers.  Layout deferred sections.
11598         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11599         references.
11600         (Plugin_hook::run): Move code from do_plugin_hook inline.
11601         (Plugin_hook::do_plugin_hook): Remove.
11602         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11603         (Plugin_manager::finish): Renamed, was cleanup.
11604         (Plugin_manager::should_defer_layout): New function.
11605         (Plugin_manager::add_deferred_layout_object): New function.
11606         (Plugin_manager::Deferred_layout_list): New type.
11607         (Plugin_manager::deferred_layout_objects_): New field.
11608         (Plugin_hook::do_plugin_hook): Remove.
11609
11610 2008-12-17  Ian Lance Taylor  <iant@google.com>
11611
11612         * options.h (class General_options): Add --no case for
11613         --export-dynamic.
11614
11615 2008-12-16  Cary Coutant  <ccoutant@google.com>
11616
11617         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11618         vector.
11619         (Plugin_manager::claim_file): Create plugin object even if
11620         plugin did not call the add_symbols callback.
11621         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11622         asking for more symbols than were added.
11623         * testsuite/Makefile.am (plugin_test_1): Add test case with
11624         no global symbols.
11625         (empty.syms): New target.
11626         * testsuite/Makefile.in: Regenerate.
11627         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11628         message. Don't call add_symbols if no globals.
11629         (all_symbols_read_hook): Don't provide replacement for empty
11630         claimed file.
11631
11632 2008-12-12  Ian Lance Taylor  <iant@google.com>
11633
11634         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11635         r_type == 0 for a local symbol with r_sym == 0.
11636         (scan_relocatable_relocs): Pass r_sym to
11637         local_non_section_strategy.
11638         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11639         r_sym parameter.
11640
11641         * configure.ac: Update test for TLS descriptors: they are
11642         supported as of glibc 2.9.
11643         * configure: Rebuild.
11644
11645 2008-12-11  Ian Lance Taylor  <iant@google.com>
11646
11647         PR 7091
11648         * target-reloc.h (Default_scan_relocatable_relocs): For each
11649         function, map r_type == 0 to RELOC_DISCARD.
11650
11651 2008-12-10  Cary Coutant  <ccoutant@google.com>
11652
11653         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11654         object to override a kept COMDAT group from a plugin object.
11655
11656 2008-12-09  Ian Lance Taylor  <iant@google.com>
11657
11658         PR 7088
11659         * yyscript.y (file_cmd): Handle INPUT.
11660
11661         * testsuite/initpri1.c: Change all declarations to be full
11662         prototypes by adding void, to avoid compiler warnings.
11663
11664 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11665
11666         * options.cc (General_options::parse_plugin_opt): New.
11667         (General_options::add_plugin): The argument now is just the filename.
11668         (General_options::add_plugin_option): New.
11669         * options.h (plugin_opt): New.
11670         (add_plugin): Change argument name.
11671         (add_plugin_option): New.
11672         * plugin.cc (Plugin::load): Don't parse the plugin option.
11673         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11674         (Plugin::add_option): New.
11675         (Plugin::args_): Change type.
11676         (Plugin::filename_): New.
11677         (Plugin_manager::add_plugin_option): New.
11678         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11679         * testsuite/Makefile.in: Regenerate.
11680
11681 2008-12-05  Cary Coutant  <ccoutant@google.com>
11682
11683         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11684         Handle --strip-lto-sections option.
11685         * options.h (strip_lto_sections): New option.
11686
11687 2008-12-01  Cary Coutant  <ccoutant@google.com>
11688
11689         * plugin.cc (ld_plugin_message): Change format parameter to const.
11690         Fix mismatch between new[] and delete.
11691
11692 2008-11-14  Cary Coutant  <ccoutant@google.com>
11693
11694         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11695         instead of -1U.
11696
11697 2008-11-05  Craig Silverstein  <csilvers@google.com>
11698
11699         * options.cc (General_options::parse_dynamic_list): New function.
11700         * options.h (General_options): New flags dynamic_list,
11701         dynamic_list_data, dynamic_list_cpp_new, and
11702         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11703         (General_options::in_dynamic_list): New function.
11704         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11705         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11706         (Lex::can_continue_name): Likewise.
11707         (yylex): Likewise.
11708         (read_script_file): New parameter script_options.
11709         (read_dynamic_list): New function.
11710         (Script_options::define_dynamic_list): New function.
11711         (dynamic_list_keyword_parsecodes): New variable.
11712         (dynamic_list_keywords): New variable.
11713         * script.h (Script_options::define_dynamic_list): New function
11714         prototype.
11715         (read_dynamic_list): New function prototype.
11716         * symtab.cc (strprefix): New macro.
11717         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11718         dynamic_list_data, dynamic_list_cpp_new, and
11719         dynamic_list_cpp_typeinfo.
11720         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11721         (dynamic_list_expr): New rule.
11722         (dynamic_list_nodes): Likewise.
11723         (dynamic_list_node): Likewise.
11724         * testsuite/Makefile.am (dynamic_list): New test.
11725         * testsuite/Makefile.in: Regenerated.
11726         * testsuite/dynamic_list.t: New file.
11727         * testsuite/dynamic_list.sh: New file.
11728
11729 2008-11-05  Craig Silverstein  <csilvers@google.com>
11730
11731         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11732         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11733         (t11_last): Likewise.
11734         * testsuite/ver_test_6.c (main): Likewise.
11735
11736 2008-10-07  Cary Coutant  <ccoutant@google.com>
11737
11738         * options.c (General_options::finalize): Add check for -static and
11739         -shared.
11740         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11741         is not empty.
11742
11743 2008-10-02  Cary Coutant  <ccoutant@google.com>
11744
11745         * plugin.cc (make_sized_plugin_object): Fix conditional
11746         compilation to work when not all targets are enabled.
11747
11748 2008-09-29  Cary Coutant  <ccoutant@google.com>
11749
11750         * archive.cc (Archive::get_file_and_offset): Use filename instead
11751         of name to get library path.
11752         (Archive::include_member): Unlock external member of a thin archive.
11753
11754         * testsuite/Makefile.am (TEST_AR): New variable.
11755         (thin_archive_test_1): New test.
11756         (thin_archive_test_2): New test.
11757         * testsuite/Makefile.in: Regenerate.
11758         * testsuite/thin_archive_main.cc: New file.
11759         * testsuite/thin_archive_test_1.cc: New file.
11760         * testsuite/thin_archive_test_2.cc: New file.
11761         * testsuite/thin_archive_test_3.cc: New file.
11762         * testsuite/thin_archive_test_4.cc: New file.
11763
11764 2008-09-29  Cary Coutant  <ccoutant@google.com>
11765
11766         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11767         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11768         instead of -1U.
11769         (Sized_relobj::do_finalize_local_symbols): Likewise.
11770         (Sized_relobj::map_to_kept_section): Likewise.
11771         * object.h (Sized_relobj::invalid_address): New constant.
11772         (Sized_relobj::do_output_section_offset): Check for invalid_address
11773         and return -1ULL.
11774         * output.cc (Output_reloc::local_section_offset): Use constant
11775         invalid_address instead of -1U.
11776         (Output_reloc::get_address): Likewise.
11777         (Output_section::output_address): Change -1U to -1ULL.
11778         * output.h (Output_reloc::invalid_address): New constant.
11779         * reloc.cc (Sized_relobj::write_sections): Use constant
11780         invalid_address instead of -1U.
11781         (Sized_relobj::relocate_sections): Likewise.
11782         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11783         values for merge sections.
11784         * target-reloc.h (relocate_for_relocatable): Use constant
11785         invalid_address instead of -1U.
11786
11787 2008-09-19  Cary Coutant  <ccoutant@google.com>
11788
11789         Add plugin functionality for link-time optimization (LTO).
11790         * configure.ac (plugins): Add --enable-plugins option.
11791         * configure: Regenerate.
11792         * config.in: Regenerate.
11793         * Makefile.am (LIBDL): New variable.
11794         (CCFILES): Add plugin.cc.
11795         (HFILES): Add plugin.h.
11796         (ldadd_var): Add LIBDL.
11797         * Makefile.in: Regenerate.
11798
11799         * archive.cc: Include "plugin.h".
11800         (Archive::setup): Don't preread archive symbols when using a plugin.
11801         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11802         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11803         files.
11804         (Archive::include_member): Add symbols from plugin objects.
11805         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11806         * descriptors.cc (Descriptors::open): Check for file descriptors
11807         abandoned by plugins.
11808         (Descriptors::claim_for_plugin): New function.
11809         * descriptors.h (Descriptors::claim_for_plugin): New function.
11810         (Open_descriptor::is_claimed): New field.
11811         (claim_descriptor_for_plugin): New function.
11812         * fileread.cc (File_read::claim_for_plugin): New function.
11813         * fileread.h (File_read::claim_for_plugin): New function.
11814         (File_read::descriptor): New function.
11815         * gold.cc: Include "plugin.h".
11816         (queue_initial_tasks): Add task to call plugin hooks for generating
11817         new object files.
11818         * main.cc: Include "plugin.h".
11819         (main): Load plugin libraries.
11820         * object.h (Pluginobj): Declare.
11821         (Object::pluginobj): New function.
11822         (Object::do_pluginobj): New function.
11823         (Object::set_target): New function.
11824         * options.cc: Include "plugin.h".
11825         (General_options::parse_plugin): New function.
11826         (General_options::General_options): Initialize plugins_ field.
11827         (General_options::add_plugin): New function.
11828         * options.h (Plugin_manager): Declare.
11829         (General_options): Add --plugin option.
11830         (General_options::has_plugins): New function.
11831         (General_options::plugins): New function.
11832         (General_options::add_plugin): New function.
11833         (General_options::plugins_): New field.
11834         * plugin.cc: New file.
11835         * plugin.h: New file.
11836         * readsyms.cc: Include "plugin.h".
11837         (Read_symbols::do_read_symbols): Check for archive before checking
11838         for ELF file.  Call plugin hooks to claim files.
11839         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11840         from a real object file; force override when processing replacement
11841         files.
11842         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11843         (Symbol::init_base_object): Likewise.
11844         (Symbol::init_base_output_data): Likewise.
11845         (Symbol::init_base_output_segment): Likewise.
11846         (Symbol::init_base_constant): Likewise.
11847         (Symbol::init_base_undefined): Likewise.
11848         (Symbol::output_section): Assert that object is not a plugin.
11849         (Symbol_table::add_from_pluginobj): New function.
11850         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11851         undefined.
11852         (Symbol_table::sized_write_globals): Likewise.
11853         (Symbol_table::add_from_pluginobj): Instantiate template.
11854         * symtab.h (Sized_pluginobj): Declare.
11855         (Symbol::in_real_elf): New function.
11856         (Symbol::set_in_real_elf): New function.
11857         (Symbol::in_real_elf_): New field.
11858         (Symbol_table::add_from_pluginobj): New function.
11859
11860         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11861         (LIBDL): New variable.
11862         (LDADD): Add LIBDL.
11863         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11864         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11865         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11866         (MOSTLYCLEANFILES): Likewise.
11867         * testsuite/Makefile.in: Regenerate.
11868         * testsuite/plugin_test.c: New file.
11869         * testsuite/plugin_test_1.sh: New file.
11870         * testsuite/plugin_test_2.sh: New file.
11871
11872 2008-09-16  Ian Lance Taylor  <iant@google.com>
11873
11874         * target-reloc.h (relocate_section): Check whether a symbol is
11875         defined by the ABI before reporting an undefined symbol error.
11876         * target.h (Target::is_defined_by_abi): Make parameter const.
11877         (Target::do_is_defined_by_abi): Likewise.
11878         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11879         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11880         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11881         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11882         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11883         * testsuite/Makefile.in: Rebuild.
11884
11885         * fileread.cc (make_view): Add casts to avoid warning.
11886
11887 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11888
11889         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11890         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11891
11892 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11893
11894         * options.h (General_options::output_is_executable): New.
11895         (General_options::output_is_pie): New.
11896         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11897         for shared libraries.
11898         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11899
11900 2008-09-11  Chris Demetriou  <cgd@google.com>
11901
11902         * options.h (origin): New -z option.
11903         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11904         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11905         in DT_FLAGS_1.
11906
11907 2008-09-05  Cary Coutant  <ccoutant@google.com>
11908
11909         * fileread.cc (File_read::make_view): Add check for attempt to map
11910         beyond end of file.
11911
11912 2008-09-05  Cary Coutant  <ccoutant@google.com>
11913
11914         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11915         explicit instantiations.
11916
11917 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11918
11919         PR gold/6858
11920         * options.cc (General_options::finalize): Allow undefined symbols
11921         in shlibs if linking -shared.
11922
11923         PR gold/6859
11924         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11925         symbols as not needing a dynsym entry.
11926
11927 2008-08-20  Craig Silverstein  <csilvers@google.com>
11928
11929         * fileread.cc (File_read::open): Do not lock the file unless it
11930         was successfully opened.
11931
11932 2008-08-14  Cary Coutant  <ccoutant@google.com>
11933
11934         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11935         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11936         * testsuite/tls_test.cc (struct int128): 128-bit struct
11937         for testing TLS relocs with non-zero addend.
11938         (v12): New TLS variable.
11939         (t12): New test.
11940         (t_last): Add check for v12.
11941         * testsuite/tls_test.h (t12): New function.
11942         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11943
11944 2008-08-13  Ian Lance Taylor  <iant@google.com>
11945
11946         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11947         set tls_segment_ or relro_segment_.
11948         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11949         when appropriate.
11950         * output.h (Output_section::clear_is_relro): New function.
11951         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11952         sections specially even when output_data_ is empty.
11953         (Output_segment::maximum_alignment): When first section is relro,
11954         only force alignment for PT_LOAD segments.
11955         * script.cc (script_data_segment_align): New function.
11956         (script_data_segment_relro_end): New function.
11957         * script-c.h (script_data_segment_align): Declare.
11958         (script_data_segment_relro_end): Declare.
11959         * script-sections.h (class Script_sections): Declare
11960         data_segment_align and data_segment_relro_end.  Add fields
11961         segment_align_index_ and saw_relro_end_.
11962         * script-sections.cc (class Sections_element): Add set_is_relro
11963         virtual function.  Add new bool* parameter to place_orphan_here.
11964         Add get_output_section virtual function.
11965         (class Output_section_definition): Add set_is_relro.  Add new
11966         bool* parameter to place_orphan_here.  Add get_output_section.
11967         Add is_relro_ field.
11968         (Output_section_definition::Output_section_definition): Initialize
11969         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11970         and is_relro_ fields.
11971         (Output_section_definition::place_orphan_here): Add is_relro
11972         parameter.
11973         (Output_section_definition::set_section_addresses): Set relro for
11974         output section.
11975         (Output_section_definition::alternate_constraint): Likewise.
11976         (class Orphan_output_section): Add new bool* parameter to
11977         place_orphan_here.  Add get_output_section.
11978         (Orphan_output_section::place_orphan_here): Add is_relro
11979         parameter.
11980         (Script_sections::Script_sections): Initialize
11981         data_segment_align_index_ and saw_relro_end_.
11982         (Script_sections::data_segment_align): New function.
11983         (Script_sections::data_segment_relro_end): New function.
11984         (Script_sections::place_orphan): Set or clear is_relro.
11985         (Script_sections::set_section_addresses): Force alignment of first
11986         TLS section.
11987         * yyscript.y (exp): Call script_data_segment_align and
11988         script_data_segment_relro_end.
11989         * testsuite/relro_script_test.t: New file.
11990         * testsuite/relro_test.cc (using_script): Declare.
11991         (t1, t2): Test using_script.
11992         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11993         (relro_script_test_SOURCES): Define.
11994         (relro_script_test_DEPENDENCIES): Define.
11995         (relro_script_test_LDFLAGS): Define.
11996         (relro_script_test_LDADD): Define.
11997         (relro_script_test.so): New target.
11998         * testsuite/Makefile.in: Rebuild.
11999
12000 2008-08-06  Cary Coutant <ccoutant@google.com>
12001
12002         * archive.cc (Archive::total_archives, Archive::total_members)
12003         (Archive::total_members_loaded): New variables.
12004         (Archive::setup): Add parameter.  Add option to preread
12005         archive symbols.
12006         (Archive::read_armap): Add counter.
12007         (Archive::get_file_and_offset): New function.
12008         (Archive::get_elf_object_for_member): New function.
12009         (Archive::read_all_symbols): New function.
12010         (Archive::read_symbols): New function.
12011         (Archive::add_symbols): Add counters.
12012         (Archive::include_all_members): Use armap to find members if it's
12013         already built.
12014         (Archive::include_member): Skip reading symbols if already read.
12015         Factored code into Archive::get_file_and_offset and
12016         Archive::get_elf_object_for_member.  Changed call to
12017         Mapfile::report_include_archive_member.
12018         (Archive::print_stats): New function.
12019         * archive.h: Declare Object and Read_symbols_data classes.
12020         (Archive::Archive): Add initializers for new members.
12021         (Archive::setup): Add parameter.
12022         (Archive::print_stats): New function.
12023         (Archive::total_archives, Archive::total_members)
12024         (Archive::total_members_loaded): New variables.
12025         (Archive::get_file_and_offset): New function.
12026         (Archive::get_elf_object_for_member): New function.
12027         (Archive::read_all_symbols): New function.
12028         (Archive::read_symbols): New function.
12029         (Archive::Archive_member): New class.
12030         (Archive::members_): New member.
12031         (Archive::num_members_): New member.
12032         * main.cc: Include archive.h.
12033         (main): Call Archive::print_stats.
12034         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12035         archive parameter; member_name is now the fully-decorated name.
12036         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12037         * options.h: (General_options): Add --preread-archive-symbols option.
12038         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12039         Archive::setup.
12040
12041 2008-08-04  Ian Lance Taylor  <iant@google.com>
12042
12043         * symtab.h (Symbol::use_plt_offset): New function.
12044         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12045         * powerpc.cc (Relocate::relocate): Likewise.
12046         * sparc.cc (Relocate::relocate): Likewise.
12047         * x86_64.cc (Relocate::relocate): Likewise.
12048         * testsuite/weak_plt.sh: New test.
12049         * testsuite/weak_plt_main.cc: New test.
12050         * testsuite/weak_plt_shared.cc: New test.
12051         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12052         (check_PROGRAMS): Add weak_plt.
12053         (check_DATA): Add weak_plt_shared.so.
12054         (weak_plt_main_pic.o, weak_plt): New targets.
12055         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12056         * testsuite/Makefile.in: Rebuild.
12057
12058         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12059         gcctestdir/ld.
12060         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12061         * testsuite/Makefile.in: Rebuild.
12062
12063 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12064
12065         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12066         * Makefile.in: Regenerate.
12067         * po/POTFILES.in: Regenerate.
12068
12069 2008-07-29  Ian Lance Taylor  <iant@google.com>
12070
12071         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12072         symbols before other symbols.
12073         * testsuite/script_test_2.cc (test_addr): Declare.
12074         (test_addr_alias): Declare.
12075         (main): Check that test_addr and test_addr_alias have the right
12076         values.
12077         * testsuite/script_test_2.t: Define test_addr_alias and
12078         test_addr.
12079
12080 2008-07-24  Ian Lance Taylor  <iant@google.com>
12081
12082         PR 5990
12083         * descriptors.cc: New file.
12084         * descriptors.h: New file.
12085         * gold-threads.h (class Hold_optional_lock): New class.
12086         * fileread.cc: Include "descriptors.h".
12087         (File_read::~File_read): Release descriptor rather than closing
12088         it.
12089         (File_read::open) [file]: Call open_descriptor rather than open.
12090         Set is_descriptor_opened_.
12091         (File_read::open) [memory]: Assert that descriptor is not open.
12092         (File_read::reopen_descriptor): New function.
12093         (File_read::release): Release descriptor.
12094         (File_read::do_read): Make non-const.  Reopen descriptor.
12095         (File_read::read): Make non-const.
12096         (File_read::make_view): Reopen descriptor.
12097         (File_read::do_readv): Likewise.
12098         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12099         Update declarations.
12100         * layout.cc: Include "descriptors.h".
12101         (Layout::create_build_id): Use open_descriptor rather than open.
12102         * output.cc: Include "descriptors.h".
12103         (Output_file::open): Use open_descriptor rather than open.
12104         * archive.cc (Archive::const_iterator): Change Archive to be
12105         non-const.
12106         (Archive::begin, Archive::end): Make non-const.
12107         (Archive::count_members): Likewise.
12108         * archive.h (class Archive): Update declarations.
12109         * object.h (Object::read): Make non-const.
12110         * Makefile.am (CCFILES): Add descriptors.cc.
12111         (HFILES): Add descriptors.h.
12112         * Makefile.in: Rebuild.
12113
12114         PR 6716
12115         * gold.h: Always include <clocale>.  Add Solaris workarounds
12116         following code in binutils/sysdep.h.
12117
12118         PR 6048
12119         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12120         this->eh_frame_hdr_ is NULL before using it.
12121
12122         * dynobj.cc (Versions::Versions): Update comment.
12123
12124         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12125         the base version name.
12126
12127         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12128         array size plus one.
12129         (Stringpool_template::set_string_offsets): Subtract one from key
12130         before using it as an array index.
12131         (Stringpool_template::get_offset_with_length): Likewise.
12132         (Stringpool_template::write_to_buffer): Likewise.
12133         * stringpool.h (Stringpool_template::get_offset_from_key):
12134         Likewise.
12135
12136 2008-07-23  Ian Lance Taylor  <iant@google.com>
12137
12138         PR 6658
12139         * object.h (Merged_symbol_value::value): Do our best to handle a
12140         negative addend.
12141
12142         PR 6647
12143         * script.cc (Version_script_info::get_versions): Don't add empty
12144         version tag to return value.
12145         (Version_script_info::get_symbol_version_helper): Change return
12146         type to bool.  Add pversion parameter.  Change all callers.
12147         (script_register_vers_node): Don't require a non-NULL tag.
12148         * script.h (class Version_script_info): Update declarations.
12149         (Version_script_info::get_symbol_version): Change return type to
12150         bool.  Add version parameter.  Change all callers.
12151         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12152         handling.  Handle an empty version from a version script.
12153         (Symbol_table::define_special_symbol): Likewise.
12154         * testsuite/ver_test_10.script: New file.
12155         * testsuite/ver_test_10.sh: New file.
12156         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12157         (check_DATA): Add ver_test_10.syms.
12158         (ver_test_10.syms, ver_test_10.so): New target.
12159         * testsuite/Makefile.in: Rebuild.
12160
12161 2008-07-23  Simon Baldwin  <simonb@google.com>
12162
12163         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12164         to zero for undefined symbols from dynamic libraries.
12165
12166 2008-07-23  Ian Lance Taylor  <iant@google.com>
12167
12168         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12169         Change all callers.
12170         * symtab.h (class Symbol_table): Update declaration.
12171         * testsuite/ver_test_9.cc: New file.
12172         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12173         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12174         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12175         (ver_test_9.so, ver_test_9.o): New targets.
12176         * testsuite/Makefile.in: Rebuild.
12177
12178 2008-07-22  Ian Lance Taylor  <iant@google.com>
12179
12180         * options.h (class General_options): Define --check-sections.
12181         * layout.cc (Layout::set_segment_offsets): Handle
12182         --check-sections.
12183
12184         * options.h (class General_options): Define -n/--nmagic and
12185         -N/--omagic.
12186         * options.cc (General_options::finalize): For -n/--nmagic or
12187         -N/--omagic, set -static.
12188         * layout.cc (Layout::attach_allocated_section_to_segment): If
12189         -N/--omagic, don't put read-only and read-write sections in
12190         different segments.
12191         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12192         finding a read-only segment.
12193         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12194         don't set the minimum segment alignment to the common page size,
12195         and don't set the file offset to the address modulo the page size.
12196         * script-sections.cc (Script_sections::create_segments): If
12197         -n/--omagic, don't put read-only and read-write sections in
12198         different segments.
12199
12200         * cref.cc: New file.
12201         * cref.h: New file.
12202         * options.h (class General_options): Add --print-symbol-counts.
12203         * main.cc (main): Issue defined symbol report if requested.
12204         * archive.cc (Archive::interpret_header): Make into a const member
12205         function.
12206         (Archive::add_symbols): Call Input_objects::archive_start and
12207         archive_stop.
12208         (Archive::const_iterator): Define new class.
12209         (Archive::begin, Archive::end): New functions.
12210         (Archive::include_all_members): Rewrite to use iterator.
12211         (Archive::count_members): New function.
12212         * archive.h (class Archive): Update declarations.
12213         (Archive::filename): New function.
12214         * object.cc: Include "cref.h".
12215         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12216         (Sized_relobj::do_get_global_symbol_counts): New function.
12217         (Input_objects::add_object): Add object to cross-referencer.
12218         (Input_objects::archive_start): New function.
12219         (Input_objects::archive_stop): New function.
12220         (Input_objects::print_symbol_counts): New function.
12221         * object.h: Declare Cref and Archive.
12222         (Object::get_global_symbol_counts): New function.
12223         (Object::do_get_global_symbol_counts): New pure virtual function.
12224         (class Sized_relobj): Add defined_count_ field.  Update
12225         declarations.
12226         (class Input_objects): Add cref_ field.  Update constructor.
12227         Update declarations.
12228         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12229         defined_count_.
12230         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12231         symbol counts.
12232         (Sized_dynobj::do_get_global_symbol_counts): New function.
12233         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12234         defined_count_.  Update declarations.  Define Symbols typedef.
12235         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12236         parameter.  Change all callers.
12237         (Symbol_table::add_from_dynobj): Add sympointers and defined
12238         parameters.  Change all callers.
12239         * symtab.h (class Symbol_table): Update declarations.
12240         * Makefile.am (CCFILES): Add cref.cc.
12241         (HFILES): Add cref.h.
12242         * Makefile.in: Rebuild.
12243
12244 2008-07-22  Simon Baldwin  <simonb@google.com>
12245
12246         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12247         to zero when writing undefined symbols.
12248
12249 2008-07-22  Ian Lance Taylor  <iant@google.com>
12250
12251         * output.cc (Output_section::add_input_section): Don't try to
12252         merge empty merge sections.
12253
12254 2008-07-21  Craig Silverstein  <csilvers@google.com>
12255
12256         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12257         Include symbol version in error message.
12258
12259 2008-07-20  Chris Demetriou  <cgd@google.com>
12260
12261         * configure.ac (gold_cv_c_random_seed): New configured variable.
12262         (RANDOM_SEED_CFLAGS): New substituted variable.
12263         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12264         * configure: Rebuild.
12265         * Makefile.in: Likewise.
12266         * testsuite/Makefile.in: Likewise.
12267
12268 2008-07-18  Ian Lance Taylor  <iant@google.com>
12269
12270         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12271         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12272         * testsuite/ver_test_main.cc (main): Call t4.
12273         (t4, t4_2a): Define.
12274         * testsuite/ver_test_2.cc (t4_2): Define.
12275         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12276         * testsuite/ver_test_4.cc (t4_2a): Define.
12277         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12278         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12279
12280 2008-07-17  Ian Lance Taylor  <iant@google.com>
12281
12282         * dynobj.cc (Versions::add_def): If we give an error about a
12283         missing version, go ahead and create the version anyhow.
12284
12285 2008-07-10  Ian Lance Taylor  <iant@google.com>
12286
12287         Handle output sections with more than 0x7fffffff bytes.
12288         * object.h (class Relobj): Change map_to_output_ to
12289         output_sections_, and just keep a section pointer.  Change all
12290         uses.  Move comdat group support to Sized_relobj.
12291         (Relobj::is_section_specially_mapped): Remove.
12292         (Relobj::output_section): Remove poff parameter.  Change all
12293         callers.
12294         (Relobj::output_section_offset): New function.
12295         (Relobj::set_section_offset): Rewrite.
12296         (Relobj::map_to_output): Remove.
12297         (Relobj::output_sections): New function.
12298         (Relobj::do_output_section_offset): New pure virtual function.
12299         (Relobj::do_set_section_offset): Likewise.
12300         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12301         group support from Relobj.  Update declarations.
12302         (Sized_relobj::get_output_section_offset): New function.
12303         (Sized_relobj::do_output_section_offset): New function.
12304         (Sized_relobj::do_set_section_offset): New function.
12305         * object.cc (Relobj::output_section_address): Remove.
12306         (Sized_relobj::Sized_relobj): Initialize new fields.
12307         (Sized_relobj::include_section_group): Cast find_kept_object to
12308         Sized_relobj.
12309         (Sized_relobj::include_linkonce_section): Likewise.
12310         (Sized_relobj::do_layout): Use separate arrays for output section
12311         and output offset.
12312         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12313         output_sections.
12314         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12315         output_sections and section_offsets.
12316         (Sized_relobj::write_local_symbols): Likewise.
12317         (map_to_kept_section): Compute output address directly.
12318         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12319         output_sections and section_offsets.
12320         (Sized_relobj::write_sections): Likewise.
12321         (Sized_relobj::relocate_sections): Likewise.
12322         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12323         * output.h (class Output_reloc): Update declarations.  Change
12324         u2_.relobj to Sized_relobj*.
12325         (class Output_data_reloc): Change add functions to use
12326         Sized_relobj*.
12327         * output.cc (Output_reloc::Output_reloc): Change relobj to
12328         Sized_relobj*.
12329         (Output_reloc::local_section_offset): Change return type to
12330         Elf_Addr.  Use get_output_section_offset.
12331         (Output_reloc::get_address): Likewise.
12332         (Output_section::is_input_address_mapped): Don't call
12333         is_section_specially_mapped.
12334         (Output_section::output_offset): Likewise.
12335         (Output_section::output_address): Likewise.
12336         (Output_section::starting_output_address): Likewise.
12337         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12338         parameter to Sized_relobj*.
12339         (Copy_relocs::need_copy_reloc): Likewise.
12340         (Copy_relocs::save): Likewise.
12341         * copy-relocs.h (class Copy_relocs): Update declarations.
12342         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12343         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12344         * target-reloc.h (relocate_for_relocatable): Change
12345         offset_in_output_section type to Elf_Addr.  Change code that uses
12346         it as well.
12347         * layout.cc (Layout::layout): Always set *off.
12348         * mapfile.cc (Mapfile::print_input_section): Use
12349         output_section_offset.
12350         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12351         Sized_relobj*.
12352         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12353         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12354         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12355
12356 2008-07-03  Ian Lance Taylor  <iant@google.com>
12357
12358         * layout.cc (Layout::include_section): Do not discard unrecognized
12359         SHT_STRTAB sections.
12360
12361 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12362
12363         * script.cc (Lex::can_continue_name): Make '?' allowable in
12364         version-script names.
12365         * testsuite/version_script.map: Change glob pattern to use '?'
12366
12367 2008-06-30  Manish Singh  <yosh@gimp.org>
12368
12369         PR 6585
12370         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12371         Correct typo.
12372
12373 2008-06-30  Ian Lance Taylor  <iant@google.com>
12374
12375         PR 6660
12376         PR 6682
12377         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12378         versions]: Don't try to read the value in the contents, since we
12379         don't use it.  Use the template endianness when writing.
12380
12381 2008-06-25  Cary Coutant  <ccoutant@google.com>
12382
12383         * fileread.cc (File_read::make_view): Assert on zero-length view.
12384         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12385         symbol table when there are no symbols to read.
12386
12387 2008-06-23  Craig Silverstein  <csilvers@google.com>
12388
12389         * version.cc (version_string): Bump to 1.7
12390
12391 2008-06-18  Craig Silverstein  <csilvers@google.com>
12392
12393         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12394         constant 0xFFFF to type Valtype.
12395         (Powerpc_relocate_functions::rel16_ha): Likewise.
12396
12397 2008-06-17  Ian Lance Taylor  <iant@google.com>
12398
12399         * output.h (Output_section::Input_section): Initialize p2align_ to
12400         zero for Output_section_data constructors.
12401         (Output_section::Input_section::addralign): If not an input
12402         section, return the alignment of the Output_section_data.
12403         * testsuite/copy_test.cc: New file.
12404         * testsuite/copy_test_1.cc: New file.
12405         * testsuite/copy_test_2.cc: New file.
12406         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12407         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12408         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12409         (copy_test_1_pic.o, copy_test_1.so): New targets.
12410         (copy_test_2_pic.o, copy_test_2.so): New targets.
12411         * testsuite/Makefile.in: Rebuild.
12412
12413         * script-sections.cc (Script_sections::place_orphan): Initialize
12414         local variable exact.
12415
12416 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12417
12418         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12419
12420 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12421             David S. Miller  <davem@davemloft.net>
12422
12423         * powerpc.cc: New file.
12424         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12425         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12426         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12427         * Makefile.in: Rebuild.
12428
12429 2008-06-09  Ian Lance Taylor  <iant@google.com>
12430
12431         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12432         <exception>.
12433         (throwing, orig_terminate): New static variables.
12434         (terminate_handler): New static function.
12435         (t2): Set terminate handler.
12436
12437 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12438
12439         PR 6584
12440         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12441         alignment.
12442
12443 2008-05-30  Cary Coutant  <ccoutant@google.com>
12444
12445         * archive.cc (Archive::include_all_members) Correct to step
12446         over symbol table and extended name table in thin archives.
12447
12448 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12449
12450         PR 6407
12451         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12452         calculation.
12453
12454 2008-05-28  Caleb Howe  <cshowe@google.com>
12455
12456         * reduced_debug_output.cc: New file.
12457         * reduced_debug_output.h: New file.
12458         * options.h (class General_options): Add --strip-debug-non-line.
12459         * options.cc (General_options::finalize): Add strip_debug_non_line
12460         to the strip heirarchy.
12461         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12462         fields.
12463         * layout.cc: Include "reduced_debug_output.h".
12464         (Layout::Layout): Initialize new fields.
12465         (line_only_debug_sections): New static array.
12466         (is_lines_only_debug_sections): New static inline function.
12467         (Layout::include_section): Handle --strip-debug-non-line.
12468         (Layout::make_output_section): If --strip-debug-non-line, build
12469         new output sections for .debug_abbrev and .debug_info.
12470         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12471         gold.  Warn about possible overflow.
12472         (read_signed_LEB_128): Likewise.
12473         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12474         (read_signed_LEB_128): Declare.
12475         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12476         (HFILES): Add reduced_debug_output.h.
12477         * Makefile.in: Rebuild.
12478
12479 2008-05-21  Ian Lance Taylor  <iant@google.com>
12480
12481         * mapfile.cc: New file.
12482         * mapfile.h: New file.
12483         * options.h (class General_options): Add -M/--print-map and -Map.
12484         * options.cc (General_options::finalize): Make -M equivalent to
12485         -Map -.
12486         * main.cc: Include <cstdio> and "mapfile.h".
12487         (main): Open mapfile if requested.
12488         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12489         constructor.  Change caller.
12490         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12491         (queue_middle_tasks): Likewise.
12492         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12493         declarations.
12494         * archive.cc: Include "mapfile.h".
12495         (Archive::add_symbols): Add mapfile parameter.  Change all
12496         callers.  Pass mapfile, symbol, and reason to include_member.
12497         (Archive::include_all_members): Add mapfile parameter.  Change all
12498         callers.
12499         (Archive::include_member): Add mapfile, sym, and why parameters.
12500         Change all callers.  Report inclusion to map file.
12501         * archive.h: Include "fileread.h".
12502         (class Archive): Update declarations.
12503         (Archive::file): New const method.
12504         (class Add_archive_symbols): Add mapfile_ field.  Update
12505         constructor.  Change all callers.
12506         * readsyms.h (class Read_symbols): Likewise.
12507         (class Finish_group): Likewise.
12508         (class Read_script): Likewise.
12509         * common.cc: Include "mapfile.h".
12510         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12511         all callers.
12512         (Symbol_table::do_allocate_commons): Likewise.
12513         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12514         symbol allocation to mapfile.
12515         * common.h (class Allocate_commons_task): Add mapfile_ field.
12516         Update constructor.  Change all callers.
12517         * symtab.h (class Symbol_table): Update declarations.
12518         * layout.cc: Include "mapfile.h".
12519         (Layout_task_runner::run): Print information to mapfile.
12520         (Layout::create_gold_note): Change Output_data_fixed_space to
12521         Output_data_zero_fill.
12522         (Layout::create_build_id): Likewise.
12523         (Layout::print_to_mapfile): New function.
12524         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12525         constructor.  Change caller.
12526         (class Layout): Declare print_to_mapfile.
12527         * output.cc (Output_section::Input_section::print_to_mapfile): New
12528         function.
12529         (Output_section::add_input_section): If producing a map, always
12530         add to input_sections_ list.
12531         (Output_section::do_print_to_mapfile): New function.
12532         (Output_segment::print_sections_to_mapfile): New function.
12533         (Output_segment::print_section_list_to_mapfile): New function.
12534         * output.h: Include "mapfile.h".
12535         (Output_data::print_to_mapfile): New function.
12536         (Output_data::do_print_to_mapfile): New virtual function.
12537         (Output_segment_headers::do_print_to_mapfile): New function.
12538         (Output_file_header::do_print_to_mapfile): New function.
12539         (Output_data_const::do_print_to_mapfile): New function.
12540         (class Output_data_const_buffer): Add map_name_ field.  Update
12541         constructor.  Change all callers.  Add do_print_to_mapfile
12542         function.
12543         (class Output_data_fixed_space): Likewise.
12544         (class Output_data_space): Likewise.
12545         (class Output_data_zero_fill): New class.
12546         (Output_data_strtab::do_print_to_mapfile): New function.
12547         (Output_data_reloc_base::do_print_to_mapfile): New function.
12548         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12549         (Output_data_group::do_print_to_mapfile): New function.
12550         (Output_data_got::do_print_to_mapfile): New function.
12551         (Output_data_dynamic::do_print_to_mapfile): New function.
12552         (Output_symtab_xindex::do_print_to_mapfile): New function.
12553         (class Output_section): Declare do_print_to_mapflie.  Declare
12554         print_to_mapfile in Input_section.
12555         (class Output_segment): Declare new functions.
12556         * object.h (Sized_relobj::symbol_count): New function.
12557         * script-sections.cc
12558         (Output_section_element_dot_assignment::set_section_addresses):
12559         Change Output_data_fixed_space to Output_data_zero_fill.
12560         (Output_data_expression::do_print_to_mapfile): New function.
12561         * script.cc (read_input_script): Add mapfile parameter.  Change
12562         all callers.
12563         * script.h (read_input_script): Update declaration.
12564         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12565         (Eh_frame::do_print_to_mapfile): New function.
12566         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12567         (Output_merge_string::do_print_to_mapfile): New function.
12568         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12569         function.
12570         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12571         function.
12572         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12573         function.
12574         * Makefile.am (CCFILES): Add mapfile.cc.
12575         (HFILES): Add mapfile.h.
12576         * Makefile.in: Rebuild.
12577
12578 2008-05-19  Ian Lance Taylor  <iant@google.com>
12579
12580         * options.h (class General_options): Add -z relro.
12581         * layout.cc (Layout::Layout): Initialize relro_segment_.
12582         (Layout::add_output_section_data): Return the output section.
12583         (Layout::make_output_section): Rcognize relro sections and mark
12584         them appropriately.
12585         (Layout::attach_allocated_section_to_segment): Put relro sections
12586         in a PT_GNU_RELRO segment.
12587         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12588         section as relro.
12589         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12590         PT_TLS segments.
12591         (Layout::linkonce_mapping): Map d.rel.ro.local to
12592         .data.rel.ro.local.
12593         (Layout::output_section_name): Us .data.rel.ro.local for any
12594         section which begins with that.
12595         * layout.h (class Layout): Update add_output_section_data
12596         declaration.  Add relro_segment_ field.
12597         * output.cc (Output_section::Output_section): Initialize is_relro_
12598         and is_relro_local_ fields.
12599         (Output_segment::add_output_section): Group relro sections.
12600         (Output_segment::is_first_section_relro): New function.
12601         (Output_segment::maximum_alignment): If there is a relro section,
12602         align the segment to the common page size.
12603         (Output_segment::set_section_addresses): Track whether we are
12604         looking at relro sections.  If the last section is a relro
12605         section, align to the common page size.
12606         (Output_segment::set_section_list_addresses): Add in_relro
12607         parameter.  Change all callers.  Align to the page size when
12608         moving from relro to non-relro section.
12609         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12610         segment.
12611         * output.h (class Output_section): Add is_relro_ and
12612         is_relro_local_ fields.
12613         (Output_section::is_relro): New function.
12614         (Output_section::set_is_relro): New function.
12615         (Output_section::is_relro_local): New function.
12616         (Output_section::set_is_relro_local): New function.
12617         (class Output_segment): Update declarations.
12618         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12619         * sparc.cc (Target_sparc::got_section): Likewise.
12620         * x86_64.cc (Target_x86_64::got_section): Likewise.
12621         * testsuite/relro_test_main.cc: New file.
12622         * testsuite/relro_test.cc: New file.
12623         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12624         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12625         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12626         (relro_test.so, relro_test_pic.o): New targets.
12627         * testsuite/Makefile.in: Rebuild.
12628
12629 2008-05-16  Ian Lance Taylor  <iant@google.com>
12630
12631         * output.cc (Output_segment::add_output_section): Remove front
12632         parameter.
12633         * output.h (class Output_segment): Remove
12634         add_initial_output_section and overloaded add_output_section.
12635         Update declaration of remaining add_output_section.
12636         * layout.cc (Layout::create_interp): Call add_output_section
12637         rather than add_initial_output_section.
12638         (Layout::finish_dynamic_section): Likewise.
12639
12640         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12641         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12642         know the dynamic type.
12643         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12644         field.  Initialize it in constructor.
12645         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12646         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12647         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12648         reloc.
12649
12650         * output.cc (Output_reloc::get_address): Change return type to
12651         Elf_Addr.
12652         * output.h (class Output_reloc): Update get_address declaration.
12653         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12654         for section addresses.
12655
12656 2008-05-09  Ian Lance Taylor  <iant@google.com>
12657
12658         PR 6493
12659         * gold.cc (gold_nomem): Use return value of write.
12660
12661 2008-05-08  Ian Lance Taylor  <iant@google.com>
12662
12663         * symtab.c (Symbol::init_base_output_data): Add version
12664         parameter.  Change all callers.
12665         (Symbol::init_base_output_segment): Likewise.
12666         (Symbol::init_base_constant): Likewise.
12667         (Symbol::init_base_undefined): Likewise.
12668         (Sized_symbol::init_output_data): Likewise.
12669         (Sized_symbol::init_output_segment): Likewise.
12670         (Sized_symbol::init_constant): Likewise.
12671         (Sized_symbol::init_undefined): Likewise.
12672         (Symbol_table::do_define_in_output_data): If the new symbol has a
12673         version, mark it as the default.
12674         (Symbol_table::do_define_in_output_segment): Likewise.
12675         (Symbol_table::do_define_as_constant): Likewise.
12676         * symtab.h (class Symbol): Update declarations.
12677         (class Sized_symbol): Likewise.
12678         * resolve.cc (Symbol::override_version): New function.
12679         (Symbol::override_base): Call override_version.
12680         (Symbol::override_base_with_special): Likewise.
12681         * testsuite/ver_script_8.script: New file.
12682         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12683         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12684         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12685         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12686
12687 2008-05-06  Ian Lance Taylor  <iant@google.com>
12688
12689         PR 6049
12690         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12691         functions.
12692         (class General_options): Remove existing --undefined, and add
12693         --no-undefined instead.  Add new --undefined as synonym for -u.
12694         * archive.cc (Archive::add_symbols): Check whether symbol was
12695         named with -u.
12696         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12697         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12698         all uses.  Add IS_UNDEFINED.  Update declarations to split
12699         different versions of init_base.  Declare init_base_undefined.
12700         (Symbol::is_defined): Handle IS_UNDEFINED.
12701         (Symbol::is_undefined): Likewise.
12702         (Symbol::is_weak_undefined): Call is_undefined.
12703         (Symbol::is_absolute): Handle IS_CONSTANT.
12704         (class Sized_symbol): Update declarations to split different
12705         versions of init.  Declare init_undefined.
12706         (class Symbol_table): Declare new functions.
12707         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12708         Change all callers.
12709         (Symbol::init_base_output_data): Likewise.
12710         (Symbol::init_base_output_segment): Likewise.
12711         (Symbol::init_base_constant): Likewise.
12712         (Symbol::init_base_undefined): New function.
12713         (Sized_symbol::init_object): Rename from init.  Change all
12714         callers.
12715         (Sized_symbol::init_output_data): Likewise.
12716         (Sized_symbol::init_output_segment): Likewise.
12717         (Sized_symbol::init_constant): Likewise.
12718         (Sized_symbol::init_undefined): New function.
12719         (Symbol_table::add_undefined_symbols_from_command_line): New
12720         function.
12721         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12722         function.
12723         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12724         (Symbol::output_section): Likewise.
12725         (Symbol::set_output_section): Likewise.
12726         (Symbol_table::sized_finalize_symbol): Likewise.
12727         (Symbol_table::sized_write_globals): Likewise.
12728         * resolve.cc (Symbol_table::should_override): Likewise.
12729         (Symbol::override_base_with_special): Likewise.
12730
12731         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12732         symbol, change it to have default visibility.
12733         * testsuite/protected_1.cc: New file.
12734         * testsuite/protected_2.cc: New file.
12735         * testsuite/protected_3.cc: New file.
12736         * testsuite/protected_main_1.cc: New file.
12737         * testsuite/protected_main_2.cc: New file.
12738         * testsuite/protected_main_3.cc: New file.
12739         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12740         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12741         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12742         (protected_1.so): New target.
12743         (protected_1_pic.o, protected_2_pic.o): New targets.
12744         (protected_3_pic.o): New target.
12745         (check_PROGRAMS): Add protected_2.
12746         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12747         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12748         * testsuite/Makefile.in: Rebuild.
12749
12750         * options.h (DEFINE_var): Add set_user_set_##varname__.
12751         (DEFINE_bool_alias): New macro.
12752         (class General_options): Define -Bstatic using DEFINE_bool_alias
12753         rather than DEFINE_special.  Add --undefined as an alias for -z
12754         defs.
12755         * options.cc (General_options::parse_Bstatic): Remove.
12756
12757         * options.h (class General_options): Add --fatal-warnings.
12758         * main.cc (main): Implement --fatal-warnings.
12759         * errors.h (Errors::warning_count): New function.
12760
12761         * options.h (class General_options): Add -Bsymbolic-functions.
12762         * symtab.h (Symbol::is_preemptible): Check for
12763         -Bsymbolic-functions.
12764
12765 2008-05-05  Ian Lance Taylor  <iant@google.com>
12766
12767         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12768         as noVARNAME rather than no-VARNAME.
12769         (class General_options): Add option -z combreloc.
12770         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12771         get_address.
12772         (Output_reloc::sort_before) [SHT_REL]: New function.
12773         (Output_reloc::sort_before) [SHT_RELA]: New function.
12774         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12775         Sort_relocs_comparison.
12776         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12777         parameter.  Change all callers.
12778         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12779         sort_relocs parameter.  Change all callers.
12780         * output.cc (Output_reloc::get_address): New function, broken out
12781         of write_rel.
12782         (Output_reloc::write_rel): Call it.
12783         (Output_reloc::compare): New function.
12784         (Output_data_reloc_base::do_write): Optionally sort relocs.
12785
12786         * configure.ac: If targ_extra_obj is set, link it in.
12787         * configure.tgt: Initialize all variables.
12788         (x86_64*): Set targ_extra_obj and targ_extra_size.
12789         * configure: Rebuild.
12790
12791         * object.cc (Sized_relobj::include_section_group): Adjust section
12792         indexes read from group data.  Build vector to pass to
12793         layout_group.
12794         * layout.cc (Layout::layout_group): Add flags and shndxes
12795         parameters.  Remove contents parameter.  Change caller.  Update
12796         explicit instantiations.
12797         * layout.h (class Layout): Update layout_group declaration.
12798         * output.cc (Output_data_group::Output_data_group): Add flags and
12799         input_shndxes parameters.  Remove contents parameter.  Change
12800         caller.
12801         (Output_data_group::do_write): Change input_sections_ to
12802         input_shndxes_.
12803         * output.h (class Output_data_group): Update constructor
12804         declaration.  Rename input_sections_ to input_shndxes_.
12805         * testsuite/many_sections_test.cc: Add template.
12806
12807 2008-04-30  Cary Coutant  <ccoutant@google.com>
12808
12809         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12810
12811         * layout.cc (Layout::include_section): Refactored check for debug
12812         info section.
12813         (Layout::add_comdat): Add new parameters.  Change type
12814         of signature parameter.  Add object and shndx to signatures table.
12815         (Layout::find_kept_object): New function.
12816         * layout.h: Include <cstring>.
12817         (Layout::is_debug_info_section): New function.
12818         (Layout::add_comdat): Add new parameters.
12819         (Layout::find_kept_object): New function.
12820         (Layout::Kept_section): New struct.
12821         (Layout::Signatures): Change type of map range.
12822         * object.cc (Relobj::output_section_address): New function.
12823         (Sized_relobj::include_section_group): Add new parameters.  Change
12824         calls to Layout::add_comdat.  Change to build table of kept comdat
12825         groups and table mapping discarded sections to kept sections.
12826         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12827         (Sized_relobj::do_layout): Change calls to include_section_group and
12828         include_linkonce_section.
12829         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12830         value to zero when section is discarded.
12831         (Sized_relobj::map_to_kept_section): New function.
12832         * object.h (Relobj::output_section_address): New function.
12833         (Relobj::Comdat_group): New type.
12834         (Relobj::find_comdat_group): New function.
12835         (Relobj::Comdat_group_table): New type.
12836         (Relobj::Kept_comdat_section): New type.
12837         (Relobj::Kept_comdat_section_table): New type.
12838         (Relobj::add_comdat_group): New function.
12839         (Relobj::set_kept_comdat_section): New function.
12840         (Relobj::get_kept_comdat_section): New function.
12841         (Relobj::comdat_groups_): New field.
12842         (Relobj::kept_comdat_sections_): New field.
12843         (Symbol_value::input_value): Update comment.
12844         (Sized_relobj::map_to_kept_section) New function.
12845         (Sized_relobj::include_linkonce_section): Add new parameter.
12846         * target-reloc.h (Comdat_behavior): New type.
12847         (get_comdat_behavior): New function.
12848         (relocate_section): Add code to map a discarded section to the
12849         corresponding kept section when applying a relocation.
12850
12851 2008-04-30  Craig Silverstein  <csilvers@google.com>
12852
12853         * dwarf_reader.cc (next_generation_count): New static var.
12854         (Addr2line_cache_entry): New struct.
12855         (addr2line_cache): New static var.
12856         (Dwarf_line_info::one_addr2line): Added caching.
12857         (Dwarf_line_info::clear_addr2line_cache): New function.
12858         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12859         cache-size parameter.
12860         (Dwarf_line_info::one_addr2line_cache): New function.
12861         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12862         new cache-size argument to one_addr2line(), and clear cache.
12863
12864 2008-04-28  Cary Coutant  <ccoutant@google.com>
12865
12866         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12867         R_386_PC8 relocations.
12868
12869 2008-04-23  Ian Lance Taylor  <iant@google.com>
12870
12871         * object.cc (Sized_relobj::include_section_group): Check for
12872         invalid section group.
12873
12874         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12875         header size.
12876
12877         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12878         than read for file header.
12879         * archive.cc (Archive::include_member): Likewise.
12880
12881 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12882
12883         * aclocal.m4: Regenerate.
12884         * configure: Regenerate.
12885
12886 2008-04-19  Ian Lance Taylor  <iant@google.com>
12887
12888         * version.cc (version_string): Bump to 1.6.
12889
12890         * testsuite/Makefile.am (many_sections_r_test): New target.
12891         (many_sections_r_test_SOURCES): Remove.
12892         (many_sections_r_test_DEPENDENCIES): Remove.
12893         (many_sections_r_test_LDFLAGS): Remove.
12894         (many_sections_r_test_LDADD): Remove.
12895
12896         * object.cc (Sized_relobj::do_add_symbols): Always pass
12897         local_symbol_count_ to add_from_relobj.
12898
12899         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12900         every thousand variables.
12901         * testsuite/Makefile.in: Rebuild.
12902
12903         * object.cc (Xindex::initialize_symtab_xindex): New function.
12904         (Xindex::read_symtab_xindex): New function.
12905         (Xindex::sym_xindex_to_shndx): New function.
12906         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12907         available.
12908         (Sized_relobj::do_initialize_xindex): New function.
12909         (Sized_relobj::do_read_symbols): Adjust section links.
12910         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12911         parameter.  Change all callers.
12912         (Sized_relobj::include_section_group): Adjust section links and
12913         symbol section indexes.
12914         (Sized_relobj::do_layout): Adjust section links.
12915         (Sized_relobj::do_count_local_symbols): Adjust section links and
12916         symbol section indexes.
12917         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12918         ordinary and special symbols.
12919         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12920         dynsym_xindex parameters.  Change all callers.  Adjust section
12921         links.  Use SHN_XINDEX when needed.
12922         (Sized_relobj::get_symbol_location_info): Adjust section links.
12923         Don't get fooled by special symbols.
12924         * object.h (class Xindex): Define.
12925         (class Object): Add xindex_ parameter.  Declare virtual functoin
12926         do_initialize_xindex.
12927         (Object::adjust_sym_shndx): New function.
12928         (Object::set_xindex): New protected function.
12929         (class Symbol_value): Add is_ordinary_shndx_ field.
12930         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12931         (Symbol_value::value): Assert ordinary section.
12932         (Symbol_value::initialize_input_to_output_map): Likewise.
12933         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12934         Change all callers.
12935         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12936         all callers.
12937         (class Sized_relobj): Update declarations.
12938         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12939         parameter.  Change all callers.
12940         (Sized_relobj::adjust_shndx): New function.
12941         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12942         field.
12943         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12944         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12945         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12946         (Sized_dynobj::read_dynsym_section): Adjust section links.
12947         (Sized_dynobj::read_dynamic): Likewise.
12948         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12949         section links.
12950         (Sized_dynobj::do_initialize_xindex): New function.
12951         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12952         do_initialize_xindex.
12953         (Sized_dynobj::adjust_shndx): New function.
12954         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12955         dynsym_xindex_ fields.
12956         (Layout::finalize): Add a call to set_section_indexes before
12957         creating the symtab sections.
12958         (Layout::set_section_indexes): Don't do anything if the section
12959         already has a section index.
12960         (Layout::create_symtab_sections): Add shnum parameter.  Change
12961         caller.  Create .symtab_shndx section if needed.
12962         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12963         caller.
12964         (Layout::allocated_output_section_count): New function.
12965         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12966         needed.
12967         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12968         fields.  Update declarations.
12969         (Layout::symtab_xindex): New function.
12970         (Layout::dynsym_xindex): New function.
12971         (class Write_symbols_task): Add layout_ field.
12972         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12973         Change caller.
12974         * output.cc (Output_section_headers::Output_section_headers): Add
12975         shstrtab_section parameter.  Change all callers.
12976         (Output_section_headers::do_sized_write): Store overflow values
12977         for section count and section string table section index in
12978         section header zero.
12979         (Output_file_header::do_sized_write): Check for overflow of
12980         section count and section string table section index.
12981         (Output_symtab_xindex::do_write): New function.
12982         (Output_symtab_xindex::endian_do_write): New function.
12983         * output.h (class Output_section_headers): Add shstrtab_section_.
12984         Update declarations.
12985         (class Output_symtab_xindex): Define.
12986         (Output_section::has_out_shndx): New function.
12987         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12988         field.
12989         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12990         Change all callers.
12991         (Sized_symbol::init): Likewise.
12992         (Symbol::output_section): Check for ordinary symbol.
12993         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12994         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12995         callers.
12996         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12997         Change all callers.  Simplify handling of symbols from sections
12998         not included in the link.
12999         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13000         distinction.
13001         (Weak_alias_sorter::operator()): Assert that symbols are
13002         ordinary.
13003         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13004         distinction.
13005         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13006         parameters.  Change all callers.
13007         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13008         symbol distinction.  Use SHN_XINDEX when needed.
13009         (Symbol_table::write_section_symbol): Add symtab_xindex
13010         parameter.  Change all callers.
13011         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13012         SHN_XINDEX when needed.
13013         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13014         declarations.
13015         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13016         (Symbol::is_defined): Check is_ordinary.
13017         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13018         (Symbol::is_absolute, Symbol::is_common): Likewise.
13019         (class Sized_symbol): Update declarations.
13020         (class Symbol_table): Update declarations.
13021         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13022         parameters.  Change all callers.
13023         (Sized_symbol::override): Likewise.
13024         (Symbol_table::override): Likewise.
13025         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13026         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13027         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13028         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13029         to be in an ordinary section.
13030         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13031         object and is_ordinary parameters.  Change all callers.
13032         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13033         Change all callers.  Don't add undefined or non-ordinary symbols
13034         to reloc_map_.
13035         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13036         Change all callers.
13037         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13038         declarations.
13039         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13040         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13041         (Sized_relobj::relocate_sections): Likewise.
13042         * target-reloc.h (scan_relocs): Adjust section symbol index.
13043         (scan_relocatable_relocs): Likewise.
13044         * i386.cc (Scan::local): Check for ordinary symbols.
13045         * sparc.cc (Scan::local): Likewise.
13046         * x86_64.cc (Scan::local): Likewise.
13047         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13048         to symbol_section_and_value.
13049         * testsuite/many_sections_test.cc: New file.
13050         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13051         (check_PROGRAMS): Add many_sections_test.
13052         (many_sections_test_SOURCES): Define.
13053         (many_sections_test_DEPENDENCIES): Define.
13054         (many_sections_test_LDFLAGS): Define.
13055         (BUILT_SOURCES): Add many_sections_define.h.
13056         (many_sections_define.h): New target.
13057         (BUILT_SOURCES): Add many_sections_check.h.
13058         (many_sections_check.h): New target.
13059         (check_PROGRAMS): Add many_sections_r_test.
13060         (many_sections_r_test_SOURCES): Define.
13061         (many_sections_r_test_DEPENDENCIES): Define.
13062         (many_sections_r_test_LDFLAGS): Define.
13063         (many_sections_r_test_LDADD): Define.
13064         (many_sections_r_test.o): New target.
13065         * testsuite/Makefile.in: Rebuild.
13066
13067 2008-04-17  Cary Coutant  <ccoutant@google.com>
13068
13069         * errors.cc (Errors::info): New function.
13070         (gold_info): New function.
13071         * errors.h (Errors::info): New function.
13072         * gold.h (gold_info): New function.
13073         * object.cc (Input_objects::add_object): Print trace output.
13074         * options.cc (options::parse_set): New function.
13075         (General_options::parse_wrap): Deleted.
13076         (General_options::General_options): Deleted initializer.
13077         * options.h (options::String_set): New typedef.
13078         (options::parse_set): New function.
13079         (DEFINE_set): New macro.
13080         (General_options::wrap): Changed to use DEFINE_set. Changed
13081         callers of any_wrap_symbols and is_wrap_symbol.
13082         (General_options::trace, General_options::trace_symbol):
13083         New options.
13084         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13085         (General_options::wrap_symbols_): Deleted.
13086         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13087
13088 2008-04-17  David S. Miller  <davem@davemloft.net>
13089
13090         * options.cc (General_options::parse_V): New function.
13091         * options.h: Add entries for -V and -Qy.
13092
13093 2008-04-17  Ian Lance Taylor  <iant@google.com>
13094
13095         * common.cc (Symbol_table::allocate_commons): Remove options
13096         parameter.  Change caller.
13097         (Symbol_table::do_allocate_commons): Remove options parameter.
13098         Change caller.  Just call do_allocate_commons_list twice.
13099         (Symbol_table::do_allocate_commons_list): New function, broken out
13100         of do_allocate_commons.
13101         * common.h (class Allocate_commons_task): Remove options_ field.
13102         Update constructor.
13103         * symtab.cc (Symbol_table::Symbol_table): Initialize
13104         tls_commons_.
13105         (Symbol_table::add_from_object): Put TLS common symbols on
13106         tls_commons_ list.
13107         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13108         which are IN_OUTPUT_DATA.
13109         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13110         allocate_commons and do_allocate_commons declarations.  Declare
13111         do_allocate_commons_list.
13112         * gold.cc (queue_middle_tasks): Update creation of
13113         Allocate_commons_task to not pass options.
13114         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13115         (TLS_TEST_C_FLAGS): New variable.
13116         (tls_test_c_pic.o): New target.
13117         (tls_test_shared.so): Link in tls_test_c_pic.o.
13118         (tls_test_c_pic_ie.o): New target.
13119         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13120         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13121         (tls_test_c.o): New target.
13122         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13123         (tls_pic_test_LDADD): Likewise.
13124         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13125         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13126         (tls_test_c_gnu2.o): New target.
13127         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13128         tls_test_c_gnu2.o.
13129         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13130         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13131         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13132         * testsuite/tls_test.cc: Include "config.h".
13133         (t_last): Call t11_last.
13134         * testsuite/tls_test.h (t11, t11_last): Declare.
13135         * testsuite/tls_test_c.c: New file.
13136         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13137         * configure.ac: Check for OpenMP support.
13138         * configure, config.in, Makefile.in: Rebuild.
13139         * testsuite/Makefile.in: Rebuild.
13140
13141 2008-04-16  Cary Coutant  <ccoutant@google.com>
13142
13143         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13144         (Target_i386::tls_base_symbol_defined_): New field.
13145         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13146         (Target_i386::Scan::global): Likewise.
13147         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13148         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13149         (Target_x86_64::tls_base_symbol_defined_): New field.
13150         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13151         (Target_x86_64::Scan::global): Likewise.
13152
13153 2008-04-16  Cary Coutant  <ccoutant@google.com>
13154
13155         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13156         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13157         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13158         building shared libraries.
13159         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13160         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13161         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13162         * testsuite/Makefile.in: Rebuild.
13163         * testsuite/weak_undef.h: New file.
13164         * testsuite/weak_undef_file1.cc: Add extra test cases.
13165         * testsuite/weak_undef_file2.cc: Likewise.
13166         * testsuite/weak_undef_test.cc: Likewise.
13167
13168 2008-04-16  David S. Miller  <davem@davemloft.net>
13169
13170         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13171         Add issued_non_pic_error_ field.  Declare check_non_pic.
13172         (Target_sparc::Scan::check_non_pic): New function.
13173         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13174         (Target_sparc::Scan::global): Likewise.
13175
13176         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13177         * configure: Rebuild.
13178
13179         * options.h (DEFINE_enable): New macro.
13180         (new_dtags): New enable option.
13181         (initfirst, interpose, loadfltr, nodefaultlib,
13182         nodelete, nodlopen, nodump): New -z options.
13183         * layout.cc (Layout:finish_dynamic_section): If new
13184         dtags enabled, emit DT_RUNPATH.  Also, emit a
13185         DT_FLAGS_1 containing any specified -z flags.
13186
13187 2008-04-16  Ian Lance Taylor  <iant@google.com>
13188
13189         * copy-relocs.cc: New file.
13190         * copy-relocs.h: New file.
13191         * reloc.cc: Remove Copy_relocs code.
13192         * reloc.h: Likewise.
13193         * reloc-types.h (struct Reloc_types) [both versions]: Add
13194         get_reloc_addend_noerror.
13195         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13196         variants of add_global which take an addend which must be zero.
13197         * i386.cc: Include "copy-relocs.h".
13198         (class Target_i386): Change type of copy_relocs_ to variable,
13199         update initializer.
13200         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13201         Change all callers.
13202         (Target_i386::do_finalize_sections): Change handling of
13203         copy_relocs_.
13204         * sparc.cc: Include "copy-relocs.h".
13205         (class Target_sparc): Change type of copy_relocs_ to variable,
13206         update initializer.
13207         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13208         Change all callers.
13209         (Target_sparc::do_finalize_sections): Change handling of
13210         copy_relocs_.
13211         * x86_64.cc: Include "copy-relocs.h".
13212         (class Target_x86_64): Change type of copy_relocs_ to variable,
13213         update initializer.
13214         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13215         class.  Change all callers.
13216         (Target_x86_64::do_finalize_sections): Change handling of
13217         copy_relocs_.
13218         * Makefile.am (CCFILES): Add copy-relocs.cc.
13219         (HFILES): Add copy-relocs.h.
13220
13221         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13222
13223         * testsuite/script_test_4.sh: Permit leading zeroes.
13224
13225 2008-04-15  Ian Lance Taylor  <iant@google.com>
13226
13227         * script-sections.cc (Script_sections::create_segments): Use
13228         header_size_adjustment even when there is enough room for the
13229         headers.
13230         * testsuite/script_test_4.sh: New file.
13231         * testsuite/script_test_4.t: New file.
13232         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13233         (check_DATA): Add script_test_4.stdout.
13234         (MOSTLYCLEANFILES): Likewise.
13235         (script_test_4): New target.
13236         (script_test_4.stdout): New target.
13237         * testsuite/Makefile.in: Rebuild.
13238
13239         * sparc.cc: Add definitions for Output_data_plt_sparc class
13240         constants.
13241
13242 2008-04-14  David S. Miller  <davem@davemloft.net>
13243
13244         * sparc.cc: New file.
13245         * Makefile.am (TARGETSOURCES): Add sparc.cc
13246         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13247         * configure.tgt: Document targ_extra_size and
13248         targ_extra_big_endian.  Add entries for sparc-* and
13249         sparc64-*.
13250         * configure.ac: Handle targ_extra_size and
13251         targ_extra_big_endian.
13252         * Makefile.in: Rebuild.
13253         * configure: Likewise.
13254         * po/POTFILES.in: Likewise.
13255         * po/gold.pot: Likewise.
13256
13257 2008-04-14  Ian Lance Taylor  <iant@google.com>
13258
13259         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13260         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13261         in the name/type/flags to section mapping.  Don't call
13262         allocate_output_section.
13263         (Layout::choose_output_section): Change parameter from adjust_name
13264         to is_input_section.  Don't permit input sections after sections
13265         are attached to segments.  Don't call allocate_output_section.
13266         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13267         not write_enable_output_section.
13268         (Layout::make_output_section): Don't push to
13269         unattached_section_list_ nor call attach_to_segment.  Call
13270         attach_section_to_segment if sections are attached.
13271         (Layout::attach_sections_to_segments): New function.
13272         (Layout::attach_section_to_segment): New function.
13273         (Layout::attach_allocated_section_to_segment): Rename from
13274         attach_to_segment.  Remove flags parameter.
13275         (Layout::allocate_output_section): Remove function.
13276         (Layout::write_enable_output_section): Remove function.
13277         * layout.h (class Layout): Update for above changes.  Add new
13278         field sections_are_attached_.
13279         * output.h (Output_section::update_flags_for_input_section): New
13280         function.
13281         * output.cc (Output_section::add_input_section): Call
13282         update_flags_for_input_section.
13283         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13284
13285 2008-04-11  Cary Coutant  <ccoutant@google.com>
13286
13287         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13288         thought unnecessary.
13289         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13290
13291 2008-04-11  Ian Lance Taylor  <iant@google.com>
13292
13293         * output.h (class Output_section_data): Remove inline definition
13294         of set_addralign.
13295         * output.cc (Output_section_data::set_addralign): New function.
13296
13297 2008-04-11  Cary Coutant  <ccoutant@google.com>
13298
13299         Add support for TLS descriptors for i386 and x86_64.
13300         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13301         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13302         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13303         GOT_TYPE_TLS_DESC.
13304         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13305         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13306         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13307         relocations.
13308         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13309         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13310         Fix problem with initial-exec relocations.
13311         (Target_i386::Relocate::relocate_tls): Likewise.
13312         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13313         relaxation.
13314         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13315         support for section-plus-offset dynamic table entries.
13316         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13317         (Output_data_dynamic::Dynamic_entry): Add support for
13318         section-plus-offset dynamic table entries.
13319         (Output_data_dynamic::Classification): Likewise.
13320         (Output_data_dynamic::classification_): Renamed offset_.
13321         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13322         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13323         (Target_x86_64::make_plt_section): New function.
13324         (Target_x86_64::reserve_tlsdesc_entries): New function.
13325         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13326         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13327         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13328         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13329         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13330         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13331         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13332         add extra PLT entry for TLS descriptors.
13333         (Output_data_plt_x86_64::got_): New field.
13334         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13335         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13336         fields.
13337         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13338         descriptors.
13339         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13340         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13341         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13342         R_386_TLS_DESC_CALL relocations.
13343         (Target_x86_64::Scan::global): Likewise.
13344         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13345         for TLS descriptors.
13346         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13347         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13348         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13349         GD-to-IE relaxation.
13350         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13351         and TLS_DESCRIPTORS.
13352         * Makefile.in: Rebuild.
13353         * configure: Rebuild.
13354         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13355         (tls_test_shared2.so): New target.
13356         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13357         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13358         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13359         (tls_shared_gd_to_ie_test_LDADD): New variable.
13360         (tls_shared_gnu2_gd_to_ie_test): New target.
13361         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13362         New targets.
13363         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13364         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13365         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13366         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13367         (tls_shared_gnu2_test): New target.
13368         (tls_test_gnu2_shared.so): New target.
13369         (tls_shared_gnu2_test_SOURCES): New variable.
13370         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13371         (tls_shared_gnu2_test_LDFLAGS): New variable.
13372         (tls_shared_gnu2_test_LDADD): New variable.
13373         * testsuite/Makefile.in: Rebuild.
13374         * testsuite/Makefile.
13375
13376 2008-04-11  Ian Lance Taylor  <iant@google.com>
13377
13378         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13379         justsyms.t.
13380         * testsuite/Makefile.in: Rebuild.
13381
13382         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13383         long.
13384         * testsuite/script_test_2.cc (main): Adjust test.
13385
13386 2008-04-11  David S. Miller  <davem@davemloft.net>
13387             Ian Lance Taylor  <iant@google.com>
13388
13389         * options.h (General_options): Add entries for '-Y' and
13390         '-relax'.
13391         * options.cc (General_options:finalize): If -Y was used, add those
13392         entries to the library path instead of the default "/lib" and
13393         "/usr/lib".
13394
13395 2008-04-11  David S. Miller  <davem@davemloft.net>
13396
13397         * testsuite/justsyms.t: Start at 0x100.
13398         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13399         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13400         long.
13401         * testsuite/script_test_2.cc: Adjust string and section length
13402         checks.
13403
13404 2008-04-09  Ian Lance Taylor  <iant@google.com>
13405
13406         PR gold/5996
13407         * script-sections.cc (Sections_element::allocate_to_segment): Add
13408         orphan parameter.
13409         (Output_section_definition::allocate_to_segment): Likewise.
13410         (Orphan_output_section::allocate_to_segment): Likewise.
13411         (Script_sections::attach_sections_using_phdrs_clause): Don't
13412         propagate non-PT_LOAD segments to orphan sections.
13413         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13414         readelf rather than objdump.
13415         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13416         .interp section and PT_INTERP segment are the same size.
13417         * testsuite/Makefile.in: Rebuild.
13418
13419         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13420         aliases for symbols defined in the same object.
13421         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13422         (weak_alias_test_SOURCES): New variable.
13423         (weak_alias_test_DEPENDENCIES): New variable.
13424         (weak_alias_test_LDFLAGS): New variable.
13425         (weak_alias_test_LDADD): New variable.
13426         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13427         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13428         (weak_alias_test_3.o): New target.
13429         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13430         * testsuite/weak_alias_test_main.cc: New file.
13431         * testsuite/weak_alias_test_1.cc: New file.
13432         * testsuite/weak_alias_test_2.cc: New file.
13433         * testsuite/weak_alias_test_3.cc: New file.
13434
13435 2008-04-08  Ian Lance Taylor  <iant@google.com>
13436
13437         * options.h (class General_options): Add --noinhibit-exec option.
13438         * main.cc (main): Check --noinhibit-exec.
13439
13440         * options.h (class General_options): Define --wrap as a special
13441         option.  Add wrap_symbols_ field.
13442         (General_options::any_wrap_symbols): New function.
13443         (General_options::is_wrap_symbol): New function.
13444         * options.cc (General_options::parse_wrap): New function.
13445         (General_options::General_options): Initialize wrap_symbols_.
13446         * symtab.cc (Symbol_table::wrap_symbol): New function.
13447         (Symbol_table::add_from_object): Handle --wrap.
13448         * symtab.h (class Symbol_table): Declare wrap_symbol.
13449         * target.h (Target::wrap_char): New function.
13450         (Target::Target_info): Add wrap_char field.
13451         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13452         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13453         * testsuite/testfile.cc (Target_test::test_target_info):
13454         Likewise.
13455
13456         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13457         there is one.
13458
13459         * layout.h (class Layout): Add added_eh_frame_data_ field.
13460         * layout.cc (Layout::Layout): Initialize new field.
13461         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13462         output section until we find a section we merged successfully.
13463         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13464         that the size be non-zero.
13465
13466         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13467         qualifier.
13468
13469 2008-04-08  Craig Silverstein  <csilvers@google.com>
13470
13471         * configure.ac: Export new conditional variable HAVE_ZLIB.
13472         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13473         on HAVE_ZLIB.
13474         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13475         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13476
13477 2008-04-07  Ian Lance Taylor  <iant@google.com>
13478
13479         * version.cc (version_string): Set to "1.5".
13480
13481         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13482         Add issued_non_pic_error_ field.  Declare check_non_pic.
13483         (Target_x86_64::Scan::check_non_pic): New function.
13484         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13485         (Target_x86_64::Scan::global): Likewise.
13486
13487         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13488         addend parameter.  Change caller.  Handle merge sections.
13489         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13490         Address to Addend.  Don't add in the result of
13491         local_section_offset, pass down the addend and use the returned
13492         value.
13493         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13494         Update declarations of local_section_offset and symbol_value.
13495         * testsuite/two_file_test_1.cc (t18): New function.
13496         * testsuite/two_file_test_2.cc (f18): New function.
13497         * testsuite/two_file_test_main.cc (main): Call t18.
13498         * testsuite/two_file_test.h (t18, f18): Declare.
13499
13500         * configure.ac: Don't test for objdump, c++filt, or readelf.
13501         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13502         conditionals.
13503         (TEST_READELF): New variable.
13504         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13505         (check_PROGRAMS): Add two_file_strip_test.
13506         (two_file_strip_test): New target.
13507         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13508         (two_file_same_shared_strip_test_SOURCES): New variable.
13509         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13510         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13511         (two_file_same_shared_strip_test_LDADD): New variable.
13512         (two_file_shared_strip.so): New target.
13513         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13514         (ver_test_5.syms, ver_test_7.syms): Likewise.
13515         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13516         (strip_test_3.stdout): Use TEST_OBJDUMP.
13517         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13518
13519 2008-04-04  Cary Coutant  <ccoutant@google.com>
13520
13521         * symtab.h (Symbol::is_weak_undefined): New function.
13522         (Symbol::is_strong_undefined): New function.
13523         (Symbol::is_absolute): New function.
13524         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13525         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13526         absolute symbols.
13527         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13528         (weak_undef_test): New target.
13529         * testsuite/Makefile.in: Rebuild.
13530         * testsuite/weak_undef_file1.cc: New file.
13531         * testsuite/weak_undef_file2.cc: New file.
13532         * testsuite/weak_undef_test.cc: New file.
13533
13534 2008-04-03  Craig Silverstein  <csilvers@google.com>
13535
13536         * compressed_output.h (class Output_compressed_section): Use
13537         unsigned buffer.
13538         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13539         add zlib header.
13540         (zlib_compressed_suffix): Removed.
13541         (Output_compressed_section::set_final_data_size): Use unsigned
13542         buffers.
13543         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13544         Fix linker invocation.
13545         (flagstest_o_specialfile_and_compress_debug_sections):
13546         Likewise.
13547         * testsuite/Makefile.in: Regenerated.
13548
13549 2008-04-02  David S. Miller  <davem@davemloft.net>
13550
13551         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13552         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13553
13554 2008-04-02  Craig Silverstein  <csilvers@google.com>
13555
13556         * TODO: New file.
13557
13558 2008-04-02  Ian Lance Taylor  <iant@google.com>
13559
13560         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13561         parameters.  Update for new key type to views_.  Change all
13562         callers.
13563         (File_read::read): Adjust for byteshift in returned view.
13564         (File_read::add_view): New function, broken out of
13565         find_and_make_view.
13566         (File_read::make_view): New function, broken out of
13567         find_and_make_view.
13568         (File_read::find_or_make_view): Add offset and aligned
13569         parameters.  Rewrite accordingly.  Change all callers.
13570         (File_read::get_view): Add offset and aligned parameters.  Adjust
13571         for byteshift in return value.
13572         (File_read::get_lasting_view): Likewise.
13573         * fileread.h (class File_read): Update declarations.
13574         (class File_read::View): Add byteshift_ field.  Add byteshift to
13575         constructor.  Add byteshift method.
13576         * archive.h (Archive::clear_uncached_views): New function.
13577         (Archive::get_view): Add aligned parameter.  Change all callers.
13578         * object.h (Object::get_view): Add aligned parameter.  Change all
13579         callers.
13580         (Object::get_lasting_view): Likewise.
13581
13582         * fileread.cc (File_read::release): Don't call clear_views if
13583         there are multiple objects.
13584         * fileread.h (File_read::clear_uncached_views): New function.
13585         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13586         on the archive.
13587
13588 2008-03-31  Cary Coutant  <ccoutant@google.com>
13589
13590         Add thin archive support.
13591         * archive.cc (Archive::armagt): New const.
13592         (Archive::setup): Remove task parameter and calls to unlock.
13593         (Archive::unlock_nested_archives): New function.
13594         (Archive::read_header): Add nested_off parameter. Change
13595         all callers.
13596         (Archive::interpret_header): Likewise.
13597         (Archive::include_all_members): Change to handle thin
13598         archives.
13599         (Archive::include_member): Likewise.
13600         * archive.h (Archive::Archive): Add new parameters and
13601         initializers.
13602         (Archive::armagt): New const.
13603         (Archive::setup): Remove task parameter.
13604         (Archive::unlock_nested_archives): New function.
13605         (Archive::read_header): Add nested_off parameter.
13606         (Archive::interpret_header): Likewise.
13607         (Archive::Nested_archive_table): New typedef.
13608         (Archive::is_thin_archive_): New field.
13609         (Archive::nested_archives_): New field.
13610         (Archive::options_): New field.
13611         (Archive::dirpath_): New field.
13612         (Archive::task_): New field.
13613         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13614         for thin archives.  Pass additional parameters to
13615         Archive::Archive.  Unlock the archive file after calling
13616         Archive::setup.
13617
13618 2008-03-29  Ian Lance Taylor  <iant@google.com>
13619
13620         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13621         version symbol to be local.
13622         * testsuite/ver_test_4.sh: New file.
13623         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13624         (check_DATA): Add ver_test_4.syms.
13625         (ver_test_4.syms): New target.
13626         * testsuite/Makefile.in: Rebuild.
13627
13628         * output.cc
13629         (Output_section::Input_section_sort_entry::has_priority): New
13630         function.
13631         (Output_section::Input_section_sort_entry::match_file_name): New
13632         function.
13633         (Output_section::Input_section_sort_entry::match_section_name):
13634         Remove.
13635         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13636         Remove.
13637         (Output_section::Input_section_sort_entry::match_section_file):
13638         Remove.
13639         (Output_section::Input_section_sort_compare::operator()): Rewrite
13640         using new Input_section_sort_entry functions.  Sort crtbegin and
13641         crtend first.  Sort sections with no priority before sections with
13642         a priority.
13643         * testsuite/initpri1.c (d3): Check j != 4.
13644         (cd5): New constructor/destructor function.
13645         (main): Check j != 2.
13646
13647         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13648         new symbol when resolving, don't call set_is_default.
13649         * testsuite/ver_test_7.cc: New file.
13650         * testsuite/ver_test_7.sh: New file.
13651         * testsuite/Makefile.am (ver_test_7.so): New target.
13652         (ver_test_7.o): New target.
13653         (check_SCRIPTS): Add ver_test_7.sh.
13654         (check_DATA): Add ver_test_7.syms.
13655         (ver_test_7.syms): New target.
13656
13657 2008-03-28  Ian Lance Taylor  <iant@google.com>
13658
13659         * layout.cc (Layout::layout): If we see an input section with a
13660         name that needs sorting, set the must_sort flag for the output
13661         section.
13662         (Layout::make_output_section): If the name of the output section
13663         indicates that it might require sorting, set the may_sort flag.
13664         * output.h (Output_section::may_sort_attached_input_sections): New
13665         function.
13666         (Output_section::set_may_sort_attached_input_sections): New
13667         function.
13668         (Output_section::must_sort_attached_input_sections): New
13669         function.
13670         (Output_section::set_must_sort_attached_input_sections): New
13671         function.
13672         (class Output_section): Declare Input_section_sort_entry.  Define
13673         Input_section_sort_compare.  Declare
13674         sort_attached_input_sections.  Add new fields:
13675         may_sort_attached_input_sections_,
13676         must_sort_attached_input_sections_,
13677         attached_input_sections_are_sorted_.
13678         * output.cc (Output_section::Output_section): Initialize new
13679         fields.
13680         (Output_section::add_input_section): Add an entry to
13681         input_sections_ if may_sort or must_sort are true.
13682         (Output_section::set_final_data_size): Call
13683         sort_attached_input_sections if necessary.
13684         (Output_section::Input_section_sort_entry): Define new class.
13685         (Output_section::Input_section_sort_compare::operator()): New
13686         function.
13687         (Output_section::sort_attached_input_sections): New function.
13688         * configure.ac: Check whether the compiler supports constructor
13689         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13690         * testsuite/initpri1.c: New file.
13691         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13692         CONSTRUCTOR_PRIORITY.
13693         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13694         (initpri1_LDFLAGS): New variable.
13695         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13696
13697 2008-03-27  Ian Lance Taylor  <iant@google.com>
13698
13699         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13700         * testsuite/common_test_1.c: New file.
13701         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13702         (common_test_1_SOURCES): New variable.
13703         (common_test_1_DEPENDENCIES): New variable.
13704         (common_test_1_LDFLAGS): New variable.
13705
13706         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13707         and commons_ correctly when NAME/VERSION does not override
13708         NAME/NULL.
13709         * testsuite/ver_test_6.c: New file.
13710         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13711         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13712         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13713
13714 2008-03-26  Ian Lance Taylor  <iant@google.com>
13715
13716         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13717         of an undefined symbol from a version script.
13718         * testsuite/Makefile.am (ver_test_5.so): New target.
13719         (ver_test_5.o): New target.
13720         (check_SCRIPTS): Add ver_test_5.sh.
13721         (check_DATA): Add ver_test_5.syms.
13722         (ver_test_5.syms): New target.
13723         * testsuite/ver_test_5.cc: New file.
13724         * testsuite/ver_test_5.script: New file.
13725         * testsuite/ver_test_5.sh: New file.
13726         * Makefile.in, testsuite/Makefile.in: Rebuild.
13727
13728         PR gold/5986
13729         Fix problems building gold with gcc 4.3.0.
13730         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13731         (gold_error_at_location, gold_warning_at_location): Use it.
13732         * configure.ac: Check whether we can compile and use a template
13733         function with a printf attribute.
13734         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13735         when jumping over bytes.
13736         * object.cc: Instantiate Object::read_section_data.
13737         * debug.h: Include <cstring>
13738         * dwarf_reader.cc: Include <algorithm>
13739         * main.cc: Include <cstring>.
13740         * options.cc: Include <cstring>.
13741         * output.cc: Include <cstring>.
13742         * script.cc: Include <cstring>.
13743         * script.h: Include <string>.
13744         * symtab.cc: Include <cstring> and <algorithm>.
13745         * target-select.cc: Include <cstring>.
13746         * version.cc: Include <string>.
13747         * testsuite/testmain.cc: Include <cstdlib>.
13748         * configure, config.in: Rebuild.
13749
13750 2008-03-25  Ian Lance Taylor  <iant@google.com>
13751
13752         * options.cc: Include "../bfd/bfdver.h".
13753         (options::help): Print bug reporting address.
13754
13755         * version.cc (print_version): Adjust output for current value of
13756         BFD_VERSION_STRING.
13757
13758         * NEWS: New file.
13759
13760         * options.cc (options::help): Print list of supported targets.
13761         * target-select.h: Include <vector>.
13762         (class Target_selector): Make machine_, size_, and is_big_endian_
13763         fields const.  Add bfd_name_ and instantiated_target_ fields.
13764         (Target_selector::Target_selector): Add bfd_name parameter.
13765         (Target_selector::recognize): Make non-virtual, call
13766         do_recognize.
13767         (Target_selector::recognize_by_name): Make non-virtual, call
13768         do_recognize_by_name.
13769         (Target_selector::supported_names): New function.
13770         (Target_selector::bfd_name): New function.
13771         (Target_selector::do_instantiate_target): New pure virtual
13772         function.
13773         (Target_selector::do_recognize): New virtual function.
13774         (Target_selector::do_recognize_by_name): New virtual function.
13775         (Target_selector::instantiate_target): New private function.
13776         (supported_target_names): Declare.
13777         * target-select.cc (Target_selector::Target_selector): Update for
13778         new parameter and fields.
13779         (select_target_by_name): Check that the name matches before
13780         calling recognize_by_name.
13781         (supported_target_names): New function.
13782         * i386.cc (class Target_selector_i386): Update Target_selector
13783         constructor call.  Remove recognize and recognize_by_name.  Add
13784         do_instantiate_target.
13785         * x86_64.cc (class Target_selector_x86_64): Likewise.
13786         * testsuite/testfile.cc (class Target_selector_test): Update for
13787         changes to Target_selector.
13788
13789         * README: Rewrite, with some notes on unsupported features.
13790
13791 2008-03-24  Cary Coutant  <ccoutant@google.com>
13792
13793         * i386.cc (Target_i386::Got_type): New enum declaration.
13794         (Target_i386::Scan::local): Updated callers of Output_data_got
13795         member functions.
13796         (Target_i386::Scan::global): Likewise.
13797         (Target_i386::Relocate::relocate): Likewise.
13798         (Target_i386::Relocate::relocate_tls): Likewise.
13799         * object.h (Got_offset_list): New class.
13800         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13801         (Sized_relobj::local_got_offset): Likewise.
13802         (Sized_relobj::set_local_got_offset): Likewise.
13803         (Sized_relobj::local_has_tls_got_offset): Removed.
13804         (Sized_relobj::local_tls_got_offset): Removed.
13805         (Sized_relobj::set_local_tls_got_offset): Removed.
13806         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13807         * output.cc (Output_data_got::add_global): Added got_type parameter.
13808         (Output_data_got::add_global_with_rel): Likewise.
13809         (Output_data_got::add_global_with_rela): Likewise.
13810         (Output_data_got::add_global_pair_with_rel): New function.
13811         (Output_data_got::add_global_pair_with_rela): New function.
13812         (Output_data_got::add_local): Added got_type parameter.
13813         (Output_data_got::add_local_with_rel): Likewise.
13814         (Output_data_got::add_local_with_rela): Likewise.
13815         (Output_data_got::add_local_pair_with_rel): New function.
13816         (Output_data_got::add_local_pair_with_rela): New function.
13817         (Output_data_got::add_global_tls): Removed.
13818         (Output_data_got::add_global_tls_with_rel): Removed.
13819         (Output_data_got::add_global_tls_with_rela): Removed.
13820         (Output_data_got::add_local_tls): Removed.
13821         (Output_data_got::add_local_tls_with_rel): Removed.
13822         (Output_data_got::add_local_tls_with_rela): Removed.
13823         * output.h (Output_data_got::add_global): Added got_type parameter.
13824         (Output_data_got::add_global_with_rel): Likewise.
13825         (Output_data_got::add_global_with_rela): Likewise.
13826         (Output_data_got::add_global_pair_with_rel): New function.
13827         (Output_data_got::add_global_pair_with_rela): New function.
13828         (Output_data_got::add_local): Added got_type parameter.
13829         (Output_data_got::add_local_with_rel): Likewise.
13830         (Output_data_got::add_local_with_rela): Likewise.
13831         (Output_data_got::add_local_pair_with_rel): New function.
13832         (Output_data_got::add_local_pair_with_rela): New function.
13833         (Output_data_got::add_global_tls): Removed.
13834         (Output_data_got::add_global_tls_with_rel): Removed.
13835         (Output_data_got::add_global_tls_with_rela): Removed.
13836         (Output_data_got::add_local_tls): Removed.
13837         (Output_data_got::add_local_tls_with_rel): Removed.
13838         (Output_data_got::add_local_tls_with_rela): Removed.
13839         * resolve.cc (Symbol::override_base_with_special): Removed
13840         reference to has_got_offset_ field.
13841         * symtab.cc (Symbol::init_fields): Replaced initialization
13842         of got_offset_ with got_offsets_.  Removed initialization
13843         of has_got_offset_
13844         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13845         (Symbol::got_offset): Likewise.
13846         (Symbol::set_got_offset): Likewise.
13847         (Symbol::has_tls_got_offset): Removed.
13848         (Symbol::tls_got_offset): Removed.
13849         (Symbol::set_tls_got_offset): Removed.
13850         (Symbol::got_offset_): Removed.
13851         (Symbol::tls_mod_got_offset_): Removed.
13852         (Symbol::tls_pair_got_offset_): Removed.
13853         (Symbol::got_offsets_): New field.
13854         (Symbol::has_got_offset): Removed.
13855         (Symbol::has_tls_mod_got_offset): Removed.
13856         (Symbol::has_tls_pair_got_offset): Removed.
13857         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13858         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13859         member functions.
13860         (Target_x86_64::Scan::global): Likewise.
13861         (Target_x86_64::Relocate::relocate): Likewise.
13862         (Target_x86_64::Relocate::relocate_tls): Likewise.
13863
13864 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13865
13866         * yyscript.y: Fix spelling error in comment.
13867
13868 2008-03-24  Ian Lance Taylor  <iant@google.com>
13869
13870         * options.h (class General_options): Define build_id option.
13871         * layout.h (class Layout): Declare write_build_id, create_note,
13872         create_build_id.  Add build_id_note_ member.
13873         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13874         "libiberty.h", "md5.h", "sha1.h".
13875         (Layout::Layout): Initialize eh_frame_data_,
13876         eh_frame_hdr_section_, and build_id_note_.
13877         (Layout::finalize): Call create_build_id.
13878         (Layout::create_note): New function, broken out of
13879         Layout::create_gold_note.
13880         (Layout::create_gold_note): Call create_note.
13881         (Layout::create_build_id): New function.
13882         (Layout::write_build_id): New function.
13883         (Close_task_runner::run): Call write_build_id.
13884
13885         * x86_64.cc: Correct license to GPLv3.
13886
13887 2008-03-23  Ian Lance Taylor  <iant@google.com>
13888
13889         * options.cc: Include "demangle.h".
13890         (parse_optional_string): New function.
13891         (parse_long_option): Handle takes_optional_argument.
13892         (parse_short_option): Update dash_z initializer.  Handle
13893         takes_optional_argument.
13894         (General_options::General_options): Initialize do_demangle_.
13895         (General_options::finalize): Set do_demangle_.  Handle demangling
13896         style.
13897         * options.h (parse_optional_string): Declare.
13898         (struct One_option): Add optional_arg field.  Update constructor.
13899         Update call constructor calls.  Add takes_optional_argument
13900         function.
13901         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13902         (DEFINE_optional_string): Define.
13903         (General_options::demangle): Change from DEFINE_bool to
13904         DEFINE_optional_string.
13905         (General_options::no_demangle): New function.
13906         (General_options::do_demangle): New function.
13907         (General_options::set_do_demangle): New function.
13908         (General_options::execstack_status_): Move definition to end of
13909         class definition.
13910         (General_options::static_): Likewise.
13911         (General_options::do_demangle_): New field.
13912         * object.cc (big_endian>::get_symbol_location_info): Call
13913         Options::do_demangle, not Options::demangle.
13914         * symtab.cc (demangle): Likewise.
13915
13916 2008-03-22  Ian Lance Taylor  <iant@google.com>
13917
13918         * gold.h: Include <cstddef> and <sys/types.h>
13919         * options.h: Include <cstring>.
13920
13921 2008-03-21  Ian Lance Taylor  <iant@google.com>
13922
13923         * Added source code to GNU binutils.