gold/
[external/binutils.git] / gold / ChangeLog
1 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2
3         * target.h (Sized_target::relocate_relocs): Use Elf_Off
4         for offset_in_output_section parameter.
5         (Sized_target::relocate_special_relocatable): Likewise.
6         * arm.cc (Target_arm::relocate_relocs): Likewise.
7         (Target_arm::relocate_special_relocatable): Likewise.
8         * i386.cc (Target_i386::relocate_relocs): Likewise.
9         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
10         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
11         * target-reloc.h (relocate_relocs): Likewise.
12         * testsuite/testfile.cc (Target_test): Likewise.
13         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
14         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
15
16         * system.h: Move inclusion of <clocale> to after <libintl.h> in
17         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
18
19         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
20         parameter, which is unused in the [!F_SETFD] case.
21
22         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
23         SYMNDX to off_t before comparing it to this->data_size().
24         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
25         * incremental.cc (Output_section_incremental_inputs::do_write):
26         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
27
28         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
29
30 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
31
32         * gold.cc (Target_arm::do_adjust_elf_header): Add the
33         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
34         in EABI_VER5.
35
36 2012-10-29  Cary Coutant  <ccoutant@google.com>
37
38         * dwp.cc (usage): Add file and exit status parameters;
39         add --help and --version options.
40         (print_version): New function.
41         (main): Add --help and --version options.
42
43 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
44
45         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
46         final_layout_sequence.txt.
47         * testsuite/Makefile.in: Regenerated.
48
49 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
50
51         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
52         COMPILE generated by automake.
53         (LINK1): Likewise.
54         (CXXCOMPILE1): Likewise.
55         (CXXLINK1): Likewise.
56         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
57         (LINK): Likewise.
58         (CXXCOMPILE): Likewise.
59         (CXXLINK): Likewise.
60         * testsuite/Makefile.in: Regenerated.
61
62 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
63
64         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
65         on bad fwrite return.
66
67 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
68
69         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
70         on val.
71
72 2012-10-23  Cary Coutant  <ccoutant@google.com>
73
74         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
75         * testsuite/Makefile.in: Regenerate.
76         * testsuite/dwp_test.h: New source file.
77         * testsuite/dwp_test_1.cc: New source file.
78         * testsuite/dwp_test_1.s: New source file.
79         * testsuite/dwp_test_1.sh: New source file.
80         * testsuite/dwp_test_1b.cc: New source file.
81         * testsuite/dwp_test_1b.s: New source file.
82         * testsuite/dwp_test_2.cc: New source file.
83         * testsuite/dwp_test_2.s: New source file.
84         * testsuite/dwp_test_2.sh: New source file.
85         * testsuite/dwp_test_main.cc: New source file.
86         * testsuite/dwp_test_main.s: New source file.
87
88 2012-10-23  Cary Coutant  <ccoutant@google.com>
89
90         * dwp.h: New header file.
91         * dwp.cc: New source file.
92         * gold.h: Move shared declarations to system.h.
93         * system.h: New header file.
94         * Makefile.am: Add dwp.
95         * Makefile.in: Regenerate.
96
97 2012-10-23  Cary Coutant  <ccoutant@google.com>
98
99         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
100         Dwarf_info_reader::read_from_pointer.
101         (Dwarf_pubnames_table::read_header): Likewise.
102         (Dwarf_pubnames_table::next_name): Likewise.
103         (Dwarf_die::read_attributes): Likewise.
104         (Dwarf_die::skip_attributes): Likewise.
105         (Dwarf_info_reader::read_from_pointer): New function template.
106         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
107         (Dwarf_pubnames_table): Likewise.
108         (Dwarf_info_reader::read_from_pointer): New function template.
109         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
110         Dwarf_pubnames_table ctor.
111
112 2012-10-23  Cary Coutant  <ccoutant@google.com>
113
114         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
115         abbrev_shndx.
116         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
117         abbrev_shndx_.
118         (Dwarf_info_reader::set_abbrev_shndx): New method.
119         (Dwarf_info_reader::abbrev_shndx_): New data member.
120
121 2012-10-23  Cary Coutant  <ccoutant@google.com>
122
123         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
124         from object, not parameters.
125         (Dwarf_info_reader::parse): Likewise.
126         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
127         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
128         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
129         methods.
130
131 2012-10-23  Cary Coutant  <ccoutant@google.com>
132
133         * fileread.cc (Input_file::Input_file): New constructor.
134         * fileread.h (class Input_file): Add new constructor.
135
136 2012-10-18  Alan Modra  <amodra@gmail.com>
137
138         PR gold/14727
139         * object.cc (Relobj::is_section_name_included): Also match
140         .sdata personality section.
141
142 2012-10-18  Alan Modra  <amodra@gmail.com>
143
144         * target-reloc.h (class Default_comdat_behavior): New, package up..
145         (get_comdat_behaviour): ..this.
146         (relocate_section): Add Relocate_comdat_behavior template arg,
147         adjust code to suit.
148         * arm.cc (Target_arm::relocate_section): Adjust to suit.
149         (Target_arm::scan_reloc_section): Likewise.
150         * i386.cc (Target_i386::relocate_section): Likewise.
151         * sparc.cc (Target_sparc::relocate_section): Likewise.
152         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
153         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
154         * powerpc.cc (class Relocate_comdat_behavior): New.
155         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
156         gold::relocate_section with new template arg.
157
158 2012-10-18  Alan Modra  <amodra@gmail.com>
159
160         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
161         dynamic relocs for GOT_TPREL got entries, without symbol if
162         resolving locally.
163         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
164         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
165         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
166
167 2012-10-17  Alan Modra  <amodra@gmail.com>
168
169         PR gold/14726
170         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
171
172 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
173
174         * layout.cc (Layout::include_section): Keep sections marked
175         SHF_EXCLUDE when doing relocatable links.
176
177 2012-10-16  Alan Modra  <amodra@gmail.com>
178
179         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
180         (Target_powerpc::do_finalize_sections): Call it.
181         (Output_data_save_res): New class and supporting functions.
182         (Target_powerpc::symval_for_branch): Only look up .opd entry for
183         normal symbols defined in object files.
184
185 2012-10-12  Alan Modra  <amodra@gmail.com>
186
187         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
188         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
189         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
190         section if scan_opd_relocs not yet called.
191         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
192
193 2012-10-12  Alan Modra  <amodra@gmail.com>
194
195         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
196         add_local_ifunc_entry): Revert last change.
197         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
198
199 2012-10-05  Alan Modra  <amodra@gmail.com>
200
201         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
202         do_plt_address_for_global): New functions.
203         (Output_data_got_powerpc::do_write): Don't segfault when linking
204         statically.
205         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
206         add_local_ifunc_entry): Return true on adding entry..
207         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
208         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
209         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
210         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
211         set up symbols here.
212         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
213         syms here.  Do so even when no .iplt.  Don't segfault when linking
214         statically.
215         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
216         new variants without reloc param.
217         (Glink_sym_ent::Glink_sym_ent): Likewise.
218         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
219         reloc when refs will resolve to plt call stub.
220         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
221         R_PPC_PLTREL24 to resolve locally.
222         (Target_powerpc::Scan::global): Correct ifunc handling.
223         (Target_powerpc::Relocate::relocate): Correct local sym glink
224         lookup.  Don't destroy "value" when we have a plt call stub,
225         and when checking plt call validity.
226         (Target_powerpc::do_dynsym_value): Simplify.
227
228 2012-10-05  Alan Modra  <amodra@gmail.com>
229
230         * i386.cc (Output_data_plt_i386::address_for_global,
231         address_for_local): Add plt offset to returned value.  Adjust uses.
232         * sparc.cc (Output_data_plt_sparc::address_for_global,
233         address_for_local): Likewise.
234         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
235         address_for_local): Likewise.
236         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
237         address_for_local): Likewise.
238         * target.h (Target::plt_address_for_global, plt_address_for_local):
239         Update comment.
240         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
241         (Output_data_got::Got_entry::write): Nor here.
242         * output.h: Comment fix.
243
244 2012-10-02  Jiong Wang  <jiwang@tilera.com>
245
246         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
247         global_offset_table_ value for larget got.
248         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
249
250 2012-09-29  Alan Modra  <amodra@gmail.com>
251
252         * powerpc.cc (Target_powerpc::iplt_): New output section.
253         (Target_powerpc::iplt_section, make_iplt_section,
254         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
255         (Target_powerpc::make_plt_entry): Handle ifunc syms.
256         Target_powerpc::plt_entry_count): Count iplt entries too.
257         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
258         reloc section in constructor.  New params.
259         (Target_powerpc::make_plt_section): Create reloc section here instead.
260         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
261         functions.
262         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
263         (Output_data_glink::add_entry, find_entry): New functions to
264         deal with local syms.
265         (Glink_sym_ent): Add support for local syms.
266         (Output_data_glink::do_write): Handle ifunc plt entries.
267         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
268         (Target_powerpc::Scan::local, global): Handle ifunc syms.
269         (Target_powerpc::Relocate::relocate): Likewise.
270         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
271
272 2012-09-25  Alan Modra  <amodra@gmail.com>
273
274         * object.h (Sized_relobj_file::adjust_local_symbol,
275         do_adjust_local_symbol): New functions.
276         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
277         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
278         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
279         and irregular opd entry spacing.
280         (Powerpc_relobj::do_read_relocs): Add opd size checks.
281         (Global_symbol_visitor_opd): New functor.
282         (Target_powerpc::do_finalize_sections): Omit global symbols defined
283         on deleted opd entries.
284
285 2012-09-15  Jiong Wang  <jiwang@tilera.com>
286
287         * tilegx.cc: New file.
288         * Makefile.am (TARGETSOURCES): Add tilegx.cc
289         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
290         * configure.tgt: Add entries for tilegx*.
291         * configure.ac: Likewise.
292         * Makefile.in: Rebuild.
293         * configure: Likewise.
294         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
295         tilegx.
296
297 2012-09-13  Alan Modra  <amodra@gmail.com>
298
299         * target-reloc.h (scan_relocs): Call scan.local for relocs
300         against symbols in discarded sections.  Pass is_discarded
301         param.
302         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
303         Add is_discarded param.
304         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
305         is_discarded to flag opd entry as discarded.  Don't emit dyn
306         relocs on such entries.
307         (Target_powerpc::Scan::global): Similarly detect and handle
308         such opd entries.
309         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
310         opd_ent_.  Update all uses.
311         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
312         (Target_powerpc::relocate_section): Zero out discarded opd
313         entry relocs.
314
315 2012-09-12  Ian Lance Taylor  <iant@google.com>
316
317         PR gold/14570
318         * output.cc: Rename Output_data_got template parameter from size
319         to got_size for all functions.  Compile all variants of
320         Output_data_got.
321         (Output_data_got::Got_entry::write): Correct use of size for
322         symbol value.  Use local_is_tls rather than casting to
323         Sized_relobj_file.
324         * object.h (class Object): Add local_is_tls and do_local_is_tls.
325         (class Sized_relobj_file): Add do_local_is_tls.
326         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
327
328 2012-09-11  Alan Modra  <amodra@gmail.com>
329
330         PR gold/14566
331         * layout.cc (Layout::set_segment_offsets): When using
332         common-page-size alignment, ensure we are on a new max-page-size
333         page.
334         * output.cc (Output_segment::set_section_addresses): Use
335         abi_pagesize, not common_pagesize for relro boundary.
336         (Output_segment::set_offset): Likewise.
337
338 2012-09-11  Alan Modra  <amodra@gmail.com>
339
340         * output.h (Output_data_got::add_global_tls, add_local_tls,
341         add_local_tls_pair): New functions.
342         (Output_data_got::add_local_pair_with_rel): Remove second
343         reloc param.  Expand comment.
344         (Output_data_got::Got_entry): Rename use_plt_offset_ to
345         use_plt_or_tls_offset_, similarly for constructor param.
346         (Output_data_got::Got_entry::write): Add got_index param.
347         * output.cc (Output_data_got::add_global_tls, add_local_tls,
348         add_local_tls_pair): New functions.
349         (Output_data_got::Got_entry::write): Handle tls symbols
350         with use_plt_or_tls_offset_ set specially.
351         (Output_data_got::add_local_pair_with_rel): Only one reloc.
352         (Output_data_got::do_write): Replace iterator with index, pass
353         index to entry write function.
354         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
355         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
356         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
357         call.
358         * i386.cc (Target_i386::Scan::local): Likewise.
359         * sparc.cc (Target_sparc::Scan::local): Likewise.
360         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
361         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
362         do_tls_offset_for_global): New functions.
363         (Target_powerpc::Scan::local): Correct TLS relocations and got
364         entry values.
365         (Target_powerpc::Scan::global): Don't emit unnecessary
366         dynamic relocations on TLS GOT entries.
367
368 2012-09-10  Matthias Klose  <doko@ubuntu.com>
369
370         * config.in: Disable sanity check for kfreebsd.
371
372 2012-09-10  Sterling Augustine  <saugustine@google.com>
373
374         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
375         (Gdb_index::pubtypes_read): New parameter.
376         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
377         to calls.
378         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
379         pubtypes_object_.
380
381 2012-09-09  Alan Modra  <amodra@gmail.com>
382
383         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
384         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
385         * gc.h (gc_process_relocs): Call target gc_add_reference.
386         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
387         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
388         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
389         unnecessary cast.
390         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
391         to cater for when we don't need code offset.  Update use.
392         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
393         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
394         set_opd_valid): New functions.
395         (Target_powerpc::do_gc_add_reference): New function.
396         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
397         stashed refs.
398         (Target_powerpc::do_gc_mark_symbol): New function.
399
400 2012-09-06  Cary Coutant  <ccoutant@google.com>
401
402         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
403         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
404         (Dwarf_die::skip_attributes): Likewise.
405         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
406         * testsuite/gdb_index_test.cc (inline_func_1): New function.
407         (main): Call it.
408         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
409
410 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
411
412         * testsuite/script_test_3.t: Add .got.plt output section
413         statement.
414         * testsuite/script_test_4.t: Likewise.
415
416 2012-09-05  Alan Modra  <amodra@gmail.com>
417
418         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
419         update all uses and lose "enum" when using type.
420
421 2012-09-05  Alan Modra  <amodra@gmail.com>
422
423         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
424         * configure: Regenerate.
425         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
426         (plugin_final_layout.stdout): Likewise.
427         (memory_test): Set page sizes to 0x1000.
428         * testsuite/Makefile.in: Regenerate.
429         * testsuite/discard_locals_test.sh: Add FIXME comment.
430         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
431         * testsuite/pr14265.t: Add .got output section statement.
432         * testsuite/script_test_2.t: Likewise.
433         * testsuite/script_test_3.t: Likewise.
434         * testsuite/script_test_4.t: Likewise.
435         * testsuite/script_test_5.t: Likewise.
436         * testsuite/script_test_6.t: Likewise.
437         * testsuite/script_test_7.t: Likewise.
438         * testsuite/script_test_9.t: Likewise.
439
440 2012-09-05  Alan Modra  <amodra@gmail.com>
441
442         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
443         (Powerpc_relocate_functions::Status): New typedef.
444         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
445         (Target_powerpc::Scan::local): Handle REL64.
446         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
447         for REL32 and REL64.
448         (Target_powerpc::symval_for_branch): New function, extracted from..
449         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
450         checks.  Report overflow errors.
451
452 2012-09-05  Alan Modra  <amodra@gmail.com>
453
454         * object.h (Sized_relobj_file::emit_relocs): Delete.
455         (Sized_relobj_file::emit_relocs_reltype): Delete.
456         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
457         relocate_relocs for --emit-relocs.
458         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
459         * output.h: Update comment.
460         (Output_segment::first_section): New function.
461         (Output_segment::first_section_load_address): Use first_section.
462         * output.cc (Output_segment::first_section): New function extracted..
463         (Output_segment::first_section_load_address): ..from here.  Delete.
464         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
465         * target.h (Sized_target::relocate_for_relocatable): Likewise.
466         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
467         adjust call to target.h function.
468         * i386.cc (Target_i386): Likewise.
469         * sparc.cc (Target_sparc): Likewise.
470         * x86_64.cc (Target_x86_64): Likewise.
471         * powerpc.cc (Target_powerpc): Likewise.
472         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
473         first tls section has section symbol for optimised local dynamic
474         output relocs.
475         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
476         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
477         optimised tls code.
478         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
479         Rename to relocate_relocs.  Update error message.
480
481 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
482
483         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
484         --just-symbols.
485
486 2012-08-31  Alan Modra  <amodra@gmail.com>
487
488         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
489         (Powerpc_relobj::toc_base_offset): New stub function.
490         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
491         got_mod_index_offset to tlsld_got_offset.  Update all refs.
492         (Target_powerpc::Relocate::enum skip_tls): New.
493         (Target_powerpc::call_tls_get_addr_): New var.
494         (Target_powerpc::is_branch_reloc): Move to file scope.
495         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
496         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
497         New functions.
498         (Target_powerpc::enum Got_type): Delete old values, add new ones.
499         (powerpc_info): Correct common_pagesize for ppc64.
500         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
501         (Powerpc_relocate_functions): Add overflow check enums and functions.
502         Add non-shift version of rela, rela_ua.  Delete all rel public
503         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
504         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
505         addr16_ha3, addr14 functions.
506         (Output_data_got_powerpc::add_constant_pair): New function.
507         (Output_data_got_powerpc::got_base_offset): Likewise.
508         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
509         (instruction constants): Sort, add some more.
510         (Output_data_glink::do_write): Add and use Address typedef.  Use
511         object->toc_base_offset() stub for 64-bit.
512         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
513         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
514         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
515         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
516         Always treat .opd relocs as against locally defined symbol.
517         Correct condition for RELATIVE relocs.
518         (Target_powerpc::do_finalize_sections): Test for NULL sections.
519         (Target_powerpc::Relocate::relocate): Use plt call stub as value
520         for 32-bit syms with a plt entry.  Correct ppc64 toc base
521         calculations.  Handle TLS relocs, and more.  Add overflow
522         checking and adjust for Powerpc_relocate_functions changes.
523         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
524         Reinstate --emit-relocs code with FIXME.
525
526 2012-08-30  Alan Modra  <amodra@gmail.com>
527
528         * layout.cc (Layout::set_segment_offsets): Set p_align to
529         abi_pagesize, not common_pagesize.
530         (Layout::relaxation_loop_body): Similarly use abi_pagesize
531         to determine whether file header can go in segment.
532
533 2012-08-30  Alan Modra  <amodra@gmail.com>
534
535         * output.h (Output_reloc::Output_reloc <output section>): Add
536         is_relative param.  Adjust calls.
537         (Output_reloc::add_output_section_relative): New functions.
538         * output.cc (Output_reloc::Output_reloc <output section>): Handle
539         is_relative.
540         (Output_reloc::symbol_value): Handle SECTION_CODE.
541
542 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
543
544         * gold.cc (queue_middle_tasks): Call layout again when unique
545         segments for sections is desired.
546         * layout.cc (Layout::Layout): Initialize new members.
547         (Layout::get_output_section_flags): New function.
548         (Layout::choose_output_section): Call get_output_section_flags.
549         (Layout::layout): Make output section for mapping to a unique segment.
550         (Layout::insert_section_segment_map): New function.
551         (Layout::attach_allocated_section_to_segment): Make unique segment for
552         output sections marked so.
553         (Layout::segment_precedes): Check for unique segments when sorting.
554         * layout.h (Layout::Unique_segment_info): New struct.
555         (Layout::Section_segment_map): New typedef.
556         (Layout::insert_section_segment_map): New function.
557         (Layout::get_output_section_flags): New function.
558         (Layout::is_unique_segment_for_sections_specified): New function.
559         (Layout::set_unique_segment_for_sections_specified): New function.
560         (Layout::unique_segment_for_sections_specified_): New member.
561         (Layout::section_segment_map_): New member.
562         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
563         Rename is_gc_pass_one to is_pass_one.
564         Rename is_gc_pass_two to is_pass_two.
565         Rename is_gc_or_icf to is_two_pass.
566         Check for which pass based on whether symbols data is present.
567         Make it two pass when unique segments for sections is desired.
568         * output.cc (Output_section::Output_section): Initialize new
569         members.
570         * output.h (Output_section::is_unique_segment): New function.
571         (Output_section::set_is_unique_segment): New function.
572         (Output_section::is_unique_segment_): New member.
573         (Output_section::extra_segment_flags): New function.
574         (Output_section::set_extra_segment_flags): New function.
575         (Output_section::extra_segment_flags_): New member.
576         (Output_section::segment_alignment): New function.
577         (Output_section::set_segment_alignment): New function.
578         (Output_section::segment_alignment_): New member.
579         (Output_segment::Output_segment): Initialize is_unique_segment_.
580         (Output_segment::is_unique_segment): New function.
581         (Output_segment::set_is_unique_segment): New function.
582         (Output_segment::is_unique_segment_): New member.
583         * plugin.cc (allow_unique_segment_for_sections): New function.
584         (unique_segment_for_sections): New function.
585         (Plugin::load): Add new functions to transfer vector.
586         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
587         * Makefile.in: Regenerate.
588         * testsuite/plugin_final_layout.sh: Check if unique segment
589         functionality works.
590         * testsuite/plugin_section_order.c (onload): Check if new interfaces
591         are available.
592         (allow_unique_segment_for_sections): New global.
593         (unique_segment_for_sections): New global.
594         (claim_file_hook): Call allow_unique_segment_for_sections.
595         (all_symbols_read_hook): Call unique_segment_for_sections.
596
597 2012-08-22  Cary Coutant  <ccoutant@google.com>
598
599         * layout.cc (Layout::include_section): Don't assert on GROUP
600         sections with --emit-relocs.
601
602 2012-08-21  Cary Coutant  <ccoutant@google.com>
603
604         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
605         if --export-dynamic-symbol names an undef symbol.
606
607 2012-08-18  Alan Modra  <amodra@gmail.com>
608
609         * powerpc.cc: Formatting and white space.
610         (Powerpc_relobj): Rename got2_section_ to special_.
611         Add opd_ent_shndx_ and opd_ent_off_ vectors.
612         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
613         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
614         (Target_powerpc): Add Address typedef and invalid_address.  Use
615         throughout.
616         (Target_powerpc::is_branch_reloc): New function.
617         (Powerpc_relocate_functions): Add Address typedef, use throughout.
618         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
619         for dst_mask, value and addend.
620         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
621         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
622         (Output_data_glink::do_write): Correct toc base.  Don't try to use
623         uint16_t for 24-bit offset.  Use get_output_section_offset and
624         check return.
625         (Target_powerpc::Scan::local): Handle more relocs.
626         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
627         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
628         Plug in toc restoring insn after plt calls.  Translate branches
629         to function descriptor symbols to corresponding entry point.
630         (Target_powerpc::relocate_for_relocatable): Check return from
631         get_output_section_offset.
632         * symtab.h: Comment typo.
633
634 2012-08-14  Ian Lance Taylor  <iant@google.com>
635
636         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
637         unsupported_relocal_local to call unsupported_reloc_global.
638
639 2012-08-14  Nick Clifton  <nickc@redhat.com>
640
641         PR ld/14265
642         * script-sections.cc (Sections_element::output_section_name): Add
643         keep return parameter.
644         (Output_section_element::match_name): Add keep return parameter.
645         Return the value of the keep_ member.
646         * script-sections.h (class Output_section): Update
647         output_section_name prototype.
648         * layout.cc (Layout::keep_input_section): New public member
649         function.
650         (Layout::choose_output_section): Pass keep parameter to
651         output_section_name.
652         * layout.h (class Layout): Add keep_input_section.
653         * object.cc (Sized_relobj_file::do_layout): Check for kept input
654         sections.
655         * testsuite/Makefile.am: Add a test.
656         * testsuite/Makefile.in: Regenerate.
657         * testsuite/pr14265.c: Source file for the test.
658         * testsuite/pr14265.t: Linker script for the test.
659         * testsuite/pr14265.sh: Shell script for the test.
660
661 2012-08-14  Alan Modra  <amodra@gmail.com>
662
663         * target.h (Target::output_section_name): New function.
664         (Target::do_output_section_name): New function.
665         * layout.cc (Layout::choose_output_section): Call the above.
666         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
667
668 2012-08-14  Alan Modra  <amodra@gmail.com>
669
670         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
671         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
672         for replace_constant call.
673         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
674         (Output_data_glink::do_print_to_mapfile): New function.
675         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
676         (Target_powerpc::Relocate::relocate): Likewise.
677
678 2012-08-14  Alan Modra  <amodra@gmail.com>
679
680         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
681         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
682         (Output_data_glink::add_entry,find_entry): Remove shndx param.
683         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
684         all references to shndx_.  Handle special case for R_PPC_PLTREL24
685         here.
686         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
687         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
688         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
689         here.
690         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
691         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
692
693 2012-08-12  Alan Modra  <amodra@gmail.com>
694
695         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
696         (glink insn constants): Use uint32_t.
697         (Output_data_glink::add_entry): Use insert, not [] operator.
698
699 2012-08-11  Alan Modra  <amodra@gmail.com>
700
701         * object.h (Sized_relobj_file::find_shdr): New function.
702         (Sized_relobj_file::find_special_sections): New function.
703         * object.cc (Sized_relobj_file::find_shdr): New function.
704         (Sized_relobj_file::find_eh_frame): Use find_shdr.
705         (Sized_relobj_file::find_special_sections): New function, split out..
706         (Sized_relobj_file::do_read_symbols): ..from here.
707         * output.h (Output_data_got::replace_constant): New function.
708         (Output_data_got::num_entries): New function.
709         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
710         (Output_data_got::got_offset): Protected rather than private.
711         (Output_data_got::replace_got_entry): New function.
712         * output.cc (Output_data_got::replace_got_entry): New function.
713         * powerpc.cc (class Powerpc_relobj): New.
714         (class Powerpc_relocate_functions): Delete all psymval variants or
715         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
716         Implement _ha functions using corresponding _hi function.
717         (Powerpc_relobj::find_special_sections): New function.
718         (Target_powerpc::do_make_elf_object): New function.
719         (class Output_data_got_powerpc): New.
720         (class Output_data_glink): New.
721         (class Powerpc_scan_relocatable_reloc): New.
722         Many more changes througout file.
723
724 2012-08-09  Nick Clifton  <nickc@redhat.com>
725
726         * po/vi.po: Updated Vietnamese translation.
727
728 2012-08-07  Ian Lance Taylor  <iant@google.com>
729
730         * layout.cc (Layout::add_target_dynamic_tags): If
731         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
732         plt_rel.
733
734 2012-07-30  Nick Clifton  <nickc@redhat.com>
735
736         * po/gold.pot: Updated template.
737         * po/es.po: Updated Spanish translation.
738
739 2012-07-18  Cary Coutant  <ccoutant@google.com>
740
741         PR gold/14344
742         * configure.ac: Add check for -gpubnames support.
743         * configure: Regenerate.
744         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
745         support; force -gno-pubnames.
746         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
747         support.
748         (gdb_index_test_4): New test.
749         * testsuite/Makefile.in: Regenerate.
750         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
751         * testsuite/gdb_index_test_2.sh: Likewise.
752         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
753         * testsuite/gdb_index_test_4.sh: New script.
754         * testsuite/gdb_index_test_comm.sh: New script with common code;
755         don't look for space after colon.
756
757 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
758
759         * gold.cc (queue_middle_tasks): Update function order only after
760         deferred objects due to plugins are processed.
761
762 2012-07-11  Ian Lance Taylor  <iant@google.com>
763
764         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
765         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
766         (Target_arm::scan_reloc_for_stub): Likewise.
767         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
768         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
769         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
770         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
771         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
772
773 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
774             Ian Lance Taylor  <iant@google.com>
775
776         PR gold/14309
777         * configure.ac: Test whether std::tr1::hash<off_t> works.
778         * gold.h: Add a specialization for std::tr1::hash<off_t> if
779         needed.
780         * output.h (class Output_fill): Add virtual destructor.
781         * configure, config.in: Rebuild.
782
783 2012-06-22  Roland McGrath  <mcgrathr@google.com>
784
785         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
786
787 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
788
789         * plugin.cc (Plugin::load): Handle position independent executables.
790
791 2012-06-06  Cary Coutant  <ccoutant@google.com>
792
793         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
794         add .debug_macro.
795         (lines_only_debug_sections): Likewise.
796         (gdb_fast_lookup_sections): New static array.
797         (is_gdb_debug_section): Rename formal parameter.
798         (is_lines_only_debug_section): Likewise.
799         (is_gdb_fast_lookup_section): New function.
800         (Layout::include_section): Check for ".zdebug_" prefix; pass
801         section name suffix to is_gdb_debug_section, et al.; check for
802         fast-lookup sections when building .gdb_index.
803         * options.h (--strip-debug-gdb): Update GDB version number.
804
805 2012-06-06  Cary Coutant  <ccoutant@google.com>
806
807         * configure.ac: Add check for fallocate.
808         * configure: Regenerate.
809         * config.in: Regenerate.
810
811         * options.h (class General_options): Add --mmap-output-file and
812         --posix-fallocate options.
813         * output.cc: (posix_fallocate): Remove; replace with...
814         (gold_fallocate): New function.
815         (Output_file::map_no_anonymous): Call gold_fallocate.
816         (Output_file::map): Check --mmap-output-file option.
817
818 2012-06-05  Jing Yu  <jingyu@google.com>
819
820         * gold.h (textdomain): Add do {} to empty while(0).
821         (bindtextdomain): Likewise.
822
823 2012-06-04  Cary Coutant  <ccoutant@google.com>
824
825         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
826         has_dynsym_index.
827
828 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
829
830         * symtab.cc (Symbol_table::define_special_symbol):
831         Initialize *poldsym to prevent uninitialized variable errors.
832
833 2012-05-23  Cary Coutant  <ccoutant@google.com>
834
835         * layout.cc (Layout::section_name_mapping): Add rules to handle
836         exact match on .data.rel.ro.local or .data.rel.ro.
837         (Layout::output_section_name): Check for exact matches.
838
839 2012-05-23  Cary Coutant  <ccoutant@google.com>
840
841         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
842         more carefully.
843
844 2012-05-22  Cary Coutant  <ccoutant@google.com>
845
846         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
847         object before exporting symbol.
848
849 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
850
851         * testsuite/tls_test.cc: Include "config.h" first.
852         * testsuite/tls_test_c.c: Likewise.
853
854 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
855             Nick Clifton  <nickc@redhat.com>
856
857         PR 14072
858         * configure.in: Add check that sysdep.h has been included before
859         any system header files.
860         * configure: Regenerate.
861         * config.in: Regenerate.
862
863 2012-05-14  Cary Coutant  <ccoutant@google.com>
864
865         * layout.cc (Layout::make_output_section): Mark .tdata section
866         as RELRO.
867         * testsuite/relro_test.cc: Add a TLS variable.
868
869 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
870
871         PR gold/14091
872         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
873         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
874         R_X86_64_64.
875
876 2012-05-08  Cary Coutant  <ccoutant@google.com>
877
878         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
879         (lines_only_debug_sections): Likewise.
880
881 2012-05-02  Roland McGrath  <mcgrathr@google.com>
882
883         * nacl.cc: New file.
884         * nacl.h: New file.
885         * Makefile.am (CCFILES, HFILES): Add them.
886         * Makefile.in: Regenerate.
887         * i386.cc (Output_data_plt_i386_nacl): New class.
888         (Output_data_plt_i386_nacl_exec): New class.
889         (Output_data_plt_i386_nacl_dyn): New class.
890         (Target_i386_nacl): New class.
891         (Target_selector_i386_nacl): New class.
892         (target_selector_i386): Use it instead of Target_selector_i386.
893         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
894         (Target_x86_64_nacl): New class.
895         (Target_selector_x86_64_nacl): New class.
896         (target_selector_x86_64, target_selector_x32): Use it instead of
897         Target_selector_x86_64.
898         * arm.cc (Output_data_plt_arm_nacl): New class.
899         (Target_arm_nacl): New class.
900         (Target_selector_arm_nacl): New class.
901         (target_selector_arm, target_selector_armbe): Use it instead of
902         Target_selector_arm.
903
904         * target-select.cc (select_target): Take new Input_file* and off_t
905         arguments, pass them on to recognize method of selector.
906         * object.cc (make_elf_sized_object): Update caller.
907         * parameters.cc (parameters_force_valid_target): Likewise.
908         * incremental.cc (make_sized_incremental_binary): Likewise.
909         * target-select.h: Update decl.
910         (Target_selector::recognize): Take new Input_file* argument,
911         pass it on to do_recognize.
912         (Target_selector::do_recognize): Take new Input_file* argument.
913         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
914         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
915         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
916         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
917
918         * target.h (Target::Target_info): New members isolate_execinstr
919         and rosegment_gap.
920         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
921         * arm.cc (Target_arm::arm_info): Update initializer.
922         * i386.cc (Target_i386::i386_info): Likewise.
923         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
924         * sparc.cc (Target_sparc::sparc_info): Likewise.
925         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
926         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
927         * layout.cc (Layout::attach_allocated_section_to_segment):
928         Take new const Target* argument.  If target->isolate_execinstr(), act
929         like --rosegment.
930         (Layout::find_first_load_seg): Take new const Target* argument;
931         if target->isolate_execinstr(), reject PF_X segments.
932         (Layout::relaxation_loop_body): Update caller.
933         (Layout::set_segment_offsets): If target->isolate_execinstr(),
934         reset file offset to zero when we hit LOAD_SEG, and then do a second
935         loop over the segments before LOAD_SEG to reassign offsets after
936         addresses have been determined.  Handle target->rosegment_gap().
937         (Layout::attach_section_to_segment): Take new const Target* argument;
938         pass it to attach_allocated_section_to_segment.
939         (Layout::make_output_section): Update caller.
940         (Layout::attach_sections_to_segments): Take new const Target* argument;
941         pass it to attach_section_to_segment.
942         * gold.cc (queue_middle_tasks): Update caller.
943         * layout.h (Layout): Update method decls with new arguments.
944
945         * arm.cc (Target_arm::Target_arm): Take optional argument for the
946         Target_info pointer to use.
947         (Target_arm::do_make_data_plt): New virtual method.
948         (Target_arm::make_data_plt): New method that calls it.
949         (Target_arm::make_plt_entry): Use it.
950         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
951         for the section alignment.
952         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
953         method.
954         (Output_data_plt_arm::first_plt_entry_offset): Call it.
955         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
956         method.
957         (Output_data_plt_arm::get_plt_entry_size): Call it.
958         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
959         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
960         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
961         method.
962         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
963         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
964         method instead of sizeof(plt_entry).
965         (Output_data_plt_arm::add_entry): Likewise.
966         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
967         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
968         than static method.
969         (Target_arm::plt_entry_size): Likewise.
970         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
971         Move to ...
972         (Output_data_plt_arm_standard): ... here, new class.
973         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
974         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
975         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
976
977         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
978         Take additional argument for the PLT entry size.
979         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
980         Use get_plt_entry_size method rather than plt_entry_size variable.
981         (Output_data_plt_x86_64::reserve_slot): Likewise.
982         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
983         (Output_data_plt_x86_64::add_entry): Likewise.
984         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
985         (Output_data_plt_x86_64::address_for_global): Likewise.
986         (Output_data_plt_x86_64::address_for_local): Likewise.
987         (Output_data_plt_x86_64::set_final_data_size): Likewise.
988         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
989         Make method non-static.
990         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
991         method.
992         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
993         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
994         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
995         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
996         virtual method.
997         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
998         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
999         virtual method.
1000         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1001         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1002         virtual method.
1003         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1004         (Output_data_plt_x86_64::plt_entry_size)
1005         (Output_data_plt_x86_64::first_plt_entry)
1006         (Output_data_plt_x86_64::plt_entry)
1007         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1008         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1009         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1010         (Output_data_plt_x86_64_standard): ... here, new class.
1011         (Target_x86_64::Target_x86_64): Take optional argument for the
1012         Target_info pointer to use.
1013         (Target_x86_64::do_make_data_plt): New virtual method.
1014         (Target_x86_64::make_data_plt): New method to call it.
1015         (Target_x86_64::init_got_plt_for_update): Use that.
1016         Call this->plt_->add_eh_frame method here.
1017         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1018         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1019         rather than static method.
1020         (Target_x86_64::plt_entry_size): Likewise.
1021         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1022         rather than plt_entry_size variable.  Move guts of PLT filling to...
1023         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1024         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1025         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1026
1027         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1028         additional argument for the section alignment.
1029         Don't do add_eh_frame_for_plt here.
1030         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1031         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1032         variable.
1033         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1034         method.
1035         (Output_data_plt_i386::get_plt_entry_size): Call it.
1036         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1037         (Output_data_plt_i386::add_eh_frame): New method to call it.
1038         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1039         method.
1040         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1041         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1042         method.
1043         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1044         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1045         method instead of plt_entry_size.
1046         (Output_data_plt_i386::plt_entry_size)
1047         (Output_data_plt_i386::plt_eh_frame_fde_size)
1048         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1049         (Output_data_plt_i386_standard): ... here, new class.
1050         (Output_data_plt_i386_exec): New class.
1051         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1052         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1053         (Output_data_plt_i386::exec_plt_entry): Move to ...
1054         (Output_data_plt_i386_exec::plt_entry): ... here.
1055         (Output_data_plt_i386_dyn): New class.
1056         (Output_data_plt_i386::first_plt_entry): Move to ...
1057         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1058         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1059         (Output_data_plt_i386_dyn::plt_entry): ... here.
1060         (Target_i386::Target_i386): Take optional argument for the Target_info
1061         pointer to use.
1062         (Target_i386::do_make_data_plt): New virtual method.
1063         (Target_i386::make_data_plt): New method to call it.
1064         (Target_i386::make_plt_section): Use that.
1065         Call this->plt_->add_eh_frame method here.
1066         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1067         rather than plt_entry_size variable.
1068         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1069         (Output_data_plt_i386::address_for_local): Likewise.
1070         (Output_data_plt_i386::do_write): Likewise.
1071         Move guts of PLT filling to...
1072         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1073         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1074         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1075         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1076
1077 2012-05-01  Cary Coutant  <ccoutant@google.com>
1078
1079         * dwarf_reader.cc (Dwarf_die::read_attributes)
1080         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1081         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1082         * reduced_debug_output.cc
1083         (Output_reduced_debug_info_section::get_die_end): Remove
1084         DW_FORM_GNU_ref_index.  Add default case.
1085
1086 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1087
1088         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1089         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1090         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1091         DW_AT_high_pc as offset from DW_AT_low_pc.
1092
1093         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1094         * testsuite/Makefile.in: Regenerate.
1095         * testsuite/gdb_index_test_3.c: New test source file.
1096         * testsuite/gdb_index_test_3.sh: New test source file.
1097
1098 2012-04-25  Ian Lance Taylor  <iant@google.com>
1099
1100         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1101         pointer.
1102         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1103         as a class, not a struct.
1104         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1105         (Target_arm::apply_cortex_a8_workaround): Likewise.
1106         * gc.h: Declare Reloc_types as a struct, not a class.
1107         * object.h: Declare Symbols_data as a struct.
1108         * reloc.h: Declare Read_relocs_data as a struct.
1109         * target.h: Declare Relocate_info as a struct.
1110
1111 2012-04-24  David S. Miller  <davem@davemloft.net>
1112
1113         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1114         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1115         and R_SPARC_WPLT30.
1116
1117 2012-04-24  Cary Coutant  <ccoutant@google.com>
1118
1119         * incremental-dump.cc (find_input_containing_global): Replace
1120         magic number with symbolic constant.
1121         (dump_incremental_inputs): Update version number.
1122         * incremental.cc (Output_section_incremental_inputs): Update version
1123         number; import symbolic constants from Incremental_inputs_reader.
1124         (Incremental_inputs::create_data_sections): Align relocations
1125         section correctly for 64-bit targets.
1126         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1127         constants; add padding.
1128         (Output_section_incremental_inputs::write_header): Add assert for
1129         header_size.
1130         (Output_section_incremental_inputs::write_input_files): Add assert
1131         for input_entry_size.
1132         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1133         add assert for object_info_size, input_section_entry_size,
1134         global_sym_entry_size.
1135         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1136         for data structure sizes; use them.
1137         (Incremental_input_entry_reader): Import symbolic constants from
1138         Incremental_inputs_reader; use them.
1139
1140 2012-04-23  David S. Miller  <davem@davemloft.net>
1141
1142         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1143         and elf_flags_set_.
1144         (Target_sparc::Target_sparc): Initialize new fields.
1145         (Target_sparc::do_make_elf_object): New function.
1146         (Target_sparc::do_adjust_elf_header): New function.
1147
1148 2012-04-23  Cary Coutant  <ccoutant@google.com>
1149
1150         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1151         CU range table of gdb index.
1152
1153 2012-04-20  David S. Miller  <davem@davemloft.net>
1154
1155         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1156         instead of false.
1157
1158 2012-04-16  David S. Miller  <davem@davemloft.net>
1159
1160         * sparc.cc (Target_sparc::got_address): New function.
1161         (Sparc_relocate_functions::gdop_hix22): New function.
1162         (Sparc_relocate_functions::gdop_lox10): New function.
1163         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1164         relocs.
1165         (Target_sparc::Scan::local): Likewise if the global symbol is not
1166         preemptible and is not IFUNC.
1167         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1168         transformations for local and non-preemptible non-IFUNC global
1169         symbols.
1170
1171         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1172         writing out 64-bit part of ranges.
1173
1174         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1175         -fpic and -fpie respectively.
1176         * Makefile.in: Regenerate.
1177
1178         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1179         (Target_sparc::Target_sparc): Initialize new field.
1180         (Target_sparc::do_plt_section_for_global): New function.
1181         (Target_sparc::do_plt_section_for_local): New function.
1182         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1183         (Target_sparc::make_plt_section): New function, broken out of
1184         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1185         (Target_sparc::make_plt_entry): Call make_plt_section.
1186         (Target_sparc::make_local_ifunc_plt_entry): New function.
1187         (Target_sparc::rela_ifunc_section): New function.
1188         (Target_sparc::plt_section): Remove const.
1189         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1190         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1191         and ifunc_count_ fields.
1192         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1193         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1194         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1195         (Output_data_plt_sparc::rela_ifunc): New function.
1196         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1197         (Output_data_plt_sparc::has_ifunc_section): New function.
1198         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1199         (Output_data_plt_sparc::address_for_global): New function.
1200         (Output_data_plt_sparc::address_for_local): New function.
1201         (Output_data_plt_sparc::plt_index_to_offset): New function.
1202         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1203         and entry_count.
1204         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1205         entry_count.
1206         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1207         R_SPARC_JMP_IREL to switch.
1208         (Target_sparc::Scan::check_non_pic): Likewise.
1209         (Target_sparc::Scan::local): Handle IFUNC symbols.
1210         (Target_sparc::Scan::local): Likewise.
1211         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1212         and plt_address_for_local.
1213         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1214         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1215
1216         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1217         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1218         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1219         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1220         global relocs too.
1221         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1222         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1223         calls.
1224         * sparc.cc (Target_sparc::Scan::global): Likewise.
1225         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1226
1227 2012-04-16  Cary Coutant  <ccoutant@google.com>
1228
1229         * archive.cc (Library_base::should_include_member): Check for
1230         --export-dynamic-symbol.
1231         * options.h (class General_options): Add --export-dynamic-symbol.
1232         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1233         --export-dynamic-symbol.
1234         (Symbol_table::gc_mark_undef_symbols): Likewise.
1235         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1236
1237 2012-04-12  David S. Miller  <davem@davemloft.net>
1238
1239         * sparc.cc (Reloc::wdisp10): New relocation method.
1240         (Reloc::h34): Likewise.
1241         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1242         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1243         R_SPARC_WDISP10.
1244         (Target_sparc::Scan::local): Likewise.
1245         (Target_sparc::Scan::global): Likewise.
1246         (Target_sparc::Relocate::relocate): Likewise.
1247
1248 2012-04-09  Cary Coutant  <ccoutant@google.com>
1249
1250         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1251         low_pc == 0.
1252
1253 2012-04-06  Ian Lance Taylor  <iant@google.com>
1254
1255         * timer.cc: #include <unistd.h>.
1256
1257 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1258
1259         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1260         * config.in: Regenerate.
1261         * configure: Regenerate.
1262
1263 2012-04-05  Nick Clifton  <nickc@redhat.com>
1264
1265         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1266         (AM_LC_MESSAGES): Add.
1267         * aclocal.m4: Regenerate.
1268         * config.in: Regenerate.
1269         * configure: Regenerate.
1270
1271 2012-03-21  Cary Coutant  <ccoutant@google.com>
1272
1273         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1274         * Makefile.in: Regenerate.
1275         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1276         (Sized_elf_reloc_mapper::symbol_section): New function.
1277         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1278         (make_elf_reloc_mapper): New function.
1279         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1280         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1281         (Dwarf_abbrev_table::do_get_abbrev): New function.
1282         (Dwarf_ranges_table::read_ranges_table): New function.
1283         (Dwarf_ranges_table::read_range_list): New function.
1284         (Dwarf_pubnames_table::read_section): New function.
1285         (Dwarf_pubnames_table::read_header): New function.
1286         (Dwarf_pubnames_table::next_name): New function.
1287         (Dwarf_die::Dwarf_die): New function.
1288         (Dwarf_die::read_attributes): New function.
1289         (Dwarf_die::skip_attributes): New function.
1290         (Dwarf_die::set_name): New function.
1291         (Dwarf_die::set_linkage_name): New function.
1292         (Dwarf_die::attribute): New function.
1293         (Dwarf_die::string_attribute): New function.
1294         (Dwarf_die::int_attribute): New function.
1295         (Dwarf_die::uint_attribute): New function.
1296         (Dwarf_die::ref_attribute): New function.
1297         (Dwarf_die::child_offset): New function.
1298         (Dwarf_die::sibling_offset): New function.
1299         (Dwarf_info_reader::check_buffer): New function.
1300         (Dwarf_info_reader::parse): New function.
1301         (Dwarf_info_reader::do_parse): New function.
1302         (Dwarf_info_reader::do_read_string_table): New function.
1303         (Dwarf_info_reader::lookup_reloc): New function.
1304         (Dwarf_info_reader::get_string): New function.
1305         (Dwarf_info_reader::visit_compilation_unit): New function.
1306         (Dwarf_info_reader::visit_type_unit): New function.
1307         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1308         Sized_elf_reloc_mapper.
1309         (Sized_dwarf_line_info::symbol_section): Remove function.
1310         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1311         (Sized_dwarf_line_info::read_line_mappings): Remove object
1312         parameter, adjust callers.
1313         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1314         * dwarf_reader.h: Include <sys/types.h>.
1315         (class Track_relocs): Remove forward declaration.
1316         (class Elf_reloc_mapper): New class.
1317         (class Sized_elf_reloc_mapper): New class.
1318         (class Dwarf_abbrev_table): New class.
1319         (class Dwarf_range_list): New class.
1320         (class Dwarf_ranges_table): New class.
1321         (class Dwarf_pubnames_table): New class.
1322         (class Dwarf_die): New class.
1323         (class Dwarf_info_reader): New class.
1324         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1325         (Sized_dwarf_line_info::symbol_section): Remove member function.
1326         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1327         base class.
1328         * gdb-index.cc: New source file.
1329         * gdb-index.h: New source file.
1330         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1331         and .debug_types sections, call Layout::add_to_gdb_index.
1332         (Sized_relobj_incr::do_section_name): Implement.
1333         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1334         return type; Implement.
1335         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1336         return type.
1337         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1338         parameter list and return type.
1339         (Sized_incr_dynobj::do_section_contents): Likewise.
1340         * layout.cc: Include gdb-index.h.
1341         (Layout::Layout): Initialize gdb_index_data_.
1342         (Layout::init_fixed_output_section): Check for .gdb_index section.
1343         (Layout::add_to_gdb_index): New function. Instantiate.
1344         * layout.h: Add forward declaration for class Gdb_index.
1345         (Layout::add_to_gdb_index): New member function.
1346         (Layout::gdb_index_data_): New data member.
1347         * main.cc: Include gdb-index.h.
1348         (main): Print statistics for gdb index.
1349         * object.cc (Object::section_contents): Move code into
1350         do_section_contents.
1351         (need_decompressed_section): Check for sections needed when building
1352         gdb index.
1353         (build_compressed_section_map): Likewise.
1354         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1355         gdb index.
1356         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1357         sections; call Layout::add_to_gdb_index.
1358         (Sized_relobj_file::do_decompressed_section_contents): Call
1359         do_section_contents directly.
1360         * object.h (Object::do_section_contents): Adjust parameter list and
1361         return type.
1362         (Object::do_decompressed_section_contents): Call do_section_contents
1363         directly.
1364         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1365         return type.
1366         * options.h (class General_options): Add --gdb-index option.
1367         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1368         list and return type.
1369         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1370         * reloc.h (Track_relocs::checkpoint): New function.
1371         (Track_relocs::reset): New function.
1372
1373         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1374         New test cases.
1375         * testsuite/Makefile.in: Regenerate.
1376         * testsuite/gdb_index_test.cc: New test source file.
1377         * testsuite/gdb_index_test_1.sh: New test source file.
1378         * testsuite/gdb_index_test_2.sh: New test source file.
1379
1380 2012-03-19  Doug Kwan  <dougkwan@google.com>
1381
1382         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1383         (Target_arm::do_finalize_sections): Remove code which defines
1384         __exidx_start and __exidx_end.  Make symbol table parameter
1385         anonymous as it is not used.
1386         * gold.cc (queue_middle_tasks): Call target hook to define any
1387         target-specific symbols.
1388         * target.h (Target::define_standard_symbols): New method.
1389         (Target::do_define_standard_symbols): Same.
1390         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1391         * testsuite/Makefile.in: Regenerate.
1392         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1393         and __exidx_end.
1394         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1395         relocations are generated for __exidx_start and __exidx_end.
1396
1397 2012-03-16  Doug Kwan  <dougkwan@google.com>
1398
1399         * testsuite/Makefile.am: Disable test initpri3b.
1400         * testsuite/Makefile.in: Regenerate.
1401
1402 2012-03-15  Doug Kwan  <dougkwan@google.com>
1403
1404         * arm.cc (Target_arm::got_section): Make .got section read-only
1405         if -z now is given.
1406
1407 2012-03-15  Ian Lance Taylor  <iant@google.com>
1408
1409         PR gold/13850
1410         * layout.cc (Layout::make_output_section): Correctly mark
1411         SHT_INIT_ARRAY, et. al., as relro.
1412
1413 2012-03-14  Doug Kwan  <dougkwan@google.com>
1414
1415         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1416         dynamic relocations for protected symbols in shared objects.
1417
1418 2012-03-13  Ian Lance Taylor  <iant@google.com>
1419
1420         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1421         keep the larger alignment.
1422
1423 2012-03-12  Cary Coutant  <ccoutant@google.com>
1424
1425         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1426         handling of DW_LNE_define_file.
1427
1428 2012-03-12  Cary Coutant  <ccoutant@google.com>
1429
1430         * reduced_debug_output.cc
1431         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1432         codes to switch.
1433
1434 2012-02-29  Cary Coutant  <ccoutant@google.com>
1435
1436         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1437
1438 2012-02-29  Cary Coutant  <ccoutant@google.com>
1439
1440         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1441         Call Object::decompressed_section_contents.
1442         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1443         New dtor.
1444         (Sized_dwarf_line_info::buffer_start_): New data member.
1445         * merge.cc (Output_merge_data::do_add_input_section): Call
1446         Object::decompressed_section_contents.
1447         (Output_merge_string::do_add_input_section): Likewise.
1448         * object.cc (need_decompressed_section): New function.
1449         (build_compressed_section_map): Decompress sections needed later.
1450         (Sized_relobj_file::do_decompressed_section_contents): New function.
1451         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1452         * object.h (Object::decompressed_section_contents): New function.
1453         (Object::discard_decompressed_sections): New function.
1454         (Object::do_decompressed_section_contents): New function.
1455         (Object::do_discard_decompressed_sections): New function.
1456         (Compressed_section_info): New type.
1457         (Compressed_section_map): Include decompressed section contents.
1458         (Sized_relobj_file::do_decompressed_section_contents): New function.
1459         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1460
1461 2012-02-16  Cary Coutant  <ccoutant@google.com>
1462
1463         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1464         * testsuite/Makefile.in: Regenerate.
1465
1466 2012-02-14  Cary Coutant  <ccoutant@google.com>
1467
1468         * options.cc (General_options::finalize): Disallow -pie and -static.
1469
1470 2012-02-03  Doug Kwan  <dougkwan@google.com>
1471
1472         * arm.cc (Arm_relocate_functions::abs8,
1473         Arm_relocate_functions::abs16): Use
1474         Bits::has_signed_unsigned_overflow32.
1475         (Arm_relocate_functions::thm_abs8): Correct range of
1476         overflow check.
1477         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1478         in assertions.
1479
1480 2012-02-02  Doug Kwan  <dougkwan@google.com>
1481
1482         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1483         position independent outputs, not just shared objects.
1484
1485 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1486
1487         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1488         * configure: Regenerated.
1489
1490 2012-01-27  Ian Lance Taylor  <iant@google.com>
1491
1492         * reloc.h (Bits): New class with static functions, copied from
1493         namespace utils in arm.cc.
1494         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1495         instead.
1496
1497 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1498
1499         * incremental.cc (write_info_blocks): Correct relocation offset.
1500
1501 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1502
1503         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1504         (Relocate::tls_gd_to_le): Likewise.
1505
1506 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1507
1508         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1509
1510 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1511
1512         * configure.ac: Check if -mcmodel=medium works.
1513         * configure: Regenerated.
1514
1515 2012-01-24  Cary Coutant  <ccoutant@google.com>
1516
1517         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1518         definition and ...
1519         (read_unsigned_LEB_128_x): ... this new function.
1520         (read_signed_LEB_128): Replaced with inline definition and ...
1521         (read_signed_LEB_128_x): ... this new function.
1522         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1523         (read_unsigned_LEB_128): Add inline definition.
1524         (read_signed_LEB_128_x): New function.
1525         (read_signed_LEB_128): Add inline definition.
1526         * testsuite/Makefile.am (leb128_unittest): New unit test.
1527         * testsuite/Makefile.in: Regenerate.
1528         * testsuite/leb128_unittest.cc: New unit test.
1529
1530 2012-01-23  Ian Lance Taylor  <iant@google.com>
1531
1532         PR gold/13617
1533         * i386.cc (Target_i386::do_code_fill): When using a jmp
1534         instruction, pad with nop instructions.
1535         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1536
1537 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1538
1539         * x86_64.cc (gc_process_relocs): Add typename on types used in
1540         template.
1541         (scan_relocs): Likewise.
1542         (relocate_section): Likewise.
1543         (apply_relocation): Likewise.
1544
1545 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1546
1547         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1548         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1549         under x32.
1550
1551 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1552
1553         * x86_64.cc: Initial support for x32.
1554
1555 2012-01-03  Cary Coutant  <ccoutant@google.com>
1556
1557         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1558         Use abstract base class for GOT.
1559         * gold/output.h (class Output_data_got_base): New abstract base class.
1560         (class Output_data_got): Derive from new base class, adjust ctors.
1561         (Output_data_got::reserve_slot): Make virtual; rename to
1562         do_reserve_slot; Adjust callers.
1563         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1564         pointer to abstract base class.
1565         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1566
1567 2011-12-18  Ian Lance Taylor  <iant@google.com>
1568
1569         * object.h (Relobj::local_symbol_value): New function.
1570         (Relobj::local_plt_offset): New function.
1571         (Relobj::local_has_got_offset): New function.
1572         (Relobj::local_got_offset): New function.
1573         (Relobj::set_local_got_offset): New function.
1574         (Relobj::do_local_symbol_value): New pure virtual function.
1575         (Relobj::do_local_plt_offset): Likewise.
1576         (Relobj::do_local_has_got_offset): Likewise.
1577         (Relobj::do_local_got_offset): Likewise.
1578         (Relobj::do_set_local_got_offset): Likewise.
1579         (Sized_relobj::do_local_has_got_offset): Rename from
1580         local_has_got_offset.
1581         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1582         (Sized_relobj::do_set_local_got_offset): Rename from
1583         set_local_got_offset.
1584         (Sized_relobj_file::do_local_plt_offset): Rename from
1585         local_plt_offset.
1586         (Sized_relobj_file::do_local_symbol_value): New function.
1587         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1588         local_plt_offset.
1589         * output.cc (Output_data_got::Got_entry::write): Change object to
1590         Relobj.  Use local_symbol_value.
1591         (Output_data_got::add_global_with_rel): Change rel_dyn to
1592         Output_data_reloc_generic*.  Use add_global_generic.
1593         (Output_data_got::add_global_with_rela): Remove.  Change all
1594         callers to use add_global_with_rel.
1595         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1596         Output_data_reloc_generic*.  Use add_global_generic.
1597         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1598         callers to use add_global_pair_with_rel.
1599         (Output_data_got::add_local): Change object to Relobj*.
1600         (Output_data_got::add_local_plt): Likewise.
1601         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1602         change rel_dyn to Output_data_reloc_generic*.  Use
1603         add_local_generic.
1604         (Output_data_got::add_local_with_rela): Remove.  Change all
1605         callers to use all_local_with_rel.
1606         (Output_data_got::add_local_pair_with_rel): Change object to
1607         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1608         add_output_section_generic.
1609         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1610         callers to use add_local_pair_with_rel.
1611         (Output_data_got::reserve_local): Change object to Relobj*.
1612         * output.h: (class Output_data_reloc_generic): Add pure virtual
1613         declarations for add_global_generic, add_local_generic,
1614         add_output_section_generic.
1615         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1616         functions for Output_data_reloc_generic.  Update declarations for
1617         changes listed in output.cc.
1618         (class Output_data_got): Change template parameter to got_size.
1619         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1620         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1621         function.
1622         (Sized_relobj_incr::do_local_plt_offset): New function.
1623         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1624         add_global_generic.
1625
1626 2011-12-17  Cary Coutant  <ccoutant@google.com>
1627
1628         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1629         * resolve.cc (Symbol_table::resolve): Likewise.
1630         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1631         arrays.
1632         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1633
1634 2011-12-16  Ian Lance Taylor  <iant@google.com>
1635
1636         * output.h (Output_data_reloc_generic::add): Only call
1637         add_dynamic_reloc if this is a dynamic reloc section.
1638
1639 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1640
1641         PR gold/13505
1642         * target-reloc.h (apply_relocation): Replace <64, false> with
1643         <size, big_endian>.
1644
1645 2011-11-25  Nick Clifton  <nickc@redhat.com>
1646
1647         * po/it.po: New Italian translation.
1648
1649 2011-11-17  Sterling Augustine  <saugustine@google.com>
1650
1651         * script.cc (script_include_directive): Implement.
1652         (read_script_file): New local variables name and search_path. Update
1653         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1654         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1655         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1656
1657 2011-11-11  Sterling Augustine  <saugustine@google.com>
1658
1659         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1660         (file_or_sections_cmd): Likewise.
1661
1662 2011-11-11  Doug Kwan  <dougkwan@google.com>
1663
1664         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1665         if --just-symbols is given.
1666
1667 2011-11-10  Doug Kwan  <dougkwan@google.com>
1668
1669         PR gold/13362
1670         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1671         when processing data relocs.
1672         * reloc.h (Relocate_functions::rel_unaligned): New method.
1673         (Relocate_functions::pcrel_unaligned): Ditto.
1674         (Relocate_functions::rel32_unaligned): Ditto.
1675         (Relocate_functions::pcrel32_unaligned): Ditto.
1676
1677 2011-11-09  Doug Kwan  <dougkwan@google.com>
1678
1679         PR gold/13362
1680         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1681         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1682         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1683         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1684         (Relocate_functions::rel_unaligned): New.
1685         (Relocate_functions::rel32_unaligned): New.
1686         * target-reloc.h (relocate_for_relocatable): Add code to handle
1687         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1688         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1689         arm_unaligned_reloc_r): New targets.
1690         * testsuite/Makefile.in: Regenerate.
1691         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1692         linking.
1693
1694 2011-11-02  Ian Lance Taylor  <iant@google.com>
1695
1696         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1697         NATIVE_LINKER.
1698         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1699         * options.cc (General_options::finalize): Use library search path
1700         from configure script if specified.  If not native and no sysroot,
1701         only search TOOLLIBDIR.
1702         * options.h (Search_directory::Search_directory): Change name to
1703         const std::string&.
1704         (General_options::add_to_library_path_with_sysroot): Change arg to
1705         const std::string&.
1706         * configure, Makefile.in, config.in: Rebuild.
1707
1708 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1709
1710         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1711         we are working around the ARM1176 Erratum.
1712         * options.h (General_options::fix_arm1176): Add option.
1713         * testsuite/Makefile.am: Add testcases, and keep current ones
1714         working.
1715         * testsuite/Makefile.in: Regenerate.
1716         * testsuite/arm_fix_1176.s: New file.
1717         * testsuite/arm_fix_1176.sh: Likewise.
1718
1719 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1720
1721         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1722         may_use_blx_.
1723         (Target_arm::may_use_blx): Remove method.
1724         (Target_arm::set_may_use_blx): Likewise.
1725         (Target_arm::may_use_v4t_interworking): New method.
1726         (Target_arm::may_use_v5t_interworking): Likewise.
1727         (Target_arm::may_use_blx_): Remove member variable.
1728         (Arm_relocate_functions::arm_branch_common): Check for v5T
1729         interworking.
1730         (Arm_relocate_functions::thumb_branch_common): Likewise.
1731         (Reloc_stub::stub_type_for_reloc): Likewise.
1732         (Target_arm::do_finalize_sections): Correct interworking checks.
1733         * testsuite/Makefile.am: Add new tests.
1734         * testsuite/Makefile.in: Regenerate.
1735         * testsuite/arm_farcall_arm_arm.s: New test.
1736         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1737         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1738         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1739         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1740         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1741         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1742         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1743
1744 2011-10-31  Cary Coutant  <ccoutant@google.com>
1745
1746         PR gold/13023
1747         * expression.cc (Expression::eval_with_dot): Add
1748         is_section_dot_assignment parameter.
1749         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1750         absolute and assigning to dot within a section.
1751         * script-sections.cc
1752         (Output_section_element_assignment::set_section_addresses): Pass
1753         dot_section to set_if_absolute.
1754         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1755         as is_section_dot_assignment flag to eval_with_dot.
1756         (Output_section_element_dot_assignment::set_section_addresses):
1757         Likewise.
1758         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1759         parameter.  Also set value if relative to dot_section; set the
1760         symbol's output_section.
1761         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1762         parameter.  Adjust all callers.
1763         (Expression::eval_maybe_dot): Likewise.
1764         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1765         Adjust all callers.
1766         * testsuite/script_test_2.t: Test assignment of an absolute value
1767         to dot within an output section element.
1768
1769 2011-10-31  Cary Coutant  <ccoutant@google.com>
1770
1771         * options.h (class General_options): Add --[no-]gnu-unique options.
1772         * symtab.cc (Symbol_table::sized_write_globals): Convert
1773         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1774
1775 2011-10-31  Cary Coutant  <ccoutant@google.com>
1776
1777         PR gold/13359
1778         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1779         unnecessary assertion.
1780         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1781
1782 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1783
1784         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1785         gc_mark_symbol.
1786         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1787         gc_mark_symbol.
1788         Change to just keep the section associated with symbol.
1789         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1790         they are externally visible and --export-dynamic is turned on.
1791         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1792
1793 2011-10-19  Ian Lance Taylor  <iant@google.com>
1794
1795         PR gold/13163
1796         * script-sections.cc
1797         (Output_section_element_dot_assignment::needs_output_section): New
1798         function.
1799
1800 2011-10-19  Ian Lance Taylor  <iant@google.com>
1801
1802         PR gold/13204
1803         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1804         --section-start option was seen.
1805         * options.h (General_options::any_section_start): New function.
1806
1807 2011-10-18  David S. Miller  <davem@davemloft.net>
1808
1809         PR binutils/13301
1810         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1811         member to track relocation locations that have moved during TLS
1812         reloc optimizations.
1813         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1814         (Target_sparc::Relocate::relocate): Adjust view down by 4
1815         bytes if it matches reloc_adjust_addr_.
1816         (Target_sparc::Relocate::relocate_tls): Always move the
1817         __tls_get_addr call delay slot instruction forward 4 bytes when
1818         performing relaxation.
1819
1820 2011-10-18  Cary Coutant  <ccoutant@google.com>
1821
1822         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1823         (Output_file::map_no_anonymous): Check for non-zero
1824         return code from posix_fallocate.
1825
1826 2011-10-17  Cary Coutant  <ccoutant@google.com>
1827
1828         PR gold/13245
1829         * plugin.cc (is_visible_from_outside): Check for symbols
1830         referenced from dynamic objects.
1831         * resolve.cc (Symbol_table::resolve): Don't count references
1832         from dynamic objects as references from real ELF files.
1833         * testsuite/plugin_test_2.sh: Adjust expected result.
1834
1835 2011-10-17  Cary Coutant  <ccoutant@google.com>
1836
1837         * gold.cc: Include timer.h.
1838         (queue_middle_tasks): Stamp time.
1839         (queue_final_tasks): Likewise.
1840         * main.cc (main): Store timer in parameters.  Print timers
1841         for each pass.
1842         * parameters.cc (Parameters::Parameters): Initialize timer_.
1843         (Parameters::set_timer): New function.
1844         (set_parameters_timer): New function.
1845         * parameters.h (Parameters::set_timer): New function.
1846         (Parameters::timer): New function.
1847         (Parameters::timer_): New data member.
1848         (set_parameters_timer): New function.
1849         * timer.cc (Timer::stamp): New function.
1850         (Timer::get_pass_time): New function.
1851         * timer.h (Timer::stamp): New function.
1852         (Timer::get_pass_time): New function.
1853         (Timer::pass_times_): New data member.
1854
1855 2011-10-17  Cary Coutant  <ccoutant@google.com>
1856
1857         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1858         task for members of lib groups.
1859
1860 2011-10-17  Cary Coutant  <ccoutant@google.com>
1861
1862         PR gold/13288
1863         * fileread.cc (File_read::find_view): Add assert.
1864         (File_read::make_view): Move bounds check (replace with assert)...
1865         (File_read::find_or_make_view): ... to here.
1866
1867 2011-10-12  Cary Coutant  <ccoutant@google.com>
1868
1869         * output.cc (Output_file::open_base_file): Handle case where
1870         ::read returns less than requested size.
1871
1872 2011-10-10  Cary Coutant  <ccoutant@google.com>
1873
1874         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1875         Initialize defined_count_.
1876         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1877         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1878         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1879         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1880         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1881         * incremental.h (Sized_relobj_incr::defined_count_): New data
1882         member.
1883         (Sized_incr_dynobj::defined_count_): New data member.
1884         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1885         Return zeroes instead of internal error.
1886
1887 2011-10-10  Cary Coutant  <ccoutant@google.com>
1888
1889         PR gold/13249
1890         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1891         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1892         * output.h (class Output_reloc): Add use_plt_offset flag.
1893         (Output_reloc::type_): Adjust size of bit field.
1894         (Output_reloc::use_plt_offset_): New bit field.
1895         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1896         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1897         flag.  Adjust all callers.
1898         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1899         creating RELATIVE relocations.
1900
1901 2011-10-10  Nick Clifton  <nickc@redhat.com>
1902
1903         * po/es.po: Updated Spanish translation.
1904         * po/fi.po: Updated Finnish translation.
1905
1906 2011-10-03   Diego Novillo  <dnovillo@google.com>
1907
1908         * options.cc (parse_uint): Fix dereference of RETVAL.
1909
1910 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1911
1912         * layout.h (section_order_map_): New member.
1913         (get_section_order_map): New member function.
1914         * output.cc (Output_section::add_input_section): Check for patterns
1915         only when --section-ordering-file is specified.
1916         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1917         output_sections have been formed.
1918         * layout.cc (Layout_Layout): Initialize section_order_map_.
1919         * plugin.cc (update_section_order): Store order in order_map. Do not
1920         update the order.
1921         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1922         * testsuite/Makefile.in: Regenerate.
1923         * testsuite/plugin_section_order.c: New file.
1924         * testsuite/plugin_final_layout.cc: New file.
1925         * testsuite/plugin_final_layout.sh: New file.
1926
1927 2011-09-29  Cary Coutant  <ccoutant@google.com>
1928
1929         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1930         Check for NULL.
1931         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1932         symbols during incremental update.
1933         (Symbol_table::add_from_dynobj): Likewise.
1934
1935 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1936             Ian Lance Taylor  <iant@google.com>
1937
1938         * symtab.cc (Symbol_table::define_special_symbol): Always
1939         canonicalize version string.
1940
1941 2011-09-26  Cary Coutant  <ccoutant@google.com>
1942
1943         * gold.cc (queue_initial_tasks): Move option checks ...
1944         * options.cc (General_options::finalize): ... to here. Disable
1945         some options; make others fatal.
1946
1947 2011-09-26  Cary Coutant  <ccoutant@google.com>
1948
1949         gcc PR lto/47247
1950         * plugin.cc (get_symbols_v2): New function.
1951         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1952         (is_referenced_from_outside): New function.
1953         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1954         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1955         (get_symbols): Pass version parameter.
1956         (get_symbols_v2): New function.
1957         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1958         parameter.
1959         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1960         (onload): Add LDPT_GET_SYMBOLS_V2.
1961         (all_symbols_read_hook): Use get_symbols_v2; check for
1962         LDPR_PREVAILING_DEF_IRONLY_EXP.
1963         * testsuite/plugin_test_3.sh: Update expected results.
1964
1965 2011-09-23  Simon Baldwin  <simonb@google.com>
1966
1967         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1968         configuration options.
1969         * configure: Regenerate.
1970         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1971         * Makefile.in: Regenerate.
1972         * testsuite/Makefile.in: Regenerate.
1973
1974 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1975
1976         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1977
1978 2011-09-19  Cary Coutant  <ccoutant@google.com>
1979
1980         * incremental.cc (can_incremental_update): Fix typo in comment.
1981         * incremental.h (can_incremental_update): Likewise.
1982
1983 2011-09-18  Cary Coutant  <ccoutant@google.com>
1984
1985         * incremental.cc (can_incremental_update): New function.
1986         * incremental.h (can_incremental_update): New function.
1987         * layout.cc (Layout::init_fixed_output_section): Call it.
1988         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1989         * object.cc (Sized_relobj_file::do_layout): Call
1990         can_incremental_update.
1991
1992 2011-09-13  Cary Coutant  <ccoutant@google.com>
1993
1994         * configure.ac: Check for glibc support for gnu_indirect_function
1995         support with static linking, setting automake conditional
1996         IFUNC_STATIC.
1997         * Makefile.in: Regenerate.
1998         * configure: Regenerate.
1999
2000         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2001         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2002         for IFUNC_STATIC.
2003         * testsuite/Makefile.in: Regenerate.
2004
2005 2011-09-13  Cary Coutant  <ccoutant@google.com>
2006
2007         * incremental.cc (Sized_relobj_incr::do_layout): Call
2008         report_comdat_group for kept comdat sections.
2009         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2010         * testsuite/Makefile.in: Regenerate.
2011         * testsuite/incr_comdat_test_1.cc: New source file.
2012         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2013         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2014         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2015
2016 2011-09-13  Ian Lance Taylor  <iant@google.com>
2017
2018         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2019         variable external_symbols_offset.
2020
2021 2011-09-12  Ian Lance Taylor  <iant@google.com>
2022
2023         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2024         triggered if object has no symbols.
2025
2026 2011-09-09  David S. Miller  <davem@davemloft.net>
2027
2028         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2029         (Output_fill_debug_line::do_write): Likewise.
2030
2031 2011-08-29  Cary Coutant  <ccoutant@google.com>
2032
2033         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2034         casts to match formatting specs.
2035         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2036
2037 2011-08-26  Cary Coutant  <ccoutant@google.com>
2038
2039         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2040         remaining hole size when allocating.
2041         (Layout::make_output_section): Set fill methods for debug sections.
2042         * layout.h (Free_list::Free_list_node): Move from private to
2043         public.
2044         (Free_list::set_min_hole_size): New function.
2045         (Free_list::begin, Free_list::end): New functions.
2046         (Free_list::min_hole_): New data member.
2047         * output.cc: Include dwarf.h.
2048         (Output_fill_debug_info::do_minimum_hole_size): New function.
2049         (Output_fill_debug_info::do_write): New function.
2050         (Output_fill_debug_line::do_minimum_hole_size): New function.
2051         (Output_fill_debug_line::do_write): New function.
2052         (Output_section::Output_section): Initialize new data member.
2053         (Output_section::set_final_data_size): Ensure patch space is larger
2054         than minimum hole size.
2055         (Output_section::do_write): Fill holes in debug sections.
2056         * output.h (Output_fill): New class.
2057         (Output_fill_debug_info): New class.
2058         (Output_fill_debug_line): New class.
2059         (Output_section::set_free_space_fill): New function.
2060         (Output_section::free_space_fill_): New data member.
2061         * testsuite/Makefile.am (incremental_test_3): Add
2062         --incremental-patch option.
2063         (incremental_test_4): Likewise.
2064         (incremental_test_5): Likewise.
2065         (incremental_test_6): Likewise.
2066         (incremental_copy_test): Likewise.
2067         (incremental_common_test_1): Likewise.
2068         * testsuite/Makefile.in: Regenerate.
2069
2070 2011-08-26  Nick Clifton  <nickc@redhat.com>
2071
2072         * po/es.po: Updated Spanish translation.
2073
2074 2011-08-01  Cary Coutant  <ccoutant@google.com>
2075
2076         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2077         * gold/testsuite/Makefile.in: Regenerate.
2078         * gold/testsuite/justsyms_exec.c: New source file.
2079         * gold/testsuite/justsyms_lib.c: New source file.
2080
2081 2011-08-01  Cary Coutant  <ccoutant@google.com>
2082
2083         * layout.cc (Layout::set_segment_offsets): Don't realign text
2084         segment if -Ttext was specified.
2085         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2086         file type.
2087         * object.h (Sized_relobj_file::e_type): New function.
2088         (Sized_relobj_file::e_type_): New data member.
2089         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2090         base address for ET_EXEC files.
2091         * target.cc (Target::do_make_elf_object_implementation): Allow
2092         ET_EXEC files with --just-symbols option.
2093
2094 2011-07-28  Cary Coutant  <ccoutant@google.com>
2095
2096         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2097         Add thread_number parameter.
2098         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2099         * workqueue-threads.cc
2100         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2101         current thread if its thread number is greater than desired thread
2102         count.
2103         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2104         Add thread_number parameter.
2105         (Workqueue::should_cancel_thread): Likewise.
2106         (Workqueue::find_runnable_or_wait): Pass thread_number to
2107         should_cancel_thread.
2108         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2109         parameter.
2110
2111 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2112
2113         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2114         only after checking if it cannot be forced local.
2115         * symtab.h (is_externally_visible): Check if the symbol is not forced
2116         local.
2117
2118 2011-07-15  Ian Lance Taylor  <iant@google.com>
2119
2120         * options.h (class General_options): Add --print-output-format.
2121         Move -EL next to -EB, for  better --help output.
2122         * target-select.cc: Include <cstdio>, "options.h", and
2123         "parameters.h".
2124         (Target_selector::do_target_bfd_name): New function.
2125         (print_output_format): New function.
2126         * target-select.h (class Target_selector): Update declarations.
2127         (Target_selector::target_bfd_name): New function.
2128         (print_output_format): Declare.
2129         * main.cc: Include "target-select.h".
2130         (main): Handle --print-output-format.
2131         * gold.cc: Include "target-select.h".
2132         (queue_initial_tasks): Handle --print-output-format when there are
2133         no input files.
2134         * parameters.cc (parameters_force_valid_target): Give a better
2135         error message if -EB/-EL does not match target.
2136         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2137         function.
2138
2139 2011-07-15  Ian Lance Taylor  <iant@google.com>
2140
2141         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2142         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2143         (Output_data_plt_i386::do_write): Write address of .dynamic
2144         section to first entry in .got.plt section.
2145         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2146         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2147         Initialize layout_.
2148         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2149         section to first entry in .got.plt section.
2150         * layout.h (Layout::dynamic_section): New function.
2151
2152 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2153
2154         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2155         to claim_file call.
2156         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2157         input_section_position_, and input_section_glob_.
2158         (read_layout_from_file): Call function section_ordering_specified.
2159         * layout.h (is_section_ordering_specified): New function.
2160         (section_ordering_specified): New function.
2161         (section_ordering_specified_): New boolean member.
2162         * main.cc(main): Call load_plugins after layout object is defined.
2163         * output.cc (Output_section::add_input_section): Use
2164         function section_ordering_specified to check if section ordering is
2165         needed.
2166         * output.cc (Output_section::add_relaxed_input_section): Use
2167         function section_ordering_specified to check if section ordering is
2168         needed.
2169         (Output_section::update_section_layout): New function.
2170         (Output_section::sort_attached_input_sections): Check if input section
2171         must be reordered.
2172         * output.h (Output_section::update_section_layout): New function.
2173         * plugin.cc (get_section_count): New function.
2174         (get_section_type): New function.
2175         (get_section_name): New function.
2176         (get_section_contents): New function.
2177         (update_section_order): New function.
2178         (allow_section_ordering): New function.
2179         (Plugin::load): Add the new interfaces to the transfer vector.
2180         (Plugin_manager::load_plugins): New parameter.
2181         (Plugin_manager::all_symbols_read): New parameter.
2182         (Plugin_manager::claim_file): New parameter. Save the elf object for
2183         unclaimed objects.
2184         (Plugin_manager::get_elf_object): New function.
2185         (Plugin_manager::get_view): Change to directly use the bool to check
2186         if get_view is called from claim_file_hook.
2187         * plugin.h (input_objects): New function
2188         (Plugin__manager::load_plugins): New parameter.
2189         (Plugin_manager::claim_file): New parameter.
2190         (Plugin_manager::get_elf_object): New function.
2191         (Plugin_manager::in_claim_file_handler): New function.
2192         (Plugin_manager::in_claim_file_handler_): New member.
2193         (layout): New function.
2194         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2195         handler with an extra parameter. Make the elf object before calling
2196         claim_file handler.
2197         * testsuite/plugin_test.c (get_section_count): New function pointer.
2198         (get_section_type): New function pointer.
2199         (get_section_name): New function pointer.
2200         (get_section_contents): New function pointer.
2201         (update_section_order): New function pointer.
2202         (allow_section_ordering): New function pointer.
2203         (onload): Check if the new interfaces exist.
2204
2205 2011-07-13  Ian Lance Taylor  <iant@google.com>
2206
2207         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2208         relro section.
2209         * x86_64.cc (Target_x86_64::got_section): Likewise.
2210         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2211         (relro_now_test_SOURCES): New variable.
2212         (relro_now_test_DEPENDENCIES): New variable.
2213         (relro_now_test_LDFLAGS): New variable.
2214         (relro_now_test_LDADD): New variable.
2215         (relro_now_test.so): New target.
2216         * testsuite/Makefile.in: Rebuild.
2217
2218 2011-07-12  Ian Lance Taylor  <iant@google.com>
2219
2220         PR gold/12980
2221         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2222         GLOB_DAT relocation rather than a RELATIVE relocation for a
2223         protected symbol when creating a shared library.
2224         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2225         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2226         * testsuite/protected_main_1.cc (main): Test that protected
2227         function has same address.
2228
2229 2011-07-11  Ian Lance Taylor  <iant@google.com>
2230
2231         PR gold/12979
2232         * options.h (class General_options): Add -Bgroup.
2233         * options.cc (General_options::finalize): If -Bgroup is set,
2234         default to --unresolved-symbols=report-all.
2235         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2236         * target-reloc.h (issue_undefined_symbol_error): Handle
2237         --unresolved-symbols=report-all.
2238
2239 2011-07-08  Ian Lance Taylor  <iant@google.com>
2240
2241         PR gold/11985
2242         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2243         if linker script discards key sections.
2244         (Layout::create_dynamic_symtab): Likewise.
2245         (Layout::assign_local_dynsym_offsets): Likewise.
2246         (Layout::sized_create_version_sections): Likewise.
2247         (Layout::create_interp): Likewise.
2248         (Layout::finish_dynamic_section): Likewise.
2249         (Layout::set_dynamic_symbol_size): Likewise.
2250
2251 2011-07-08  Ian Lance Taylor  <iant@google.com>
2252
2253         PR gold/12386
2254         * options.h (class General_options): Add --unresolved-symbols.
2255         * target-reloc.h (issue_undefined_symbol_error): Check
2256         --unresolved-symbols.  Add comments.
2257
2258 2011-07-08  Ian Lance Taylor  <iant@google.com>
2259
2260         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2261         expression more complex.
2262
2263 2011-07-08  Ian Lance Taylor  <iant@google.com>
2264
2265         PR gold/11317
2266         * target-reloc.h (issue_undefined_symbol_error): New inline
2267         function, broken out of relocate_section.
2268         (relocate_section): Call issue_undefined_symbol_error.
2269         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2270         there is no TLS segment if we are about to issue an undefined
2271         symbol error.
2272         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2273
2274 2011-07-08  Ian Lance Taylor  <iant@google.com>
2275
2276         PR gold/12279
2277         * resolve.cc (Symbol_table::should_override): Add fromtype
2278         parameter.  Change all callers.  Give error when linking together
2279         TLS and non-TLS symbol.
2280         (Symbol_table::should_override_with_special): Add fromtype
2281         parameter.  Change all callers.
2282         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2283         there is no TLS segment if we have reported some errors.
2284         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2285
2286 2011-07-08  Ian Lance Taylor  <iant@google.com>
2287
2288         PR gold/12372
2289         * target.h (Target::plt_address_for_global): New function.
2290         (Target::plt_address_for_local): New function.
2291         (Target::plt_section_for_global): Remove.
2292         (Target::plt_section_for_local): Remove.
2293         (Target::do_plt_address_for_global): New virtual function.
2294         (Target::do_plt_address_for_local): New virtual function.
2295         (Target::do_plt_section_for_global): Remove.
2296         (Target::do_plt_section_for_local): Remove.
2297         (Target::register_global_plt_entry): Add Symbol_table and Layout
2298         parameters.
2299         * output.cc (Output_data_got::Got_entry::write): Use
2300         plt_address_for_global and plt_address_for_local.
2301         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2302         address of output section.
2303         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2304         got_irelative_, and irelative_count_ fields.  Update
2305         declarations.
2306         (Output_data_plt_i386::has_irelative_section): New function.
2307         (Output_data_plt_i386::entry_count): Add irelative_count_.
2308         (Output_data_plt_i386::set_final_data_size): Likewise.
2309         (class Target_i386): Add got_irelative_ and rel_irelative_
2310         fields.  Update declarations.
2311         (Target_i386::Target_i386): Initialize new fields.
2312         (Target_i386::do_plt_address_for_global): New function replacing
2313         do_plt_section_for_global.
2314         (Target_i386::do_plt_address_for_local): New function replacing
2315         do_plt_section_for_local.
2316         (Target_i386::got_section): Create got_irelative_.
2317         (Target_i386::rel_irelative_section): New function.
2318         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2319         fields.  Don't define __rel_iplt_{start,end}.
2320         (Output_data_plt_i386::add_entry): Add symtab and layout
2321         parameters.  Change all callers.  Use different PLT and GOT for
2322         IFUNC symbols.
2323         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2324         layout parameters.  Change all callers.  Use different PLT and
2325         GOT.
2326         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2327         (Output_data_plt_i386::rel_irelative): New function.
2328         (Output_data_plt_i386::address_for_global): New function.
2329         (Output_data_plt_i386::address_for_local): New function.
2330         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2331         IRELATIVE GOT when changing IFUNC GOT entries.
2332         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2333         reloc.
2334         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2335         if we didn't create an IRELATIVE GOT.
2336         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2337         plt_address_for_local.
2338         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2339         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2340         got_irelative_, and irelative_count_ fields.  Update
2341         declarations.
2342         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2343         Initialize new fields.  Remove symtab parameter.  Change all
2344         callers.
2345         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2346         irelative_count_.
2347         (Output_data_plt_x86_64::has_irelative_section): New function.
2348         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2349         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2350         fields.  Update declarations.
2351         (Target_x86_64::Target_x86_64): Initialize new fields.
2352         (Target_x86_64::do_plt_address_for_global): New function replacing
2353         do_plt_section_for_global.
2354         (Target_x86_64::do_plt_address_for_local): New function replacing
2355         do_plt_section_for_local.
2356         (Target_x86_64::got_section): Create got_irelative_.
2357         (Target_x86_64::rela_irelative_section): New function.
2358         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2359         all callers.  Don't create __rel_iplt_{start,end}.
2360         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2361         parameters.  Change all callers.  Use different PLT and GOT for
2362         IFUNC symbols.
2363         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2364         layout parameters.  Change all callers.  Use different PLT and
2365         GOT.
2366         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2367         parameters.  Change all callers.  Use different PLT and GOT for
2368         IFUNC symbols.
2369         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2370         (Output_data_plt_x86_64::rela_irelative): New function.
2371         (Output_data_plt_x86_64::address_for_global): New function.
2372         (Output_data_plt_x86_64::address_for_local): New function.
2373         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2374         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2375         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2376         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2377         parameters.
2378         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2379         reloc.
2380         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2381         symbols if we didn't create an IRELATIVE GOT.
2382         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2383         plt_address_for_local.
2384         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2385         * testsuite/ifuncvar1.c: New test file.
2386         * testsuite/ifuncvar2.c: New test file.
2387         * testsuite/ifuncvar3.c: New test file.
2388         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2389         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2390         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2391         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2392         * testsuite/Makefile.in: Rebuild.
2393
2394 2011-07-07  Cary Coutant  <ccoutant@google.com>
2395
2396         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2397         (two_file_test_1_ndebug.o): Likewise.
2398         (two_file_test_1b_ndebug.o): Likewise.
2399         (two_file_test_2_ndebug.o): Likewise.
2400         (two_file_test_main_ndebug.o): Likewise.
2401         (incremental_test_2): Link with no-debug versions.
2402
2403 2011-07-06  Cary Coutant  <ccoutant@google.com>
2404
2405         * gold/incremental.cc
2406         (Output_section_incremental_inputs::write_info_blocks): Check for
2407         hidden and internal symbols.
2408
2409 2011-07-06  Cary Coutant  <ccoutant@google.com>
2410
2411         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2412         Check disposition for startup file.
2413         (Incremental_inputs::report_command_line): Ignore
2414         --incremental-startup-unchanged option.
2415         * options.cc (General_options::parse_incremental_startup_unchanged):
2416         New function.
2417         (General_options::General_options): Initialize new data member.
2418         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2419         (General_options): Add --incremental-startup-unchanged option.
2420         (General_options::incremental_startup_disposition): New function.
2421         (General_options::incremental_startup_disposition_): New data member.
2422
2423 2011-07-06  Cary Coutant  <ccoutant@google.com>
2424
2425         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2426         input file index to Script_info ctor.
2427         (Sized_incremental_binary::do_file_has_changed): Find the
2428         command-line argument for files named in scripts.
2429         * incremental.h (Script_info::Script_info): New ctor
2430         with input file index.
2431         (Script_info::input_file_index): New function.
2432         (Script_info::input_file_index_): New data member.
2433         (Incremental_binary::get_library): Add const.
2434         (Incremental_binary::get_script_info): Add const.
2435         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2436         * testsuite/Makefile.am (incremental_test_5): New test case.
2437         (incremental_test_6): New test case.
2438         * testsuite/Makefile.in: Regenerate.
2439
2440 2011-07-06  Cary Coutant  <ccoutant@google.com>
2441
2442         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2443         debug output when command lines differ.
2444
2445 2011-07-06  Cary Coutant  <ccoutant@google.com>
2446
2447         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2448         --incremental-patch option.
2449         * layout.cc (Free_list::allocate): Extend allocation beyond original
2450         end if enabled.
2451         (Layout::make_output_section): Mark sections that should get
2452         patch space.
2453         * options.cc (parse_percent): New function.
2454         * options.h (parse_percent): New function.
2455         (DEFINE_percent): New macro.
2456         (General_options): Add --incremental-patch option.
2457         * output.cc (Output_section::Output_section): Initialize new data
2458         members.
2459         (Output_section::add_input_section): Print section name when out
2460         of patch space.
2461         (Output_section::add_output_section_data): Likewise.
2462         (Output_section::set_final_data_size): Add patch space when
2463         doing --incremental-full.
2464         (Output_section::do_reset_address_and_file_offset): Remove patch
2465         space.
2466         (Output_segment::set_section_list_addresses): Print debug output
2467         only if --incremental-update.
2468         * output.h (Output_section::set_is_patch_space_allowed): New function.
2469         (Output_section::is_patch_space_allowed_): New data member.
2470         (Output_section::patch_space_): New data member.
2471         * parameters.cc (Parameters::incremental_full): New function.
2472         * parameters.h (Parameters::incremental_full): New function
2473         * testsuite/Makefile.am (incremental_test_2): Add test for
2474         --incremental-patch option.
2475         * testsuite/Makefile.in: Regenerate.
2476         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2477         (t18): Remove function body.
2478
2479 2011-07-05  Doug Kwan  <dougkwan@google.com>
2480
2481         PR gold/12771
2482         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2483         Arm_Address type for relocation result.
2484         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2485         overflow check.
2486         (Arm_relocate_functions::abs32): Use unaligned access.
2487         (Arm_relocate_functions::rel32): Ditto.
2488         (Arm_relocate_functions::prel31): Ditto.
2489         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2490         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2491         static data relocations.
2492         * testsuite/Makefile.in: Regnerate.
2493         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2494
2495 2011-07-05  Ian Lance Taylor  <iant@google.com>
2496
2497         PR gold/12392
2498         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2499         symbols if necessary.
2500         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2501
2502 2011-07-05  Ian Lance Taylor  <iant@google.com>
2503
2504         PR gold/12952
2505         * resolve.cc (Symbol::override_base_with_special): Simply override
2506         version with special symbol version, ignoring previous version.
2507
2508 2011-07-05  Ian Lance Taylor  <iant@google.com>
2509
2510         * object.cc (Sized_relobj_file::include_section_group): Add
2511         information to comment about signature location.
2512
2513 2011-07-02  Ian Lance Taylor  <iant@google.com>
2514
2515         PR gold/12957
2516         * options.h (class General_options): Add -f and -F.
2517         * options.cc (General_options::finalize): Fatal error if -f/-F
2518         are used without -shared.
2519         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2520
2521 2011-07-02  Ian Lance Taylor  <iant@google.com>
2522
2523         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2524
2525 2011-07-01  Ian Lance Taylor  <iant@google.com>
2526
2527         PR gold/12525
2528         PR gold/12952
2529         * resolve.cc (Symbol::override_base_with_special): Don't override
2530         the version if the overriding symbol has a different name.
2531         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2532         all callers.  If we give an error about an undefined version,
2533         define the base version if necessary.
2534         * dynobj.h (class Versions): Update declaration.
2535         * testsuite/weak_alias_test_5.cc: New file.
2536         * testsuite/weak_alias_test.script: New file.
2537         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2538         and versioned_alias have the right value, and call t2.
2539         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2540         weak_alias_test_5.so.
2541         (weak_alias_test_LDADD): Likewise.
2542         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2543         * testsuite/Makefile.in: Rebuild.
2544
2545 2011-07-01  Ian Lance Taylor  <iant@google.com>
2546
2547         PR gold/12525
2548         * options.h (class General_options): Support -z notext.
2549         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2550         -Wl,-z,notext.
2551         (two_file_shared_nonpic.so): Likewise.
2552         (two_file_shared_mixed.so): Likewise.
2553         (two_file_shared_mixed_1.so): Likewise.
2554         (weak_undef_lib_nonpic.so): Likewise.
2555         (alt/weak_undef_lib_nonpic.so): Likewise.
2556         (tls_test_shared_nonpic.so): Likewise.
2557         * testsuite/Makefile.in: Rebuild.
2558
2559 2011-07-01  Ian Lance Taylor  <iant@google.com>
2560
2561         PR gold/12525
2562         * configure.ac: Test whether static linking works, setting
2563         the automake conditional HAVE_STATIC.
2564         * testsuite/Makefile.am: Disable tests using -static if
2565         HAVE_STATIC is not true.
2566         * configure, testsuite/Makefile.in: Rebuild.
2567
2568 2011-07-01  Ian Lance Taylor  <iant@google.com>
2569
2570         PR gold/12525
2571         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2572         Assert if we see DW_EH_PE_indirect.
2573         * target.h (Target::ehframe_datarel_base): New function.
2574         (Target::do_ehframe_datarel_base): New target function.
2575         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2576         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2577         function.
2578
2579 2011-07-01  Ian Lance Taylor  <iant@google.com>
2580
2581         PR gold/12571
2582         * options.h (class General_options): Add
2583         --ld-generated-unwind-info.
2584         * ehframe.cc (Fde::write): Add address parameter.  Change all
2585         callers.  If associated with PLT, fill in address and size.
2586         (Cie::set_output_offset): Only add merge mapping if there is an
2587         object.
2588         (Cie::write): Add address parameter.  Change all callers.
2589         (Eh_frame::add_ehframe_for_plt): New function.
2590         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2591         input_offset_ fields into union u_, with new plt field.
2592         (Fde::Fde): Adjust for new union field.
2593         (Fde::Fde) [Output_data version]: New constructor.
2594         (Fde::add_mapping): Only add merge mapping if there is an object.
2595         (class Cie): Update declarations.
2596         (class Eh_frame): Declare add_ehframe_for_plt.
2597         * layout.cc (Layout::layout_eh_frame): Break out code into
2598         make_eh_frame_section, and call it.
2599         (Layout::make_eh_frame_section): New function.
2600         (Layout::add_eh_frame_for_plt): New function.
2601         * layout.h (class Layout): Update declarations.
2602         * merge.cc (Merge_map::add_mapping): Add assertion.
2603         * i386.cc: Include "dwarf.h".
2604         (class Output_data_plt_i386): Make first_plt_entry,
2605         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2606         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2607         and plt_eh_frame_fde.
2608         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2609         boundary.  Call add_eh_frame_for_plt if appropriate.
2610         * x86_64.cc: Include "dwarf.h".
2611         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2612         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2613         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2614         and plt_eh_frame_fde.
2615         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2616         appropriate.
2617
2618 2011-06-29  Ian Lance Taylor  <iant@google.com>
2619
2620         PR gold/12629
2621         * object.cc (Sized_relobj_file::layout_section): Change shdr
2622         parameter to be const.
2623         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2624         out of do_layout.
2625         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2626         appropriate.  Call layout_eh_frame_section.
2627         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2628         sections.
2629         * object.h (class Sized_relobj_file): Update declarations.
2630
2631 2011-06-29  Ian Lance Taylor  <iant@google.com>
2632
2633         PR gold/12652
2634         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2635         modifier.
2636         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2637
2638 2011-06-29  Ian Lance Taylor  <iant@google.com>
2639
2640         PR gold/12675
2641         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2642         SHT_X86_64_UNWIND.
2643         * layout.cc (Layout::layout_eh_frame): Likewise.
2644
2645 2011-06-29  Ian Lance Taylor  <iant@google.com>
2646
2647         PR gold/12695
2648         * layout.cc (Layout::symtab_section_shndx): New function.
2649         * layout.h (class Layout): Declare symtab_section_shndx.
2650         * output.cc (Output_section::write_header): Call it.
2651
2652 2011-06-29  Ian Lance Taylor  <iant@google.com>
2653
2654         PR gold/12818
2655         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2656         symbols which are not used in a relocation.
2657
2658 2011-06-28  Ian Lance Taylor  <iant@google.com>
2659
2660         PR gold/12898
2661         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2662         script create indistinguishable segments.
2663         (Layout::set_segment_offsets): Use stable_sort when sorting
2664         segments.  Pass this to Compare_segments constructor.
2665         * layout.h (class Layout): Make segment_precedes non-static.
2666         (class Compare_segments): Change from struct to class.  Add
2667         layout_ field.  Add constructor.
2668         * script-sections.cc
2669         (Script_sections::attach_sections_using_phdrs_clause): Rename
2670         local orphan to is_orphan.  Don't report failure to put empty
2671         section in segment.  On attachment failure, report name of
2672         section, and attach to first PT_LOAD segment.
2673
2674 2011-06-28  Ian Lance Taylor  <iant@google.com>
2675
2676         PR gold/12934
2677         * target-select.cc (Target_selector::Target_selector): Add
2678         emulation parameter.  Change all callers.
2679         (select_target_by_bfd_name): Rename from select_target_by_name.
2680         Change all callers.
2681         (select_target_by_emulation): New function.
2682         (supported_emulation_names): New function.
2683         * target-select.h (class Target_selector): Add emulation_ field.
2684         Update declarations.
2685         (Target_selector::recognize_by_bfd_name): Rename from
2686         recognize_by_name.  Change all callers.
2687         (Target_selector::supported_bfd_names): Rename from
2688         supported_names.  Change all callers.
2689         (Target_selector::recognize_by_emulation): New function.
2690         (Target_selector::supported_emulations): New function.
2691         (Target_selector::emulation): New function.
2692         (Target_selector::do_recognize_by_bfd_name): Rename from
2693         do_recognize_by_name.  Change all callers.
2694         (Target_selector::do_supported_bfd_names): Rename from
2695         do_supported_names.  Change all callers.
2696         (Target_selector::do_recognize_by_emulation): New function.
2697         (Target_selector::do_supported_emulations): New function.
2698         (select_target_by_bfd_name): Change name in declaration.
2699         (select_target_by_emulation): Declare.
2700         (supported_emulation_names): Declare.
2701         * parameters.cc (parameters_force_valid_target): Try to find
2702         target based on emulation from -m option.
2703         * options.h (class General_options): Change doc string for -m.
2704         * options.cc (help): Print emulations.
2705         (General_options::parse_V): Likewise.
2706         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2707         Add emulation parameter.  Change all callers.
2708
2709 2011-06-28  Ian Lance Taylor  <iant@google.com>
2710
2711         * target.h (class Target): Add osabi_ field.
2712         (Target::osabi): New function.
2713         (Target::set_osabi): New function.
2714         (Target::Target): Initialize osabi_.
2715         (Target::do_adjust_elf_header): Make pure virtual.
2716         (Sized_target::do_adjust_elf_header): Declare.
2717         * target.cc (Sized_target::do_adjust_elf_header): New function.
2718         (class Sized_target): Instantiate all versions.
2719         * freebsd.h (class Target_freebsd): Remove.
2720         (Target_selector_freebsd::do_recognize): Call set_osabi on
2721         Target.
2722         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2723         (Target_selector_freebsd::set_osabi): Remove.
2724         * i386.cc (class Target_i386): Inherit from Sized_target rather
2725         than Target_freebsd.
2726         * x86_64.cc (class Target_x86_64): Likewise.
2727
2728 2011-06-28  Ian Lance Taylor  <iant@google.com>
2729
2730         * target.h (Target::can_check_for_function_pointers): Rewrite.
2731         Make non-virtual.
2732         (Target::can_icf_inline_merge_sections): Likewise.
2733         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2734         (Target::Target_info): Add can_icf_inline_merge_sections field.
2735         (Target::do_can_check_for_function_pointers): New virtual
2736         function.
2737         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2738         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2739         from can_check_for_function_pointers, move in file.
2740         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2741         section_may_have_icf_unsafe_poineters, move in file.
2742         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2743         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2744         Rename from can_check_for_function_pointers, move in file.
2745         (Target_i386::can_icf_inline_merge_sections): Remove.
2746         (Target_i386::i386_info): Initialize
2747         can_icf_inline_merge_sections.
2748         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2749         Initialize can_icf_inline_merge_sections.
2750         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2751         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2752         Rename from can_check_for_function_pointers, move in file.
2753         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2754         (Target_x86_64::x86_64_info): Initialize
2755         can_icf_inline_merge_sections.
2756         * testsuite/testfile.cc (Target_test::test_target_info):
2757         Likewise.
2758         * icf.cc (get_section_contents): Correct formatting.
2759
2760 2011-06-27  Ian Lance Taylor  <iant@google.com>
2761
2762         * symtab.cc (Symbol::versioned_name): New function.
2763         (Symbol_table::add_to_final_symtab): Use versioned_name when
2764         appropriate.
2765         (Symbol_table::sized_write_symbol): Likewise.
2766         * symtab.h (class Symbol): Declare versioned_name.
2767         * stringpool.h (class Stringpool_template): Add variant of add
2768         which takes a std::basic_string.
2769         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2770         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2771         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2772         (ver_test_12.o): New target.
2773         * testsuite/Makefile.in: Rebuild.
2774
2775 2011-06-27  Doug Kwan  <dougkwan@google.com>
2776
2777         * arm.cc (Arm_relocate_functions::thm_jump8,
2778         Arm_relocate_functions::thm_jump11): Use a wider signed
2779         type to compute offset.
2780         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2781         arm_thm_jump8.
2782         * testsuite/Makefile.in: Regenerate.
2783         * testsuite/arm_branch_in_range.sh: Check test results of
2784         arm_thm_jump11 and arm_thm_jump8.
2785         * testsuite/arm_thm_jump11.s: New test source file.
2786         * testsuite/arm_thm_jump11.t: New linker script.
2787         * testsuite/arm_thm_jump8.s: New test source file.
2788         * testsuite/arm_thm_jump8.t: New linker script.
2789
2790 2011-06-24  Ian Lance Taylor  <iant@google.com>
2791
2792         * layout.cc: Include "object.h".
2793         (ctors_sections_in_init_array): New static variable.
2794         (Layout::is_ctors_in_init_array): New function.
2795         (Layout::layout): Add entry to ctors_sections_in_init_array if
2796         appropriate.
2797         * layout.h (class Layout): Declare is_ctors_in_init_array.
2798         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2799         is_ctors_reverse_view is set.
2800         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2801         all callers.  Set is_ctors_reverse_view field of View_size.
2802         (Sized_relobj_file::reverse_words): New function.
2803         * object.h (Sized_relobj_file::View_size): Add
2804         is_ctors_reverse_view field.
2805         (class Sized_relobj_file): Update declarations.
2806         * testsuite/initpri3.c: New test.
2807         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2808         initpri3b.
2809         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2810         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2811         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2812         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2813         * testsuite/Makefile.in: Rebuild.
2814
2815 2011-06-24  Cary Coutant  <ccoutant@google.com>
2816
2817         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2818         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2819         (debug_msg_cdebug.err): New targets.
2820         * testsuite/Makefile.in: Regenerate.
2821         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2822         Fix checks for link with shared library.
2823
2824 2011-06-24  Doug Kwan  <dougkwan@google.com>
2825
2826         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2827         skip empty text sections.
2828         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2829
2830 2011-06-22  Ian Lance Taylor  <iant@google.com>
2831
2832         PR gold/12910
2833         * options.h (class General_options): Add --ctors-in-init-array.
2834         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2835         friends as SHT_PROGBITS for merging sections.
2836         (Layout::layout): Remove special handling of .init_array and
2837         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2838         and .dtors if ctors_in_init_array.
2839         (Layout::make_output_section): Force correct section types for
2840         .init_array and friends.  Don't sort if doing relocatable link,
2841         Don't sort .ctors and .dtors if ctors_in_init_array.
2842         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2843         (Layout::output_section_name): Add relobj parameter.  Change all
2844         callers.  Handle .ctors. and .dtors. in code rather than table.
2845         Handle .ctors and .dtors if ctors_in_init_array.
2846         (Layout::match_file_name): New function, moved from output.cc.
2847         * layout.h (class Layout): Update declarations.
2848         * output.cc: Include "layout.h".
2849         (Input_section_sort_entry::get_priority): New function.
2850         (Input_section_sort_entry::match_file_name): Just call
2851         Layout::match_file_name.
2852         (Output_section::Input_section_sort_init_fini_compare::operator()):
2853         Handle .ctors and .dtors.  Sort by explicit priority rather than
2854         by name.
2855         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2856         * testsuite/initpri2.c: New test.
2857         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2858         (check_PROGRAMS): Add initpri2.
2859         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2860         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2861         * configure, testsuite/Makefile.in: Rebuild.
2862
2863 2011-06-19  Ian Lance Taylor  <iant@google.com>
2864
2865         PR gold/12880
2866         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2867         .interp section to a PT_INTERP segment even if we have seen a
2868         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2869         clause in a linker script.
2870         (Layout::finalize): Don't create a .interp section if we've
2871         already create a PT_INTERP segment.
2872         (Layout::create_interp): Always call choose_output_section (revert
2873         patch of 2011-06-17).  Don't create PT_INTERP segment.
2874         * script-sections.cc
2875         (Script_sections::create_note_and_tls_segments): Add a .interp
2876         section to a PT_INTERP segment even if we have seen a
2877         --dynamic-linker option.
2878
2879 2011-06-18  Ian Lance Taylor  <iant@google.com>
2880
2881         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2882         merely because a non-PT_LOAD segment has a dynamic reloc.
2883
2884 2011-06-18  Ian Lance Taylor  <iant@google.com>
2885
2886         * layout.cc (Layout::finish_dynamic_section): Don't create
2887         DT_FLAGS entry if not needed.
2888
2889 2011-06-18  Ian Lance Taylor  <iant@google.com>
2890
2891         PR gold/12745
2892         * layout.cc (Layout::layout_eh_frame): Correct handling of
2893         writable .eh_frame section.
2894
2895 2011-06-17  Ian Lance Taylor  <iant@google.com>
2896
2897         PR gold/12893
2898         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2899         symbol is redefined with the exact same object and value.
2900
2901 2011-06-17  Ian Lance Taylor  <iant@google.com>
2902
2903         PR gold/12880
2904         * layout.h (class Layout): Add interp_segment_ field.
2905         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2906         (Layout::attach_allocated_section_to_segment): If making shared
2907         library, put .interp section in PT_INTERP segment.
2908         (Layout::finalize): Also call create_interp if -dynamic-linker
2909         option was used.
2910         (Layout::create_interp): Assert that there is no PT_INTERP
2911         segment.  If not using a SECTIONS clause, use make_output_section.
2912         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2913         * script-sections.cc
2914         (Script_sections::create_note_and_tls_segments): If making shared
2915         library, put .interp section in PT_INTERP segment.
2916
2917 2011-06-17  Ian Lance Taylor  <iant@google.com>
2918
2919         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2920         when making a shared library.
2921
2922 2011-06-17  Ian Lance Taylor  <iant@google.com>
2923
2924         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2925         parameter.  Change all callers.  Don't issue warning about PC32
2926         against locally defined symbol.
2927
2928 2011-06-16  Ian Lance Taylor  <iant@google.com>
2929
2930         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2931         occurs in same object.
2932
2933 2011-06-14  Alan Modra  <amodra@gmail.com>
2934
2935         * po/POTFILES.in: Regenerate.
2936
2937 2011-06-09  Ian Lance Taylor  <iant@google.com>
2938
2939         * script-sections.cc
2940         (Orphan_output_section::set_section_addresses): For a relocatable
2941         link set address to 0.
2942
2943 2011-06-09  Cary Coutant  <ccoutant@google.com>
2944
2945         PR gold/12804
2946         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2947         used with --compress-debug-sections.
2948         * gold/object.cc (Sized_relobj_file::do_layout): Report
2949         uncompressed size of compressed input sections.
2950
2951 2011-06-08  Cary Coutant  <ccoutant@google.com>
2952
2953         PR gold/12804
2954         * testsuite/two_file_test_2_v1.cc: Change initialization of
2955         v2 to keep it in .data.
2956
2957 2011-06-07  Cary Coutant  <ccoutant@google.com>
2958
2959         * common.cc (Symbol_table::do_allocate_commons_list): Call
2960         gold_fallback.
2961         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2962         (Errors::fallback): New function.
2963         (gold_fallback): New function.
2964         * errors.h (Errors::fallback): New function.
2965         * gold.cc (gold_exit): Change status parameter to enum; adjust
2966         all callers.
2967         (queue_initial_tasks): Call gold_fallback.
2968         * gold.h: Include cstdlib.
2969         (Exit_status): New enum type.
2970         (gold_exit): Change status parameter to enum.
2971         (gold_fallback): New function.
2972         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2973         (Layout::create_symtab_sections): Likewise.
2974         (Layout::create_shdrs): Likewise.
2975         * main.cc (main): Adjust call to gold_exit.
2976         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2977         (Output_data_got::add_got_entry_pair): Likewise.
2978         (Output_section::add_input_section): Likewise.
2979         (Output_section::add_output_section_data): Likewise.
2980         (Output_segment::set_section_list_addresses): Likewise.
2981         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2982
2983 2011-06-07  Cary Coutant  <ccoutant@google.com>
2984
2985         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2986         for incremental links.
2987         * output.cc (Output_segment::set_section_list_addresses): Remove
2988         FIXME and test for TLS or BSS.
2989
2990 2011-06-07  Cary Coutant  <ccoutant@google.com>
2991
2992         * testsuite/Makefile.am: Add incremental_copy_test,
2993         incremental_common_test_1.
2994         * testsuite/Makefile.in: Regenerate.
2995         * testsuite/common_test_1_v1.c: New source file.
2996         * testsuite/common_test_1_v2.c: New source file.
2997         * testsuite/copy_test_v1.cc: New source file.
2998
2999 2011-06-07  Cary Coutant  <ccoutant@google.com>
3000
3001         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3002         update, allocate common from bss section's free list.
3003         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3004         linker-defined symbols.
3005         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3006         Skip GOT and PLT entries that are no longer referenced.
3007         (Output_section_incremental_inputs::write_info_blocks): Mark
3008         linker-defined symbols.
3009         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3010         * output.cc (Output_section::allocate): New function.
3011         * output.h (Output_section::allocate): New function.
3012         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3013         linker-defined symbols.
3014         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3015         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3016         (Symbol::init_base_output_data): Likewise.
3017         (Symbol::init_base_output_segment): Likewise.
3018         (Symbol::init_base_constant): Likewise.
3019         (Sized_symbol::init_output_data): Likewise.
3020         (Sized_symbol::init_output_segment): Likewise.
3021         (Sized_symbol::init_constant): Likewise.
3022         (Symbol_table::do_define_in_output_data): Likewise.
3023         (Symbol_table::do_define_in_output_segment): Likewise.
3024         (Symbol_table::do_define_as_constant): Likewise.
3025         * symtab.h (Symbol::is_predefined): New function.
3026         (Symbol::init_base_output_data): Add is_predefined parameter.
3027         (Symbol::init_base_output_segment): Likewise.
3028         (Symbol::init_base_constant): Likewise.
3029         (Symbol::is_predefined_): New data member.
3030         (Sized_symbol::init_output_data): Add is_predefined parameter.
3031         (Sized_symbol::init_output_segment): Likewise.
3032         (Sized_symbol::init_constant): Likewise.
3033         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3034
3035 2011-06-07  Cary Coutant  <ccoutant@google.com>
3036
3037         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3038         instead of emit_copy_reloc.
3039         (Copy_relocs::emit_copy_reloc): Refactor.
3040         (Copy_relocs::make_copy_reloc): New function.
3041         (Copy_relocs::add_copy_reloc): Remove.
3042         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3043         section.
3044         (Copy_relocs::make_copy_reloc): New function.
3045         (Copy_relocs::add_copy_reloc): Remove.
3046         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3047         unchanged input files.
3048         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3049         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3050         Reserve BSS space for COPY relocations.
3051         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3052         (Output_section_incremental_inputs::write_info_blocks): Record
3053         whether a symbol is copied from a shared object.
3054         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3055         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3056         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3057         (Incremental_input_entry_reader::get_output_symbol_index): Add
3058         is_copy parameter.
3059         (Incremental_binary::emit_copy_relocs): New function.
3060         (Incremental_binary::do_emit_copy_relocs): New function.
3061         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3062         new data member.
3063         (Sized_incremental_binary::add_copy_reloc): New function.
3064         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3065         (Sized_incremental_binary::Copy_reloc): New struct.
3066         (Sized_incremental_binary::Copy_relocs): New typedef.
3067         (Sized_incremental_binary::copy_relocs_): New data member.
3068         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3069         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3070         * target.h (Sized_target::emit_copy_reloc): New function.
3071         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3072
3073 2011-06-02  Cary Coutant  <ccoutant@google.com>
3074
3075         PR gold/12163
3076         * gold/archive.cc (Archive::Archive): Initialize new data member.
3077         (Archive::include_all_members): Return if archive has already been
3078         included.
3079         * gold/archive.h (Archive::include_all_members_): New data member.
3080
3081 2011-06-02  Nick Clifton  <nickc@redhat.com>
3082
3083         * dynobj.h: Fix spelling mistake in comment.
3084         * output.cc: Likewise.
3085
3086 2011-05-31  Doug Kwan  <dougkwan@google.com>
3087             Asier Llano
3088
3089         PR gold/12826
3090         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3091         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3092         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3093         redundant arm_exidx_test.so.
3094         * testsuite/Makefile.in: Regenerate.
3095         (check_SCRIPTS): Add pr12826.sh
3096         (check_DATA): Add pr12826.stdout
3097         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3098         * testsuite/pr12826.sh: New file.
3099         * testsuite/pr12826_1.s: Ditto.
3100         * testsuite/pr12826_1.s: Ditto.
3101
3102 2011-05-30  Ian Lance Taylor  <iant@google.com>
3103
3104         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3105         sections.
3106
3107 2011-05-29  Ian Lance Taylor  <iant@google.com>
3108
3109         PR gold/12804
3110         * testsuite/Makefile.am: Use different file name for two_file_test
3111         temporary file for each incremental test.
3112         * testsuite/Makefile.in: Rebuild.
3113
3114 2011-05-29  Ian Lance Taylor  <iant@google.com>
3115
3116         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3117         binary input file is empty.
3118
3119 2011-05-27  Ian Lance Taylor  <iant@google.com>
3120
3121         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3122         (ver_test_9.so): Likewise.
3123         * testsuite/Makefile.in: Rebuild.
3124
3125 2011-05-26 Cary Coutant  <ccoutant@google.com>
3126
3127         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3128         * incremental.cc (Incremental_inputs::report_input_section): Fix
3129         comment, indentation.
3130         (Incremental_inputs::report_comdat_group): New function.
3131         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3132         of data for incremental input file entry.
3133         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3134         group count, COMDAT group signatures.
3135         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3136         an unchanged input file.
3137         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3138         Initialize new data member.
3139         (Incremental_object_entry::add_comdat_group): New function.
3140         (Incremental_object_entry::get_comdat_group_count): New function.
3141         (Incremental_object_entry::get_comdat_signature_key): New function.
3142         (Incremental_object_entry::groups_): New data member.
3143         (Incremental_inputs::report_comdat_group): New function.
3144         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3145         data for incremental input file entry.
3146         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3147         (Incremental_input_entry_reader::get_input_section): Adjust size of
3148         data for incremental input file entry.
3149         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3150         (Incremental_input_entry_reader::get_comdat_group_signature): New
3151         function.
3152         * object.cc (Sized_relobj::include_section_group): Report kept
3153         COMDAT groups for incremental links.
3154
3155 2011-05-24  David Meyer  <pdox@google.com>
3156
3157         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3158         with name parameter.  Add found_name parameter.
3159         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3160         * dirsearch.h (class Dirsearch): Update declaration.
3161
3162 2011-05-24  Ian Lance Taylor  <iant@google.com>
3163
3164         * archive.cc (Library_base::should_include_member): Pull in object
3165         from archive if it defines the entry symbol.
3166         * parameters.cc (Parameters::entry): New function.
3167         * parameters.h (class Parameters): Declare entry.
3168         * output.h (class Output_file_header): Remove entry_ field.
3169         * output.cc (Output_file_header::Output_file_header): Remove entry
3170         parameter.  Change all callers.
3171         (Output_file_header::entry): Use parameters->entry.
3172         * gold.cc (queue_middle_tasks): Likewise.
3173         * plugin.cc (Plugin_hook::run): Likewise.
3174
3175 2011-05-24 Cary Coutant  <ccoutant@google.com>
3176
3177         * gold.cc (queue_initial_tasks): Pass incremental base filename
3178         to Output_file::open_base_file; don't print error message.
3179         * incremental-dump.cc (main): Adjust call to
3180         Output_file::open_for_modification.
3181         * incremental-dump.cc (main): Likewise.
3182         * incremental.cc (Incremental_inputs::report_command_line):
3183         Ignore --incremental-base option when comparing command lines.
3184         Ignore parameter when given as separate argument.
3185         * options.h (class General_options): Add --incremental-base.
3186         * output.cc (Output_file::Output_file):
3187         (Output_file::open_base_file): Add base_name and writable parameters;
3188         read base file into new file; print error message here.
3189         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3190         callers.
3191         * output.h (Output_file::open_for_modification): Rename to...
3192         (Output_file::open_base_file): ...this; add base_name and
3193         writable parameters; adjust all callers.
3194         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3195         callers.
3196         * testsuite/Makefile.am (incremental_test_4): Test
3197         --incremental-base.
3198         * testsuite/Makefile.in: Regenerate.
3199
3200 2011-05-24 Cary Coutant  <ccoutant@google.com>
3201
3202         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3203         incremental_test_4.
3204         * testsuite/Makefile.in: Regenerate.
3205         * testsuite/two_file_test_1_v1.cc: New test source file.
3206         * testsuite/two_file_test_1b_v1.cc: New test source file.
3207         * testsuite/two_file_test_2_v1.cc: New test source file.
3208
3209 2011-05-24 Cary Coutant  <ccoutant@google.com>
3210
3211         * dynobj.h (Dynobj::do_dynobj): New function.
3212         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3213         flag and soname for shared objects.
3214         * incremental.cc (Incremental_inputs::report_object): Make
3215         either Incremental_object_entry or Incremental_dynobj_entry; add
3216         soname to string table.
3217         (Incremental_inputs::report_input_section): Add assertion.
3218         (Output_section_incremental_inputs::set_final_data_size): Adjust
3219         type of input file entry for shared libraries; adjust size of
3220         shared library info entry.
3221         (Output_section_incremental_inputs::write_input_files): Write
3222         as_needed flag for shared libraries.
3223         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3224         of input file entry for shared libraries; write soname.
3225         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3226         soname from incremental info.
3227         * incremental.h (enum Incremental_input_flags): Add
3228         INCREMENTAL_INPUT_AS_NEEDED.
3229         (Incremental_input_entry::Incremental_input_entry): Initialize new
3230         data member.
3231         (Incremental_input_entry::set_as_needed): New function.
3232         (Incremental_input_entry::as_needed): New function.
3233         (Incremental_input_entry::do_dynobj_entry): New function.
3234         (Incremental_input_entry::as_needed_): New data member.
3235         (Incremental_object_entry::Incremental_object_entry): Don't check
3236         for shared library.
3237         (Incremental_object_entry::do_type): Likewise.
3238         (class Incremental_dynobj_entry): New class.
3239         (Incremental_input_entry_reader::as_needed): New function.
3240         (Incremental_input_entry_reader::get_soname): New function.
3241         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3242         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3243         size of shared library info entry.
3244         * layout.cc (Layout::finish_dynamic_section): Don't test for
3245         incremental link when adding DT_NEEDED entries.
3246         * object.h (Object::Object): Initialize new data member.
3247         (Object::dynobj): New function.
3248         (Object::set_as_needed): New function.
3249         (Object::as_needed): New function.
3250         (Object::do_dynobj): New function.
3251         (Object::as_needed_): New data member.
3252
3253 2011-05-24 Cary Coutant  <ccoutant@google.com>
3254
3255         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3256         info; adjust display of GOT entries.
3257         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3258         vector of input objects; remove file_status_.
3259         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3260         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3261         got_plt reader; call target hooks to reserve GOT entries.
3262         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3263         of input file info header and GOT info entry.
3264         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3265         relocation info.
3266         (Got_plt_view_info::got_descriptor): Remove.
3267         (Got_plt_view_info::sym_index): New data member.
3268         (Got_plt_view_info::input_index): New data member.
3269         (Local_got_offset_visitor::visit): Write input file index.
3270         (Global_got_offset_visitor::visit): Write 0 for input file index.
3271         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3272         with sym_index and input_index.
3273         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3274         incremental info GOT entry; replace got_descriptor with input_index.
3275         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3276         map from input file index to object.
3277         (Sized_relobj_incr::do_layout): Replace direct data member reference
3278         with accessor function.
3279         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3280         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3281         Adjust size of input file info header.
3282         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3283         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3284         (Incremental_input_entry_reader::get_input_section): Adjust size of
3285         input file info header.
3286         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3287         of incremental info GOT entry.
3288         (Incremental_got_plt_reader::get_got_desc): Remove.
3289         (Incremental_got_plt_reader::get_got_symndx): New function.
3290         (Incremental_got_plt_reader::get_got_input_index): New function.
3291         (Sized_incremental_binary::Sized_incremental_binary): Remove
3292         file_status_; add input_objects_.
3293         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3294         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3295         (Sized_incremental_binary::file_is_unchanged): Remove.
3296         (Sized_incremental_binary::set_input_object): New function.
3297         (Sized_incremental_binary::input_object): New function.
3298         (Sized_incremental_binary::file_status_): Remove.
3299         (Sized_incremental_binary::input_objects_): New data member.
3300         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3301         references.
3302         (Sized_relobj_incr::invalid_address): Move to base class.
3303         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3304         class.
3305         (Sized_relobj_incr::do_output_section_offset): Likewise.
3306         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3307         (Sized_relobj_incr::section_offsets_): Likewise.
3308         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3309         function.
3310         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3311         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3312         with accessor function.
3313         (Sized_relobj_file::do_layout): Likewise.
3314         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3315         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3316         (Sized_relobj_file::compute_final_local_value): Replace refs to
3317         section_offsets_ with accessor function.
3318         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3319         * object.h (Relobj::Relobj): Initialize new data members.
3320         (Relobj::add_dyn_reloc): New function.
3321         (Relobj::first_dyn_reloc): New function.
3322         (Relobj::dyn_reloc_count): New function.
3323         (Relobj::first_dyn_reloc_): New data member.
3324         (Relobj::dyn_reloc_count_): New data member.
3325         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3326         references.
3327         (Sized_relobj::Address): New typedef.
3328         (Sized_relobj::invalid_address): Move here from child class.
3329         (Sized_relobj::Sized_relobj): Initialize new data members.
3330         (Sized_relobj::sized_relobj): New function.
3331         (Sized_relobj::is_output_section_offset_invalid): Move here from
3332         child class.
3333         (Sized_relobj::get_output_section_offset): Likewise.
3334         (Sized_relobj::local_has_got_offset): Likewise.
3335         (Sized_relobj::local_got_offset): Likewise.
3336         (Sized_relobj::set_local_got_offset): Likewise.
3337         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3338         (Sized_relobj::clear_got_offsets): New function.
3339         (Sized_relobj::section_offsets): Move here from child class.
3340         (Sized_relobj::do_output_section_offset): Likewise.
3341         (Sized_relobj::do_set_section_offset): Likewise.
3342         (Sized_relobj::Local_got_offsets): Likewise.
3343         (Sized_relobj::local_got_offsets_): Likewise.
3344         (Sized_relobj::section_offsets_): Likewise.
3345         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3346         references.
3347         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3348         class.
3349         (Sized_relobj_file::sized_relobj): New function
3350         (Sized_relobj_file::local_has_got_offset): Move to base class.
3351         (Sized_relobj_file::local_got_offset): Likewise.
3352         (Sized_relobj_file::set_local_got_offset): Likewise.
3353         (Sized_relobj_file::get_output_section_offset): Likewise.
3354         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3355         (Sized_relobj_file::do_output_section_offset): Likewise.
3356         (Sized_relobj_file::do_set_section_offset): Likewise.
3357         (Sized_relobj_file::Local_got_offsets): Likewise.
3358         (Sized_relobj_file::local_got_offsets_): Likewise.
3359         (Sized_relobj_file::section_offsets_): Likewise.
3360         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3361         (all constructors).
3362         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3363         (Output_reloc::get_symbol_index): Likewise.
3364         (Output_reloc::local_section_offset): Likewise.
3365         (Output_reloc::get_address): Likewise.
3366         (Output_reloc::symbol_value): Likewise.
3367         (Output_data_got::reserve_slot): Move to class definition.
3368         (Output_data_got::reserve_local): New function.
3369         (Output_data_got::reserve_slot_for_global): Remove.
3370         (Output_data_got::reserve_global): New function.
3371         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3372         (all constructors, two instantiations).
3373         (Output_reloc::get_relobj): New function (two instantiations).
3374         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3375         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3376         (Output_data_reloc::add_global): Adjust type of relobj.
3377         (Output_data_reloc::add_global_relative): Likewise.
3378         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3379         (Output_data_reloc::add_local): Likewise.
3380         (Output_data_reloc::add_local_relative): Likewise.
3381         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3382         (Output_data_reloc::add_local_section): Likewise.
3383         (Output_data_reloc::add_output_section): Likewise.
3384         (Output_data_reloc::add_absolute): Likewise.
3385         (Output_data_reloc::add_target_specific): Likewise.
3386         (Output_data_got::reserve_slot): Move definition here.
3387         (Output_data_got::reserve_local): New function.
3388         (Output_data_got::reserve_global): New function.
3389         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3390         section_offsets_ with accessor function.
3391         (Sized_relobj_file::write_sections): Likewise.
3392         (Sized_relobj_file::do_relocate_sections): Likewise.
3393         * target.h (Sized_target::reserve_local_got_entry): New function.
3394         (Sized_target::reserve_global_got_entry): New function.
3395         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3396         (Target_x86_64::reserve_global_got_entry): New function.
3397         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3398
3399 2011-05-23 Cary Coutant  <ccoutant@google.com>
3400
3401         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3402         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3403         bit when checking got_type.
3404         * incremental.cc (Sized_incremental_binary::setup_readers):
3405         Store symbol table and string table locations; initialize bit vector
3406         of file status flags.
3407         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3408         unchanged files.
3409         (Sized_incremental_binary::do_process_got_plt): New function.
3410         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3411         (Output_section_incremental_inputs::set_final_data_size): Record
3412         file index for each input file.
3413         (Output_section_incremental_inputs::write_got_plt): Store file index
3414         instead of input entry offset for each GOT entry.
3415         * incremental.h
3416         (Incremental_input_entry::Incremental_input_entry): Initialize new
3417         data member.
3418         (Incremental_input_entry::set_offset): Store file index.
3419         (Incremental_input_entry::get_file_index): New function.
3420         (Incremental_input_entry::file_index_): New data member.
3421         (Incremental_binary::process_got_plt): New function.
3422         (Incremental_binary::do_process_got_plt): New function.
3423         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3424         data members.
3425         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3426         (Sized_incremental_binary::set_file_is_unchanged): New function.
3427         (Sized_incremental_binary::file_is_unchanged): New function.
3428         (Sized_incremental_binary::do_process_got_plt): New function.
3429         (Sized_incremental_binary::file_status_): New data member.
3430         (Sized_incremental_binary::main_symtab_loc_): New data member.
3431         (Sized_incremental_binary::main_strtab_loc_): New data member.
3432         * output.cc (Output_data_got::Got_entry::write): Add case
3433         RESERVED_CODE.
3434         (Output_data_got::add_global): Call add_got_entry.
3435         (Output_data_got::add_global_plt): Likewise.
3436         (Output_data_got::add_global_with_rel): Likewise.
3437         (Output_data_got::add_global_with_rela): Likewise.
3438         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3439         (Output_data_got::add_global_pair_with_rela): Likewise.
3440         (Output_data_got::add_local): Call add_got_entry.
3441         (Output_data_got::add_local_plt): Likewise.
3442         (Output_data_got::add_local_with_rel): Likewise.
3443         (Output_data_got::add_local_with_rela): Likewise.
3444         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3445         (Output_data_got::add_local_pair_with_rela): Likewise.
3446         (Output_data_got::reserve_slot): New function.
3447         (Output_data_got::reserve_slot_for_global): New function.
3448         (Output_data_got::add_got_entry): New function.
3449         (Output_data_got::add_got_entry_pair): New function.
3450         (Output_section::add_output_section_data): Edit FIXME.
3451         * output.h
3452         (Output_section_data_build::Output_section_data_build): New
3453         constructor with size parameter.
3454         (Output_data_space::Output_data_space): Likewise.
3455         (Output_data_got::Output_data_got): Initialize new data member; new
3456         constructor with size parameter.
3457         (Output_data_got::add_constant): Call add_got_entry.
3458         (Output_data_got::reserve_slot): New function.
3459         (Output_data_got::reserve_slot_for_global): New function.
3460         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3461         (Output_data_got::add_got_entry): New function.
3462         (Output_data_got::add_got_entry_pair): New function.
3463         (Output_data_got::free_list_): New data member.
3464         * target.h (Sized_target::init_got_plt_for_update): New function.
3465         (Sized_target::register_global_plt_entry): New function.
3466         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3467         Initialize new data member; call init; add constructor with PLT count.
3468         (Output_data_plt_x86_64::init): New function.
3469         (Output_data_plt_x86_64::add_relocation): New function.
3470         (Output_data_plt_x86_64::reserve_slot): New function.
3471         (Output_data_plt_x86_64::free_list_): New data member.
3472         (Target_x86_64::init_got_plt_for_update): New function.
3473         (Target_x86_64::register_global_plt_entry): New function.
3474         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3475         incremental updates.
3476         (Output_data_plt_x86_64::add_relocation): New function.
3477         * testsuite/object_unittest.cc (Object_test): Set default options.
3478
3479 2011-05-16  Ian Lance Taylor  <iant@google.com>
3480
3481         * options.h (class General_options): Make -i a synonym for -r.
3482
3483 2011-05-16  Ian Lance Taylor  <iant@google.com>
3484
3485         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3486
3487 2011-05-10 Cary Coutant  <ccoutant@google.com>
3488
3489         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3490         strip_all (-s).
3491
3492 2011-05-06  Ian Lance Taylor  <iant@google.com>
3493
3494         * layout.cc (Layout::layout): If the output section flags change,
3495         update the ordering.
3496
3497 2011-04-25 Cary Coutant  <ccoutant@google.com>
3498
3499         * incremental-dump.cc (dump_incremental_inputs): Print local
3500         symbol info for each input file.
3501         * incremental.cc
3502         (Output_section_incremental_inputs::set_final_data_size): Add local
3503         symbol info to input file entries in incremental info.
3504         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3505         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3506         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3507         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3508         implementation.
3509         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3510         (Sized_incr_relobj::do_relocate): Write the local symbols.
3511         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3512         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3513         Adjust size of input file header.
3514         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3515         (Incremental_inputs_reader::get_local_symbol_count): New function.
3516         (Incremental_inputs_reader::get_input_section): Adjust size of input
3517         file header.
3518         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3519         (Sized_incr_relobj::This): New typedef.
3520         (Sized_incr_relobj::sym_size): New const data member.
3521         (Sized_incr_relobj::Local_symbol): New struct.
3522         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3523         (Sized_incr_relobj::do_local_symbol_offset): New function.
3524         (Sized_incr_relobj::local_symbol_count_): New data member.
3525         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3526         (Sized_incr_relobj::local_symbol_index_): New data member.
3527         (Sized_incr_relobj::local_symbol_offset_): New data member.
3528         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3529         (Sized_incr_relobj::local_symbols_): New data member.
3530         * object.h (Relobj::output_local_symbol_count): New function.
3531         (Relobj::local_symbol_offset): New function.
3532         (Relobj::do_output_local_symbol_count): New function.
3533         (Relobj::do_local_symbol_offset): New function.
3534         (Sized_relobj::do_output_local_symbol_count): New function.
3535         (Sized_relobj::do_local_symbol_offset): New function.
3536
3537 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3538
3539         * descriptors.cc (set_close_on_exec): New function.
3540         (Descriptors::open): Use set_close_on_exec.
3541         * output.cc (S_ISLNK): Define if not defined.
3542
3543 2011-04-22 Cary Coutant  <ccoutant@google.com>
3544
3545         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3546         global symbol map.
3547         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3548         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3549         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3550         relocations.
3551         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3552         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3553         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3554         * incremental.h
3555         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3556         function.
3557         (Incremental_binary::apply_incremental_relocs): New function.
3558         (Incremental_binary::do_apply_incremental_relocs): New function.
3559         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3560         data member.
3561         (Sized_incremental_binary::add_global_symbol): New function.
3562         (Sized_incremental_binary::global_symbol): New function.
3563         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3564         (Sized_incremental_binary::symbol_map_): New data member.
3565         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3566         * target.h (Sized_target::apply_relocation): New function.
3567         * target-reloc.h (apply_relocation): New function.
3568         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3569
3570 2011-04-22  Doug Kwan  <dougkwan@google.com>
3571
3572         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3573         flag of a SHT_ARM_EXIDX section.
3574         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3575         * testsuite/Makefile.in: Regenerate.
3576         * testsuite/arm_exidx_test.s: New file.
3577         * testsuite/arm_exidx_test.sh: Same.
3578
3579 2011-04-20 Cary Coutant  <ccoutant@google.com>
3580
3581         PR gold/12689
3582         * archive.h (Incremental_archive_entry::Archive_member):
3583         Initialize arg_serial_ (second constructor).
3584
3585 2011-04-17  Ian Lance Taylor  <iant@google.com>
3586
3587         * object.cc (Relocate_info::location): Simplify location string.
3588         * errors.cc (Errors::error_at_location): Don't print program
3589         name.
3590         (Errors::warning_at_location): Likewise.
3591         (Errors::undefined_symbol): Likewise.
3592         * testsuite/debug_msg.sh: Update accordingly.
3593
3594 2011-04-14 Cary Coutant  <ccoutant@google.com>
3595
3596         * gold/layout.cc (Layout::symtab_section_offset): New function.
3597         * gold/layout.h (Layout::symtab_section_offset): New function.
3598         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3599
3600 2011-04-12  Ian Lance Taylor  <iant@google.com>
3601
3602         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3603         with MREMAP_MAYMOVE.
3604         * output.h (class Output_file): Add map_is_allocated_ field.
3605         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3606         not available, provide stubs.  If mremap is not available, #define
3607         it to gold_mremap.
3608         (MREMAP_MAYMOVE): Define if not defined.
3609         (Output_file::Output_file): Initialize map_is_allocated_.
3610         (Output_file::resize): Check map_is_allocated_.
3611         (Output_file::map_anonymous): If mmap fails, use malloc.
3612         (Output_file::unmap): Don't do anything for an anonymous map.
3613         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3614         is not available, provide stubs.
3615         (File_read::View::~View): Use free rather than delete[].
3616         (File_read::make_view): Use malloc rather than new[].  If mmap
3617         fails, use malloc.
3618         (File_read::find_or_make_view): Use malloc rather than new[].
3619         * gold.h: Remove HAVE_REMAP code.
3620         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3621         exists.  Rename mremap to gold_mremap.  If mmap is not available
3622         don't do anything.
3623         * configure, config.in: Rebuild.
3624
3625 2011-04-11  Ian Lance Taylor  <iant@google.com>
3626
3627         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3628         initialize local variable v.
3629
3630 2011-04-11  Cary Coutant  <ccoutant@google.com>
3631
3632         * archive.cc (Archive::include_member): Adjust call to
3633         report_object.
3634         (Add_archive_symbols::run): Track argument serial numbers.
3635         (Lib_group::include_member): Likewise.
3636         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3637         * archive.h (Incremental_archive_entry::Archive_member):
3638         Initialize arg_serial_.
3639         (Archive_member::arg_serial_): New data member.
3640         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3641         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3642         incremental link.
3643         (Sized_dynobj::do_for_all_local_got_entries): New function.
3644         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3645         function.
3646         * fileread.cc (get_mtime): New function.
3647         * fileread.h (get_mtime): New function.
3648         * gold.cc (queue_initial_tasks): Check for incremental update.
3649         (process_incremental_input): New function.
3650         (queue_middle_tasks): Don't force valid target for incremental
3651         update.
3652         * incremental-dump.cc (find_input_containing_global): Adjust
3653         size of symbol info entry.
3654         (dump_incremental_inputs): Dump argument serial number and
3655         in_system_directory flag; bias shndx by 1; print symbol names
3656         when dumping per-file symbol lists; use new symbol info readers.
3657         * incremental.cc
3658         (Output_section_incremental_inputs:update_data_size): New function.
3659         (Sized_incremental_binary::setup_readers): Setup input readers
3660         for each input file; build maps for files added from libraries
3661         and scripts.
3662         (Sized_incremental_binary::check_input_args): New function.
3663         (Sized_incremental_binary::do_check_inputs): Build map of argument
3664         serial numbers to input arguments.
3665         (Sized_incremental_binary::do_file_has_changed): Rename
3666         do_file_is_unchanged to this; compare file modification times.
3667         (Sized_incremental_binary::do_init_layout): New function.
3668         (Sized_incremental_binary::do_reserve_layout): New function.
3669         (Sized_incremental_binary::do_get_input_reader): Remove.
3670         (Sized_incremental_binary::get_symtab_view): New function.
3671         (Incremental_checker::can_incrementally_link_output_file): Remove.
3672         (Incremental_inputs::report_command_line): Exclude --debug options.
3673         (Incremental_inputs::report_archive_begin): Add parameter; track
3674         argument serial numbers; don't put input file entry for archive
3675         before archive members.
3676         (Incremental_inputs::report_archive_end): Put input file entry
3677         for archive after archive members.
3678         (Incremental_inputs::report_object): Add parameter; track argument
3679         serial numbers and in_system_directory flag.
3680         (Incremental_inputs::report_script): Add parameter; track argument
3681         serial numbers.
3682         (Output_section_incremental_inputs::set_final_data_size): Adjust
3683         size of symbol info entry; check for forwarding symbols.
3684         (Output_section_incremental_inputs::write_input_files): Write
3685         in_system_directory flag and argument serial number.
3686         (Output_section_incremental_inputs::write_info_blocks): Map section
3687         indices between incremental info and original input file; store
3688         input section index for each symbol.
3689         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3690         change operator() to visit().
3691         (class Global_got_offset_visitor): Likewise.
3692         (class Global_symbol_visitor_got_plt):
3693         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3694         classes.
3695         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3696         (Sized_incr_relobj::do_read_symbols): New function.
3697         (Sized_incr_relobj::do_layout): New function.
3698         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3699         (Sized_incr_relobj::do_add_symbols): New function.
3700         (Sized_incr_relobj::do_should_include_member): New function.
3701         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3702         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3703         (Sized_incr_relobj::do_section_size): New function.
3704         (Sized_incr_relobj::do_section_name): New function.
3705         (Sized_incr_relobj::do_section_contents): New function.
3706         (Sized_incr_relobj::do_section_flags): New function.
3707         (Sized_incr_relobj::do_section_entsize): New function.
3708         (Sized_incr_relobj::do_section_address): New function.
3709         (Sized_incr_relobj::do_section_type): New function.
3710         (Sized_incr_relobj::do_section_link): New function.
3711         (Sized_incr_relobj::do_section_info): New function.
3712         (Sized_incr_relobj::do_section_addralign): New function.
3713         (Sized_incr_relobj::do_initialize_xindex): New function.
3714         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3715         (Sized_incr_relobj::do_read_relocs): New function.
3716         (Sized_incr_relobj::do_gc_process_relocs): New function.
3717         (Sized_incr_relobj::do_scan_relocs): New function.
3718         (Sized_incr_relobj::do_count_local_symbols): New function.
3719         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3720         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3721         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3722         (Sized_incr_relobj::do_relocate): New function.
3723         (Sized_incr_relobj::do_set_section_offset): New function.
3724         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3725         (Sized_incr_dynobj::do_read_symbols): New function.
3726         (Sized_incr_dynobj::do_layout): New function.
3727         (Sized_incr_dynobj::do_add_symbols): New function.
3728         (Sized_incr_dynobj::do_should_include_member): New function.
3729         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3730         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3731         (Sized_incr_dynobj::do_section_size): New function.
3732         (Sized_incr_dynobj::do_section_name): New function.
3733         (Sized_incr_dynobj::do_section_contents): New function.
3734         (Sized_incr_dynobj::do_section_flags): New function.
3735         (Sized_incr_dynobj::do_section_entsize): New function.
3736         (Sized_incr_dynobj::do_section_address): New function.
3737         (Sized_incr_dynobj::do_section_type): New function.
3738         (Sized_incr_dynobj::do_section_link): New function.
3739         (Sized_incr_dynobj::do_section_info): New function.
3740         (Sized_incr_dynobj::do_section_addralign): New function.
3741         (Sized_incr_dynobj::do_initialize_xindex): New function.
3742         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3743         (make_sized_incremental_object): New function.
3744         (Incremental_library::copy_unused_symbols): New function.
3745         (Incremental_library::do_for_all_unused_symbols): New function.
3746         * incremental.h (enum Incremental_input_flags): New type.
3747         (class Incremental_checker): Remove.
3748         (Incremental_input_entry::Incremental_input_entry): Add argument
3749         serial number.
3750         (Incremental_input_entry::arg_serial): New function.
3751         (Incremental_input_entry::set_is_in_system_directory): New function.
3752         (Incremental_input_entry::is_in_system_directory): New function.
3753         (Incremental_input_entry::arg_serial_): New data member.
3754         (Incremental_input_entry::is_in_system_directory_): New data member.
3755         (class Script_info): Move here from script.h.
3756         (Script_info::Script_info): Add filename parameter.
3757         (Script_info::filename): New function.
3758         (Script_info::filename_): New data member.
3759         (Incremental_script_entry::Incremental_script_entry): Add argument
3760         serial number.
3761         (Incremental_object_entry::Incremental_object_entry): Likewise.
3762         (Incremental_object_entry::add_input_section): Build list of input
3763         sections with map to original shndx.
3764         (Incremental_object_entry::get_input_section_index): New function.
3765         (Incremental_object_entry::shndx_): New data member.
3766         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3767         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3768         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3769         serial number.
3770         (Incremental_inputs::report_archive_begin): Likewise.
3771         (Incremental_inputs::report_object): Likewise.
3772         (Incremental_inputs::report_script): Likewise.
3773         (class Incremental_global_symbol_reader): New class.
3774         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3775         and store flags and input file type.
3776         (Incremental_input_entry_reader::arg_serial): New function.
3777         (Incremental_input_entry_reader::type): Extract type from flags.
3778         (Incremental_input_entry_reader::is_in_system_directory): New function.
3779         (Incremental_input_entry_reader::get_input_section_count): Call
3780         accessor function for type.
3781         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3782         function for type; adjust size of global symbol entry.
3783         (Incremental_input_entry_reader::get_global_symbol_count): Call
3784         accessor function for type.
3785         (Incremental_input_entry_reader::get_object_count): Likewise.
3786         (Incremental_input_entry_reader::get_object_offset): Likewise.
3787         (Incremental_input_entry_reader::get_member_count): Likewise.
3788         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3789         (Incremental_input_entry_reader::get_member_offset): Likewise.
3790         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3791         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3792         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3793         (Incremental_input_entry_reader::get_global_symbol_reader): New
3794         function.
3795         (Incremental_input_entry_reader::get_output_symbol_index): New
3796         function.
3797         (Incremental_input_entry_reader::type_): Remove.
3798         (Incremental_input_entry_reader::flags_): New data member.
3799         (Incremental_inputs_reader::input_file_offset): New function.
3800         (Incremental_inputs_reader::input_file_index): New function.
3801         (Incremental_inputs_reader::input_file): Call input_file_offset.
3802         (Incremental_inputs_reader::input_file_at_offset): New function.
3803         (Incremental_relocs_reader::get_r_type): Reformat.
3804         (Incremental_relocs_reader::get_r_shndx): Reformat.
3805         (Incremental_relocs_reader::get_r_offset): Reformat.
3806         (Incremental_relocs_reader::data): New function.
3807         (Incremental_binary::Incremental_binary): Initialize new data members.
3808         (Incremental_binary::check_inputs): Add cmdline parameter.
3809         (Incremental_binary::file_is_unchanged): Remove.
3810         (Input_reader::arg_serial): New function.
3811         (Input_reader::get_unused_symbol_count): New function.
3812         (Input_reader::get_unused_symbol): New function.
3813         (Input_reader::do_arg_serial): New function.
3814         (Input_reader::do_get_unused_symbol_count): New function.
3815         (Input_reader::do_get_unused_symbol): New function.
3816         (Incremental_binary::input_file_count): New function.
3817         (Incremental_binary::get_input_reader): Change signature to use
3818         index instead of filename.
3819         (Incremental_binary::file_has_changed): New function.
3820         (Incremental_binary::get_input_argument): New function.
3821         (Incremental_binary::get_library): New function.
3822         (Incremental_binary::get_script_info): New function.
3823         (Incremental_binary::init_layout): New function.
3824         (Incremental_binary::reserve_layout): New function.
3825         (Incremental_binary::output_file): New function.
3826         (Incremental_binary::do_check_inputs): New function.
3827         (Incremental_binary::do_file_is_unchanged): Remove.
3828         (Incremental_binary::do_file_has_changed): New function.
3829         (Incremental_binary::do_init_layout): New function.
3830         (Incremental_binary::do_reserve_layout): New function.
3831         (Incremental_binary::do_input_file_count): New function.
3832         (Incremental_binary::do_get_input_reader): Change signature.
3833         (Incremental_binary::input_args_map_): New data member.
3834         (Incremental_binary::library_map_): New data member.
3835         (Incremental_binary::script_map_): New data member.
3836         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3837         new data members.
3838         (Sized_incremental_binary::output_section): New function.
3839         (Sized_incremental_binary::inputs_reader): Add const.
3840         (Sized_incremental_binary::symtab_reader): Add const.
3841         (Sized_incremental_binary::relocs_reader): Add const.
3842         (Sized_incremental_binary::got_plt_reader): Add const.
3843         (Sized_incremental_binary::get_symtab_view): New function.
3844         (Sized_incremental_binary::Inputs_reader): New typedef.
3845         (Sized_incremental_binary::Input_entry_reader): New typedef.
3846         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3847         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3848         (Sized_incremental_binary::do_file_has_changed): New function.
3849         (Sized_incremental_binary::do_init_layout): New function.
3850         (Sized_incremental_binary::do_reserve_layout): New function.
3851         (Sized_input_reader::Inputs_reader): Remove.
3852         (Sized_input_reader::Input_entry_reader): Remove.
3853         (Sized_input_reader::do_arg_serial): New function.
3854         (Sized_input_reader::do_get_unused_symbol_count): New function.
3855         (Sized_input_reader::do_get_unused_symbol): New function.
3856         (Sized_incremental_binary::do_input_file_count): New function.
3857         (Sized_incremental_binary::do_get_input_reader): Change signature;
3858         use index instead of filename.
3859         (Sized_incremental_binary::section_map_): New data member.
3860         (Sized_incremental_binary::input_entry_readers_): New data member.
3861         (class Sized_incr_relobj): New class.
3862         (class Sized_incr_dynobj): New class.
3863         (make_sized_incremental_object): New function.
3864         (class Incremental_library): New class.
3865         * layout.cc (Free_list::num_lists): New static data member.
3866         (Free_list::num_nodes): New static data member.
3867         (Free_list::num_removes): New static data member.
3868         (Free_list::num_remove_visits): New static data member.
3869         (Free_list::num_allocates): New static data member.
3870         (Free_list::num_allocate_visits): New static data member.
3871         (Free_list::init): New function.
3872         (Free_list::remove): New function.
3873         (Free_list::allocate): New function.
3874         (Free_list::dump): New function.
3875         (Free_list::print_stats): New function.
3876         (Layout_task_runner::run): Resize output file for incremental updates.
3877         (Layout::Layout): Initialize new data members.
3878         (Layout::set_incremental_base): New function.
3879         (Layout::init_fixed_output_section): New function.
3880         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3881         incremental updates.
3882         (Layout::create_gold_note): Do not create gold note section for
3883         incremental updates.
3884         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3885         for incremental updates.
3886         (Layout::set_section_offsets): For incremental updates, allocate space
3887         from free list.
3888         (Layout::create_symtab_sections): Layout with offsets relative to
3889         start of section; for incremental updates, allocate space from free
3890         list.
3891         (Layout::create_shdrs): For incremental updates, allocate space from
3892         free list.
3893         (Layout::finish_dynamic_section): For incremental updates, do not
3894         check --as-needed (fixed in subsequent patch).
3895         * layout.h (class Free_list): New class.
3896         (Layout::set_incremental_base): New function.
3897         (Layout::incremental_base): New function.
3898         (Layout::init_fixed_output_section): New function.
3899         (Layout::allocate): New function.
3900         (Layout::incremental_base_): New data member.
3901         (Layout::free_list_): New data member.
3902         * main.cc (main): Print Free_list statistics.
3903         * object.cc (Relobj::finalize_incremental_relocs): Add
3904         clear_counts parameter; clear counts only when clear_counts is set.
3905         (Sized_relobj::Sized_relobj): Initialize new base class.
3906         (Sized_relobj::do_layout): Don't report special sections.
3907         (Sized_relobj::do_for_all_local_got_entries): New function.
3908         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3909         symtab_off to all symbol table offsets.
3910         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3911         * object.h (class Got_offset_list): Move to top of file.
3912         (Object::Object): Allow case where input_file == NULL.
3913         (Object::~Object): Likewise.
3914         (Object::input_file): Assert that input_file != NULL.
3915         (Object::lock): Allow case where input_file == NULL.
3916         (Object::unlock): Likewise.
3917         (Object::is_locked): Likewise.
3918         (Object::token): Likewise.
3919         (Object::release): Likewise.
3920         (Object::is_incremental): New function.
3921         (Object::get_mtime): New function.
3922         (Object::for_all_local_got_entries): New function.
3923         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3924         (Object::set_is_in_system_directory): New function.
3925         (Object::is_in_system_directory): New function.
3926         (Object::do_is_incremental): New function.
3927         (Object::do_get_mtime): New function.
3928         (Object::do_for_all_local_got_entries): New function.
3929         (Object::is_in_system_directory_): New data member.
3930         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3931         (class Sized_relobj_base): New class.
3932         (class Sized_relobj): Derive from Sized_relobj_base.
3933         (class Sized_relobj::Symbols): Redeclare from base class.
3934         (class Sized_relobj::local_got_offset_list): Remove.
3935         (class Sized_relobj::Output_sections): Redeclare from base class.
3936         (class Sized_relobj::do_for_all_local_got_entries): New function.
3937         (class Sized_relobj::write_local_symbols): Add offset parameter.
3938         (class Sized_relobj::local_symbol_offset_): Update comment.
3939         (class Sized_relobj::local_dynsym_offset_): Update comment.
3940         * options.cc (Input_arguments::add_file): Remove const.
3941         * options.h (Input_file_argument::Input_file_argument):
3942         Initialize arg_serial_ (all constructors).
3943         (Input_file_argument::set_arg_serial): New function.
3944         (Input_file_argument::arg_serial): New function.
3945         (Input_file_argument::arg_serial_): New data member.
3946         (Input_arguments::Input_arguments): Initialize file_count_.
3947         (Input_arguments::add_file): Remove const.
3948         (Input_arguments::number_of_input_files): New function.
3949         (Input_arguments::file_count_): New data member.
3950         (Command_line::number_of_input_files): Call
3951         Input_arguments::number_of_input_files.
3952         * output.cc (Output_segment_headers::Output_segment_headers):
3953         Set current size.
3954         (Output_section::Input_section::current_data_size): New function.
3955         (Output_section::Output_section): Initialize new data members.
3956         (Output_section::add_input_section): Don't do merge sections for
3957         an incremental link; allocate space from free list for an
3958         incremental update.
3959         (Output_section::add_output_section_data): Allocate space from
3960         free list for an incremental update.
3961         (Output_section::update_data_size): New function.
3962         (Output_section::set_fixed_layout): New function.
3963         (Output_section::reserve): New function.
3964         (Output_segment::set_section_addresses): Remove const.
3965         (Output_segment::set_section_list_addresses): Remove const; allocate
3966         space from free list for an incremental update.
3967         (Output_segment::set_offset): Adjust size of RELRO segment for an
3968         incremental update.
3969         * output.h (Output_data::current_data_size): Move here from
3970         child classes.
3971         (Output_data::pre_finalize_data_size): New function.
3972         (Output_data::update_data_size): New function.
3973         (Output_section_headers::update_data_size): new function.
3974         (Output_section_data_build::current_data_size): Move to Output_data.
3975         (Output_data_strtab::update_data_size): New function.
3976         (Output_section::current_data_size): Move to Output_data.
3977         (Output_section::set_fixed_layout): New function.
3978         (Output_section::has_fixed_layout): New function.
3979         (Output_section::reserve): New function.
3980         (Output_section::update_data_size): New function.
3981         (Output_section::has_fixed_layout_): New data member.
3982         (Output_section::free_list_): New data member.
3983         (Output_segment::set_section_addresses): Remove const.
3984         (Output_segment::set_section_list_addresses): Remove const.
3985         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3986         New function.
3987         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3988         New function.
3989         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3990         parameter when calling Add_symbols constructor; store argument
3991         serial number for members of a lib group.
3992         (Add_symbols::locks): Allow case where token == NULL.
3993         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3994         (Read_member::~Read_member): New function.
3995         (Read_member::is_runnable): New function.
3996         (Read_member::locks): New function.
3997         (Read_member::run): New function.
3998         (Check_script::~Check_script): New function.
3999         (Check_script::is_runnable): New function.
4000         (Check_script::locks): New function.
4001         (Check_script::run): New function.
4002         (Check_library::~Check_library): New function.
4003         (Check_library::is_runnable): New function.
4004         (Check_library::locks): New function.
4005         (Check_library::run): New function.
4006         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4007         (Add_symbols::library_): New data member.
4008         (class Read_member): New class.
4009         (class Check_script): New class.
4010         (class Check_library): New class.
4011         * reloc.cc (Read_relocs::is_runnable): Allow case where
4012         token == NULL.
4013         (Read_relocs::locks): Likewise.
4014         (Scan_relocs::locks): Likewise.
4015         (Relocate_task::locks): Likewise.
4016         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4017         to clear counters.
4018         (Sized_relobj::incremental_relocs_scan): Fix comment.
4019         (Sized_relobj::do_relocate): Pass output file offset to
4020         write_local_symbols.
4021         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4022         from class declaration.
4023         * script.cc (read_input_script): Allocate Script_info; pass
4024         argument serial number to report_script.
4025         * script.h (class Script_info): Move to incremental.h.
4026         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4027         * symtab.h (Symbol_table::add_from_incrobj): New function.
4028         (Symbol_table::set_file_offset): New function.
4029
4030 2011-04-05  Cary Coutant  <ccoutant@google.com>
4031
4032         * incremental-dump.cc (dump_incremental_inputs): Change signature
4033         to take a Sized_incremental_binary; change caller.  Use readers
4034         in Sized_incremental_binary.
4035         * incremental.cc
4036         (Sized_incremental_binary::find_incremental_inputs_sections):
4037         Rename do_find_incremental_inputs_sections to this.
4038         (Sized_incremental_binary::setup_readers): New function.
4039         (Sized_incremental_binary::do_check_inputs): Check
4040         has_incremental_info_ flag; move setup code to setup_readers;
4041         use input readers.
4042         (Sized_incremental_binary::do_file_is_unchanged): New function.
4043         (Sized_incremental_binary::do_get_input_reader): New function.
4044         * incremental.h (class Incremental_binary): Move to end of file.
4045         (Incremental_binary::file_is_unchanged): New function.
4046         (Incremental_binary::do_file_is_unchanged): New function.
4047         (Incremental_binary::Input_reader): New class.
4048         (Incremental_binary::get_input_reader): New function.
4049         (class Sized_incremental_binary): Move to end of file.
4050         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4051         input section reader classes.
4052         (Sized_incremental_binary::has_incremental_info): New function.
4053         (Sized_incremental_binary::inputs_reader): New function.
4054         (Sized_incremental_binary::symtab_reader): New function.
4055         (Sized_incremental_binary::relocs_reader): New function.
4056         (Sized_incremental_binary::got_plt_reader): New function.
4057         (Sized_incremental_binary::do_file_is_unchanged): New function.
4058         (Sized_incremental_binary::Sized_input_reader): New class.
4059         (Sized_incremental_binary::get_input_reader): New function.
4060         (Sized_incremental_binary::find_incremental_inputs_sections):
4061         Rename do_find_incremental_inputs_sections to this.
4062         (Sized_incremental_binary::setup_readers): New function.
4063         (Sized_incremental_binary::has_incremental_info_): New data member.
4064         (Sized_incremental_binary::inputs_reader_): New data member.
4065         (Sized_incremental_binary::symtab_reader_): New data member.
4066         (Sized_incremental_binary::relocs_reader_): New data member.
4067         (Sized_incremental_binary::got_plt_reader_): New data member.
4068         (Sized_incremental_binary::current_input_file_): New data member.
4069
4070 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4071
4072         PR gold/12640
4073         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4074         violation.
4075
4076 2011-03-30  Cary Coutant  <ccoutant@google.com>
4077
4078         * archive.cc (Archive::include_member): Adjust call to report_object.
4079         (Add_archive_symbols::run): Add script_info to call to
4080         report_archive_begin.
4081         (Lib_group::include_member): Adjust call to report_object.
4082         (Add_lib_group_symbols::run): Adjust call to report_object.
4083         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4084         blocks.  Add object count for script input files.
4085         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4086         script_info parameter; change all callers.
4087         (Incremental_inputs::report_object): Add script_info parameter;
4088         change all callers.
4089         (Incremental_inputs::report_script): Store backpointer to
4090         incremental info entry.
4091         (Output_section_incremental_inputs::set_final_data_size): Record
4092         additional information for scripts.
4093         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4094         * incremental.h (Incremental_script_entry::add_object): New function.
4095         (Incremental_script_entry::get_object_count): New function.
4096         (Incremental_script_entry::get_object): New function.
4097         (Incremental_script_entry::objects_): New data member; adjust
4098         constructor.
4099         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4100         (Incremental_inputs::report_object): Add script_info parameter.
4101         (Incremental_inputs_reader::get_object_count): New function.
4102         (Incremental_inputs_reader::get_object_offset): New function.
4103         * options.cc (Input_arguments::add_file): Return reference to
4104         new input argument.
4105         * options.h (Input_argument::set_script_info): New function.
4106         (Input_argument::script_info): New function.
4107         (Input_argument::script_info_): New data member; adjust all
4108         constructors.
4109         (Input_file_group::add_file): Return reference to new input argument.
4110         (Input_file_lib::add_file): Likewise.
4111         (Input_arguments::add_file): Likewise.
4112         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4113         * script.cc (Parser_closure::Parser_closure): Add script_info
4114         parameter; adjust all callers.
4115         (Parser_closure::script_info): New function.
4116         (Parser_closure::script_info_): New data member.
4117         (read_input_script): Report scripts earlier to incremental info.
4118         (script_add_file): Set script_info in Input_argument.
4119         (script_add_library): Likewise.
4120         * script.h (Script_options::Script_info): Rewrite class.
4121
4122 2011-03-29  Cary Coutant  <ccoutant@google.com>
4123
4124         * archive.cc (Library_base::should_include_member): Move
4125         method here from class Archive.
4126         (Archive::Archive): Initialize base class.
4127         (Archive::should_include_member): Move to base class.
4128         (Archive::do_for_all_unused_symbols): New function.
4129         (Add_archive_symbols::run): Remove redundant access to
4130         incremental_inputs.
4131         (Lib_group::Lib_group): Initialize base class.
4132         (Lib_group::do_filename): New function.
4133         (Lib_group::include_member): Pass pointer to Lib_group to
4134         report_object.
4135         (Lib_group::do_for_all_unused_symbols): New function.
4136         (Add_lib_group_symbols::run): Report archive information for
4137         incremental links.
4138         * archive.h (class Library_base): New base class.
4139         (class Archive): Derive from Library_base.
4140         (Archive::filename): Move to base class.
4141         (Archive::set_incremental_info): Likewise.
4142         (Archive::incremental_info): Likewise.
4143         (Archive::Should_include): Likewise.
4144         (Archive::should_include_member): Likewise.
4145         (Archive::Armap_entry): Remove.
4146         (Archive::Unused_symbol_iterator): Remove.
4147         (Archive::unused_symbols_begin): Remove.
4148         (Archive::unused_symbols_end): Remove.
4149         (Archive::do_filename): New function.
4150         (Archive::do_get_mtime): New function.
4151         (Archive::do_for_all_unused_symbols): New function.
4152         (Archive::task_): Move to base class.
4153         (Archive::incremental_info_): Likewise.
4154         (class Lib_group): Derive from Library_base.
4155         (Lib_group::do_filename): New function.
4156         (Lib_group::do_get_mtime): New function.
4157         (Lib_group::do_for_all_unused_symbols): New function.
4158         (Lib_group::task_): Move to base class.
4159         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4160         function.
4161         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4162         function.
4163         * incremental.cc (Incremental_inputs::report_archive_begin):
4164         Use Library_base; call library's get_mtime; add incremental inputs
4165         entry before members.
4166         (class Unused_symbol_visitor): New class.
4167         (Incremental_inputs::report_archive_end): Use Library_base; use
4168         visitor class to record unused symbols; don't add incremental inputs
4169         entry after members.
4170         (Incremental_inputs::report_object): Use Library_base.
4171         * incremental.h
4172         (Incremental_archive_entry::Incremental_archive_entry): Remove
4173         unused Archive parameter.
4174         (Incremental_inputs::report_archive_begin): Use Library_base.
4175         (Incremental_inputs::report_archive_end): Likewise.
4176         (Incremental_inputs::report_object): Likewise.
4177         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4178         function.
4179         * object.h (Object::for_all_global_symbols): New function.
4180         (Object::do_for_all_global_symbols): New function.
4181         (Sized_relobj::do_for_all_global_symbols): New function.
4182         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4183         function.
4184         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4185         function.
4186
4187 2011-03-27  Ian Lance Taylor  <iant@google.com>
4188
4189         * archive.cc (Archive::interpret_header): Return -1 if something
4190         goes wrong.  Change callers accordingly.
4191
4192 2011-03-25  Cary Coutant  <ccoutant@google.com>
4193
4194         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4195         * testsuite/Makefile.in: Regenerate.
4196
4197 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4198
4199         * plugin.cc (get_view): New.
4200         (Plugin::load): Pass get_view to the plugin.
4201         (Plugin_manager::get_view): New.
4202
4203 2011-03-21  Ian Lance Taylor  <iant@google.com>
4204
4205         * testsuite/final_layout.sh: Rewrite to not use dc.
4206         * testsuite/relro_test.sh: Fail if dc is not present.
4207
4208 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4209
4210         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4211         Change == to -eq.
4212         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4213         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4214         Change == to -eq.
4215         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4216         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4217
4218 2011-03-14  Ian Lance Taylor  <iant@google.com>
4219
4220         * script-sections.cc (Sort_output_sections::script_compare):
4221         Rename from is_before, change return type.
4222         (Sort_output_sections::operator()): Adjust accordingly.
4223
4224 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4225
4226         PR gold/12572
4227         * testsuite/odr_violation2.cc: Add comment to make all error line
4228         numbers double digits.
4229         * testsuite/debug_msg.sh: Adjust expected errors.
4230
4231 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4232
4233         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4234         but mark earlier ones as non-canonical
4235         (offset_to_iterator): Update search target and example
4236         (do_addr2line): Return extra lines in a vector*
4237         (format_file_lineno): Extract from do_addr2line
4238         (one_addr2line): Add vector* out-param
4239         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4240         when a lineno entry appeared last for its instruction
4241         (Dwarf_line_info): Add vector* out-param
4242         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4243         * symtab.cc (Odr_violation_compare): Include the lineno in the
4244         comparison again.
4245         (linenos_from_loc): New. Combine the canonical line for an
4246         address with its other lines.
4247         (True_if_intersect): New. Helper functor to make
4248         std::set_intersection a query.
4249         (detect_odr_violations): Compare sets of lines instead of just
4250         one line for each function. This became less deterministic, but
4251         has fewer false positives.
4252         * symtab.h: Declarations.
4253         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4254         mix an optimized and non-optimized object in the same binary
4255         (odr_violation2.so): Same.
4256         * testsuite/Makefile.in: Regenerate from Makefile.am.
4257         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4258         * testsuite/debug_msg.sh: Update line numbers and add
4259         assertions.
4260         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4261         non-optimized context.
4262         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4263         isn't inlined, and use OdrDerived in an optimized context.
4264         * testsuite/odr_header1.h: Defines OdrDerived, where
4265         optimization will change the
4266         first-instruction-in-the-destructor's file and line number.
4267         * testsuite/odr_header2.h: Defines OdrBase.
4268
4269 2011-03-09  Ian Lance Taylor  <iant@google.com>
4270
4271         * fileread.cc (File_read::clear_views): Don't delete the whole
4272         file view.
4273
4274 2011-03-08  Ian Lance Taylor  <iant@google.com>
4275
4276         PR gold/12525
4277         * fileread.cc: #include <climits>.
4278         (GOLD_IOV_MAX): Define.
4279         (File_read::read_multiple): Limit number of entries by iov_max.
4280         * fileread.h (class File_read): Always set max_readv_entries to
4281         128.
4282
4283 2011-03-07  Ian Lance Taylor  <iant@google.com>
4284
4285         PR gold/12525
4286         * options.h (class General_options): Add -dy and -dn.
4287
4288 2011-03-02  Cary Coutant  <ccoutant@google.com>
4289
4290         * testsuite/script_test_9.t: Add TLS segment.
4291
4292 2011-03-02  Simon Baldwin  <simonb@google.com>
4293
4294         * configure.ac: Add check for gnu_indirect_function support in
4295         the toolchain building binutils.
4296         * configure: Rebuild.
4297
4298 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4299
4300         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4301         plugin only symbols.
4302         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4303         in plugin files as not needed in the symbol table.
4304
4305 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4306
4307         * output.cc (Output_section::add_input_section): Delay fill
4308         generation for section ordering.
4309
4310 2011-02-09  Ian Lance Taylor  <iant@google.com>
4311
4312         PR gold/12316
4313         * object.h (class Sized_relobj): Remove clear_local_symbols.
4314         * reloc.cc (Sized_relobj::do_relocate): Don't call
4315         clear_local_symbols.
4316
4317 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4318
4319         * plugin.cc (is_visible_from_outside): Return true for symbols
4320         in the -u option.
4321
4322 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4323
4324         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4325         filename.
4326
4327 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4328
4329         * icf.h (is_section_foldable_candidate): Change type of parameter
4330         to std::string.
4331         * icf.cc (Icf::find_identical_sections): Change type of local variable
4332         section_name to be std::string.
4333         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4334
4335 2011-01-25  Ian Lance Taylor  <iant@google.com>
4336
4337         * script.cc (script_add_extern): Rewrite to use
4338         add_symbol_reference.
4339
4340 2011-01-25  Doug Kwan  <dougkwan@google.com>
4341
4342         * icf.cc (get_section_contents): Always lock section's object.
4343
4344 2011-01-24  Ian Lance Taylor  <iant@google.com>
4345
4346         * options.h (class General_options): Accept
4347         --no-detect-odr-violations.
4348
4349 2011-01-24  Ian Lance Taylor  <iant@google.com>
4350
4351         * version.cc (version_string): Bump to 1.11.
4352
4353 2011-01-24  Ian Lance Taylor  <iant@google.com>
4354
4355         * plugin.cc (class Plugin_rescan): Define new class.
4356         (Plugin_manager::claim_file): Set any_claimed_.
4357         (Plugin_manager::save_archive): New function.
4358         (Plugin_manager::save_input_group): New function.
4359         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4360         necessary.
4361         (Plugin_manager::new_undefined_symbol): New function.
4362         (Plugin_manager::rescan): New function.
4363         (Plugin_manager::rescannable_defines): New function.
4364         (Plugin_manager::add_input_file): Set any_added_.
4365         * plugin.h (class Plugin_manager): define new fields rescannable_,
4366         undefined_symbols_, any_claimed_, and any_added_.  Declare
4367         Plugin_rescan as friend.  Declare new functions.
4368         (Plugin_manager::Rescannable): Define type.
4369         (Plugin_manager::Rescannable_list): Define type.
4370         (Plugin_manager::Undefined_symbol_list): Define type.
4371         (Plugin_manager::Plugin_manager): Initialize new fields.
4372         * archive.cc (Archive::defines_symbol): New function.
4373         (Add_archive_symbols::run): Pass archive to plugins if any.
4374         * archive.h (class Archive): Declare defines_symbol.
4375         * readsyms.cc (Input_group::~Input_group): New function.
4376         (Finish_group::run): Pass input_group to plugins if any.
4377         * readsyms.h (class Input_group): Declare destructor.
4378         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4379         any.
4380
4381 2011-01-10  Ian Lance Taylor  <iant@google.com>
4382
4383         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4384         section as relro.
4385         (Layout::set_segment_offsets): Reset increase_relro before calling
4386         set_section_addresses a second time.
4387
4388 2011-01-04  Cary Coutant  <ccoutant@google.com>
4389
4390         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4391         sections before NOBITS sections.
4392
4393 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4394
4395         * version.cc (print_version): Update copyright to 2011.
4396
4397 2010-12-23  Cary Coutant  <ccoutant@google.com>
4398
4399         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4400         of OS to this->add.  Add OD parameter to second form of the function.
4401
4402 2010-12-20  Ian Lance Taylor  <iant@google.com>
4403
4404         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4405         second of two consecutive entries with same offset.
4406
4407 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4408
4409         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4410         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4411         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4412         to avoid unneeded links against $(LDADD).
4413         * testsuite/Makefile.in: Regenerate.
4414
4415 2010-12-15  Ian Lance Taylor  <iant@google.com>
4416
4417         PR gold/12324
4418         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4419         for R_X86_64_32 and R_X86_64_PC32.
4420         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4421         ver_matching_def_pic.o.
4422         (ver_matching_def_pic.o): New target.
4423
4424 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4425
4426         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4427         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4428         Move definition before File_read::View member definitions.
4429         (File_read::View::~View): Initialize and hold lock before
4430         updating current_mapped_bytes.
4431
4432 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4433
4434         * dwarf_reader.cc: Remove outdated comment.
4435         * gold-threads.cc: Fix typo in error message.
4436         * archive.cc: Fix typos in comments.
4437         * archive.h: Likewise.
4438         * arm-reloc-property.cc: Likewise.
4439         * arm-reloc-property.h: Likewise.
4440         * arm-reloc.def: Likewise.
4441         * arm.cc: Likewise.
4442         * attributes.h: Likewise.
4443         * cref.cc: Likewise.
4444         * ehframe.cc: Likewise.
4445         * fileread.h: Likewise.
4446         * gold.h: Likewise.
4447         * i386.cc: Likewise.
4448         * icf.cc: Likewise.
4449         * incremental.h: Likewise.
4450         * int_encoding.cc: Likewise.
4451         * layout.h: Likewise.
4452         * main.cc: Likewise.
4453         * merge.h: Likewise.
4454         * object.cc: Likewise.
4455         * object.h: Likewise.
4456         * options.cc: Likewise.
4457         * readsyms.cc: Likewise.
4458         * reduced_debug_output.cc: Likewise.
4459         * reloc.cc: Likewise.
4460         * script-sections.cc: Likewise.
4461         * sparc.cc: Likewise.
4462         * symtab.h: Likewise.
4463         * target-reloc.h: Likewise.
4464         * target.cc: Likewise.
4465         * target.h: Likewise.
4466         * timer.cc: Likewise.
4467         * timer.h: Likewise.
4468         * x86_64.cc: Likewise.
4469
4470 2010-12-09  Cary Coutant  <ccoutant@google.com>
4471
4472         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4473         stack.
4474         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4475         parameter; change all callers.
4476         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4477         * options.h (warn_execstack): New option.
4478
4479 2010-12-07  Doug Kwan  <dougkwan@google.com>
4480
4481         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4482         like function call relocations.
4483
4484 2010-12-07  Ian Lance Taylor  <iant@google.com>
4485
4486         * archive.cc (Archive::get_elf_object_for_member): Permit
4487         punconfigured to be NULL.
4488         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4489         (Archive::include_member): Pass NULL to get_elf_object_for_member
4490         if we searched for the archive and this is the first included
4491         object.
4492
4493 2010-12-01  Ian Lance Taylor  <iant@google.com>
4494
4495         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4496         track_relocs_type_ field.
4497         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4498         Set track_relocs_type_.
4499         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4500         contents when using RELA relocs.
4501         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4502         reloc_map_.
4503         * reloc.cc (Track_relocs::next_addend): New function.
4504         * reloc.h (class Track_relocs): Declare next_addend.
4505
4506 2010-12-01  Ian Lance Taylor  <iant@google.com>
4507
4508         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4509         virtual destructor.
4510
4511 2010-12-01  Ian Lance Taylor  <iant@google.com>
4512
4513         * README: Update compilers known to work and fail.
4514
4515 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4516
4517         * configure.in: For --enable-gold, handle value `default' instead of
4518         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4519         not the default.
4520         * configure: Regenerate.
4521
4522 2010-11-18  Doug Kwan  <dougkwan@google.com>
4523
4524         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4525         and right_alignment to be zero.  Store result alignment only if it is
4526         greater than existing alignment.
4527
4528 2010-11-16  Cary Coutant  <ccoutant@google.com>
4529
4530         PR gold/12220
4531         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4532         Check for ".zdebug_line".
4533
4534 2010-11-16  Doug Kwan  <dougkwan@google.com>
4535             Cary Coutant  <ccoutant@google.com>
4536
4537         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4538         by reference; adjust all callers.
4539         * output.cc (Output_segment::set_section_addresses): Adjust references
4540         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4541         list is empty.
4542         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4543         end at page boundary.
4544
4545 2010-11-16  Cary Coutant  <ccoutant@google.com>
4546
4547         PR gold/12220
4548         * layout.cc (Layout::choose_output_section): Transform names of
4549         compressed sections even when using a script with a SECTIONS clause.
4550         (Layout::output_section_name): Remove code to transform
4551         compressed debug section names.
4552         * output.cc (Output_section::add_input_section): Use uncompressed
4553         section size when tracking input sections.
4554
4555 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4556
4557         * symtab.h (Symbol::NON_PIC_REF): Remove.
4558         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4559         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4560         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4561         (Symbol::use_plt_offset): Take a flags argument and pass it
4562         directly to needs_dynamic_reloc.  Restrict check for undefined
4563         weak symbols to function calls.
4564         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4565         (Target_arm::Scan::global): Use it.
4566         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4567         (Target_arm::Relocate::relocate): Likewise.
4568         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4569         parameter with an r_type parameter.  Use get_reference_flags
4570         to get the flags.
4571         (Target_arm::Relocate::relocate): Update accordingly.
4572         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4573         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4574         (Target_i386::Scan::global): Likewise.
4575         (Target_i386::Relocate::relocate): Likewise.
4576         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4577         parameter with an r_type parameter.  Use get_reference_flags
4578         to get the flags.
4579         (Target_i386::Relocate::relocate): Update accordingly.
4580         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4581         (Target_powerpc::Scan::global): Use it.
4582         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4583         (Target_powerpc::Relocate::relocate): Likewise.
4584         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4585         (Target_sparc::Scan::global): Use it.
4586         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4587         (Target_sparc::Relocate::relocate): Likewise.
4588         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4589         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4590         (Target_x86_64::Scan::global): Likewise.
4591         (Target_x86_64::Relocate::relocate): Likewise.
4592
4593 2010-11-08  Doug Kwan  <dougkwan@google.com>
4594             Cary Coutant  <ccoutant@google.com>
4595
4596         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4597         (Arm_exidx_merge_section::section_contents_): New data member.
4598         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4599         (Arm_input_section::~Arm_input_section): De-allocate memory.
4600         (Arm_input_section::original_contents_): New data member.
4601         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4602         in parameters instead of calling Object::section_contents without
4603         locking.
4604         (Arm_output_section::group_section): New parameter TASK.  Pass it
4605         to callees that need locking objects.
4606         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4607         to lock EXIDX input sections.  Fix a formatting issue.  Call
4608         Arm_exidx_merged_section::build_contents to create merged section
4609         contents.
4610         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4611         to lock object of stub table owner.
4612         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4613         TEXT_SIZE to initialize data member TEXT_SIZE_.
4614         (Arm_exidx_input_section::addralign): Fix typo in comment.
4615         (Arm_exidx_input_section::text_size): New method.
4616         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4617         that require locking objects.  Lock objects before scanning for stubs
4618         and updating local symbols.
4619         (Arm_input_section<big_endian>::init): Copy contents of original
4620         input section.
4621         (Arm_input_section<big_endian>::do_write): Use saved contents of
4622         original input section instead of calling Object::section_contents
4623         without locking.
4624         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4625         size without calling Object::section_size().
4626         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4627         for size.  Allocate a buffer for merged EXIDX entries.
4628         (Arm_exidx_merged_section::build_contents): New method.
4629         (Arm_exidx_merged_section::do_write): Move merge section contents
4630         building code to Arm_exidx_merged_section::build_contetns.  Write
4631         out contetns in buffer instead of building it on the fly.
4632         (Arm_relobj::make_exidx_input_section): Also pass text section size
4633         to Arm_exidx_input_section constructor.
4634         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4635         (Arm_dynobj::do_read_symbols): Fix memory leak.
4636         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4637         * target.h: (class Task): Add forward declaration.
4638         (Target::relax): Add new parameter TASK and pass it to
4639         Target::do_relax().
4640         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4641
4642 2010-11-05  Cary Coutant  <ccoutant@google.com>
4643
4644         PR gold/10708
4645         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4646         object when reading from the file.
4647         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4648         second layout pass.
4649         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4650         when reading section contents.
4651         (get_section_contents): Likewise.
4652         (icf::find_identical_sections): Likewise.
4653         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4654         object when reading from the file.
4655         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4656         the object when doing deferred section layout.
4657
4658 2010-11-03  Nick Clifton  <nickc@redhat.com>
4659
4660         PR gold/12001
4661         * script.h (class Symbol_assignment: name): New member.  Returns
4662         the name of the symbol.
4663         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4664         Returns true if the given symbol name is on the list of
4665         assignments wating to be processed.
4666         * archive.cc (should_incldue_member): If the symbol is undefined,
4667         check to see if it is on the list of symbols pending assignment.
4668
4669 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4670
4671         * script-sections.cc (Script_sections::find_memory_region): Check
4672         for a NULL output section pointer.
4673
4674 2010-10-29  Doug Kwan  <dougkwan@google.com>
4675
4676         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4677         Output_section::add_relaxed_input_section.
4678         * output.cc (Output_section::add_relaxed_input_section): Add new
4679         arguments LAYOUT and NAME.  Set section order index.
4680         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4681         Copy section order index.
4682         * output.h (Output_section::add_relaxed_input_section): Add new
4683         arguments LAYOUT and NAME.
4684
4685 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4686
4687         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4688         NATIVE_OR_CROSS_LINKER.
4689         * testsuite/Makefile.in: Regenerate.
4690
4691 2010-10-20  Doug Kwan  <dougkwan@google.com>
4692
4693         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4694         without SHF_LINK_ORDER flags.
4695         * layout.cc (Layout::choose_output_section): Do not filter
4696         SHF_LINK_ORDER flag in a relocatable link.
4697
4698 2010-10-17  Cary Coutant  <ccoutant@google.com>
4699
4700         * output.h (Output_segment::set_section_addresses): Change function
4701         signature.  Update all callers.
4702         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4703         sections.
4704         (Output_segment::set_section_addresses): Align after last TLS
4705         section.  Add padding before last relro section instead of after.
4706
4707 2010-10-17  Doug Kwan  <dougkwan@google.com>
4708
4709         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4710         GOT output section to be writable.
4711
4712 2010-10-14  Cary Coutant  <ccoutant@google.com>
4713
4714         * debug.h (DEBUG_INCREMENTAL): New flag.
4715         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4716         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4717         mode.
4718         * incremental.cc (report_command_line): Ignore all forms of
4719         --incremental.
4720         * layout.cc (Layout::Layout): Check parameters for incremental link
4721         mode.
4722         * options.cc (General_options::parse_incremental): New function.
4723         (General_options::parse_no_incremental): New function.
4724         (General_options::parse_incremental_full): New function.
4725         (General_options::parse_incremental_update): New function.
4726         (General_options::incremental_mode_): New data member.
4727         (General_options::finalize): Check incremental_mode_.
4728         * options.h (General_options): Update help text for --incremental.
4729         Add --no-incremental, --incremental-full, --incremental-update.
4730         (General_options::Incremental_mode): New enum type.
4731         (General_options::incremental_mode): New function.
4732         (General_options::incremental_mode_): New data member.
4733         * parameters.cc (Parameters::incremental_mode_): New data member.
4734         (Parameters::set_options): Set incremental_mode_.
4735         (Parameters::set_incremental_full): New function.
4736         (Parameters::incremental): New function.
4737         (Parameters::incremental_update): New function.
4738         (set_parameters_incremental_full): New function.
4739         * parameters.h (Parameters::set_incremental_full): New function.
4740         (Parameters::incremental): New function.
4741         (Parameters::incremental_update): New function.
4742         (Parameters::incremental_mode_): New data member.
4743         (set_parameters_incremental_full): New function.
4744         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4745         incremental link mode.
4746         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4747         (Sized_relobj::do_relocate_sections): Likewise.
4748         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4749         option.
4750         * testsuite/Makefile.in: Regenerate.
4751         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4752
4753 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4754
4755         * script-sections.h (class Script_sections): Make
4756         Sections_elements typedef public.
4757         * script-sections.cc (class Sort_output_sections): Add elements_
4758         field.  Add constructor which sets it; change all callers.
4759         (Sort_output_sections::is_before): New function.
4760         (Sort_output_sections::operator()): Call is_before.
4761         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4762         conditional.
4763         * testsuite/script_test_10.sh: New test. Test script section
4764         order.
4765         * testsuite/script_test_10.t: Likewise.
4766         * testsuite/script_test_10.s: Likewise.
4767         * testsuite/Makefile.am: Wrap the cross linker tests and the
4768         common tests into NATIVE_OR_CROSS_LINKER.
4769         (check_SCRIPTS): Add script_test_10.sh.
4770         (check_DATA): Add script_test_10.stdout.
4771         (script_test_10.o, script_test_10): New targets.
4772         (script_test_10.stdout): New target.
4773         * configure, testsuite/Makefile.in: Regenerate.
4774
4775 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4776
4777         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4778         error for the deprecated relocations.
4779         (Target_arm::Scan::global): Likewise.
4780         (Target_arm::Relocate::relocate): Likewise.
4781
4782 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4783
4784         * fileread.cc (Input_file::find_file): Initialize *found_name
4785         and *namep when using the fallback search for case 4.
4786
4787 2010-10-11  Cary Coutant  <ccoutant@google.com>
4788
4789         * options.h (class General_options): Redefine -z lazy as an alias for
4790         the negation of -z now.
4791
4792 2010-10-11  Ian Lance Taylor  <iant@google.com>
4793
4794         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4795         binding.
4796
4797 2010-10-06  Nick Clifton  <nickc@redhat.com>
4798
4799         * script-sections.cc(class Memory_region): Remove
4800         current_lma_offset_ field.  Rename current_vma_offset_ to
4801         current_offset_.  Add last_section_ field.
4802         (Memory_region::get_current_vma_address): Rename to
4803         get_current_address.
4804         (Memory_region::get_current_lma_address): Delete.
4805         (Memory_region::increment_vma_offset): Rename to
4806         increment_offset.
4807         (Memory_region::increment_lma_offset): Delete.
4808         (Memory_region::attributes_compatible): New method.  Returns
4809         true if the provided section is compatible with the region.
4810         (Memory_region::get_last_section): New method.  Returns the last
4811         section to use the region.
4812         (Memory_region::set_last_section): New method.  Stores the last
4813         section to use the region.
4814         (Script_sections::block_in_region): New method.  Returns true if
4815         a block of memory is contained within a region.
4816         (Script_sections::find_memory_region): New method.  Locates a
4817         memory region to be used to set a VMA or LMA address.
4818         (Output_section_definition::set_section_addresses): Add code to
4819         check for addresses set by memory regions.
4820         (Output_segment::set_section_addresses): Remove memory region
4821         walking code.
4822         (Script_sections::create_segment): Add a warning if a header
4823         segment is created outside of any region.
4824         * script-sections.h (class Script_sections): Add prototypes for
4825         find_memory_region and block_in_region methods.
4826         * testsuite/memory_test.s: Use .long instead of .word.
4827         * testsuite/memory_test.t: Add some more output sections.
4828         * testsuite/memory_test.sh: Update expected output.
4829
4830 2010-10-02  Doug Kwan  <dougkwan@google.com>
4831
4832         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4833         defintion to symtab.h
4834         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4835         declaration to defintion.
4836
4837 2010-10-01  Nick Clifton  <nickc@redhat.com>
4838
4839         * expression.cc (eval): Replace dummy argument with NULL.
4840         (eval_maybe_dot): Check for a NULL result section pointer.
4841         (Symbol_expression::value): Likewise.
4842         (Dot_expression::value): Likewise.
4843         (BINARY_EXPRESSION): Likewise.
4844         (Max_expression::value): Likewise.
4845         (Min_expression::value): Likewise.
4846         (Absolute_expression::value): Likewise.
4847         (Addr_expression::value_from_output_section): Likewise.
4848         (Loaddddr_expression::value_from_output_section): Likewise.
4849         (Segment_start_expression::value): Likewise.
4850         * script-sections.cc
4851         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4852         argument with NULL.
4853         (Sections_elememt_dot_assignment::set_section_addresses):
4854         Likewise.
4855         (Output_data_expression::do_write_to_buffer): Likewise.
4856         (Output_section_definition::finalize_symbols): Likewise.
4857         (Output_section_definition::set_section_addresses): Likewise.
4858
4859 2010-09-30  Doug Kwan  <dougkwan@google.com>
4860
4861         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4862
4863 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4864
4865         * target.h (Target::can_icf_inline_merge_sections): New virtual
4866         function.
4867         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4868         virtual function.
4869         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4870         virtual function.
4871         * icf.cc (get_section_contents): Inline merge sections only when
4872         target allows it.
4873
4874 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4875
4876         * configure: Regenerate.
4877
4878 2010-09-17  Ian Lance Taylor  <iant@google.com>
4879
4880         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4881         * testsuite/Makefile.am (memory_test.o): New target.
4882         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4883         memory_test.t.
4884         * testsuite/Makefile.in: Rebuild.
4885
4886 2010-09-17  Doug Kwan  <dougkwan@google.com>
4887
4888         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4889         defintion if relocation uses GOT entries of the symbol.
4890         * testsuite/icf_safe_test.sh: Fix test.
4891         * testsuite/icf_safe_so_test.sh: Fix test.
4892
4893 2010-09-16  Cary Coutant  <ccoutant@google.com>
4894
4895         * script_sections.cc (class Memory_region): Remove "NULL" from
4896         vector initializations.
4897
4898 2010-09-15  Cary Coutant  <ccoutant@google.com>
4899
4900         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4901         Resolve forwarding symbols.
4902
4903 2010-09-15  Doug Kwan  <dougkwan@google.com>
4904
4905         * gold/testsuite/script_test_3.t: Add ARM special sections.
4906         * gold/testsuite/script_test_4.t: Same.
4907         * gold/testsuite/script_test_5.t: Same.
4908         * gold/testsuite/script_test_6.t: Same.
4909         * gold/testsuite/script_test_7.t: Same.
4910         * gold/testsuite/script_test_7.t: Same.
4911         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4912
4913 2010-09-14  Cary Coutant  <ccoutant@google.com>
4914
4915         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4916         (Target_x86_64::Relocate::relocate_tls): Replace check for
4917         saw_tls_block_reloc_ with test for executable section.
4918
4919 2010-09-12  Cary Coutant  <ccoutant@google.com>
4920
4921         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4922         position-independent executables to shared libraries need dynamic
4923         relocations.
4924         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4925         position-independent executables.
4926         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4927         * testsuite/Makefile.in: Regenerate.
4928
4929 2010-09-10  Nick Clifton  <nickc@redhat.com>
4930
4931         PR gold/11997
4932         * testsuite/memory_test.t: Discard any sections that are not
4933         needed.
4934
4935 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4936
4937         PR gold/11996
4938         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4939         "This::" to work around a bug in gcc 4.2.
4940
4941         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4942
4943 2010-09-09  Rafael Espindola  <espindola@google.com>
4944
4945         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4946         sections with different PF_X flags in the same segment.
4947         (Layout::find_first_load_seg): Search all segments to find the first
4948         one.
4949         * options.h (rosegment): New.
4950
4951 2010-09-08  Rafael Espindola  <espindola@google.com>
4952
4953         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4954
4955 2010-09-08  Doug Kwan  <dougkwan@google.com>
4956
4957         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4958         (Arm_relobj::do_relocate_sections): Add new parameter for output
4959         file to match the parent.
4960         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4961         of local symbols instead of input values.  Update code to track
4962         changes in gold::relocate_section.
4963         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4964         (Sized_relobj::compute_final_local_value_internal): New methods.
4965         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4966         body into private version of Sized_relobj::compute_final_local_value.
4967         Call the inline method.
4968         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4969         merged symbol value if there is one.
4970         (Symbol_value::has_output_value): New method defintiion.
4971         (Sized_relobj::Compute_final_local_value_status): New enum type.
4972         (Sized_relobj::compute_final_local_value): New methods.
4973         (Sized_relobj::compute_final_local_value_internal): New methods.
4974         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4975         and arm_cortex_a8.sh.
4976         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4977         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4978         New tests.
4979         * Makefile.in: Regenerate.
4980         * testsuite/arm_bl_out_of_range.s: Update test.
4981         * testsuite/thumb_bl_out_of_range.s: Ditto.
4982         * testsuite/thumb_blx_out_of_range.s: Ditto.
4983         * testsuite/arm_branch_out_of_range.sh: New file.
4984         * testsuite/arm_cortex_a8.sh: Ditto.
4985         * testsuite/arm_cortex_a8_b.s: Ditto.
4986         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4987         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4988         * testsuite/arm_cortex_a8_bl.s: Ditto.
4989         * testsuite/arm_cortex_a8_blx.s: Ditto.
4990         * testsuite/arm_cortex_a8_local.s: Ditto.
4991         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4992         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4993
4994 2010-09-08  Rafael Espindola  <espindola@google.com>
4995
4996         * Makefile.am (memory_test.stdout): Run readelf with -W.
4997         * Makefile.in: Regenerate.
4998         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4999         64 bit output.
5000
5001 2010-09-08  Rafael Espindola  <espindola@google.com>
5002
5003         * script-sections.cc (Script_sections::add_memory_region): Convert
5004         field precision to int.
5005         * script.cc (script_set_section_region, script_set_section_region):
5006         Convert field precision to int.
5007
5008 2010-09-08  Rafael Espindola  <espindola@google.com>
5009
5010         * arm.cc (do_finalize_sections): Create the __exidx_start and
5011         __exdix_end symbols even when the section is missing.
5012
5013 2010-09-08  Nick Clifton  <nickc@redhat.com>
5014
5015         * README: Remove claim that MEMORY is not supported.
5016         * expression.cc (script_exp_function_origin)
5017         (script_exp_function_length): Move from here to ...
5018         * script.cc: ... here.
5019         (script_set_section_region, script_add_memory)
5020         (script_parse_memory_attr, script_include_directive): New
5021         functions.
5022         * script-sections.cc
5023         (class Memory_region): New class.
5024         (class Output_section_definition): Add set_memory_region,
5025         set_section_vma, set_section_lma and get_section_name methods.
5026         (class Script_Sections): Add add_memory_region,
5027         find_memory_region, find_memory_region_origin,
5028         find_memory_region_length and set_memory_region methods.
5029         Have set_section_addresses method walk the list of set memory
5030         regions.
5031         Extend the print methos to display memory regions.
5032         * script-sections.h: Add prototypes for new methods.
5033         Add enum for MEMORY region attributes.
5034         * yyscript.y: Add support for parsing MEMORY regions.
5035         * script-c.h: Add prototypes for new functions.
5036         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5037         * testsuite/Makefile.in: Regenerate.
5038         * testsuite/memory_test.sh: New script.
5039         * testsuite/memory_test.s: New assembler source file.
5040         * testsuite/memory_test.t: New linker script.
5041
5042 2010-08-27  Doug Kwan  <dougkwan@google.com>
5043
5044         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5045         reference override an existing dynamic weak reference.
5046         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5047         * testsuite/Makefile.in: Regenerate.
5048         * testsuite/dyn_weak_ref.sh: New file.
5049         * testsuite/dyn_weak_ref_1.c: Ditto.
5050         * testsuite/dyn_weak_ref_2.c: Ditto.
5051
5052 2010-08-27  Ian Lance Taylor  <iant@google.com>
5053
5054         * incremental.h (class Incremental_input_entry): Add virtual
5055         destructor.
5056
5057 2010-08-27  Ian Lance Taylor  <iant@google.com>
5058
5059         * testsuite/start_lib_test_3.c: Mark t3 as used.
5060
5061 2010-08-27  Nick Clifton  <nickc@redhat.com>
5062
5063         * options.cc (version_script): Fix small typo in previous
5064         whitespace tidyup.
5065
5066 2010-08-25  Nick Clifton  <nickc@redhat.com>
5067
5068         * archive.cc: Formatting fixes: Remove whitespace between
5069         typename and following asterisk.  Remove whitespace between
5070         function name and opening parenthesis.
5071         * archive.h: Likewise.
5072         * arm.cc: Likewise.
5073         * attributes.cc: Likewise.
5074         * attributes.h: Likewise.
5075         * common.cc: Likewise.
5076         * copy-relocs.cc: Likewise.
5077         * dirsearch.h: Likewise.
5078         * dynobj.cc: Likewise.
5079         * ehframe.cc: Likewise.
5080         * ehframe.h: Likewise.
5081         * expression.cc: Likewise.
5082         * fileread.cc: Likewise.
5083         * fileread.h: Likewise.
5084         * gc.h: Likewise.
5085         * gold-threads.cc: Likewise.
5086         * gold.cc: Likewise.
5087         * i386.cc: Likewise.
5088         * icf.h: Likewise.
5089         * incremental-dump.cc: Likewise.
5090         * incremental.cc: Likewise.
5091         * layout.cc: Likewise.
5092         * layout.h: Likewise.
5093         * main.cc: Likewise.
5094         * merge.cc: Likewise.
5095         * merge.h: Likewise.
5096         * object.cc: Likewise.
5097         * object.h: Likewise.
5098         * options.cc: Likewise.
5099         * options.h: Likewise.
5100         * output.cc: Likewise.
5101         * output.h: Likewise.
5102         * plugin.cc: Likewise.
5103         * plugin.h: Likewise.
5104         * powerpc.cc: Likewise.
5105         * reloc.cc: Likewise.
5106         * script-c.h: Likewise.
5107         * script-sections.cc: Likewise.
5108         * script.cc: Likewise.
5109         * stringpool.cc: Likewise.
5110         * symtab.cc: Likewise.
5111         * symtab.h: Likewise.
5112         * target.cc: Likewise.
5113         * timer.cc: Likewise.
5114         * timer.h: Likewise.
5115         * version.cc: Likewise.
5116         * x86_64.cc: Likewise.
5117
5118 2010-08-24  Nick Clifton  <nickc@redhat.com>
5119
5120         PR 11899
5121         * layout.cc (segment_precedes): Sort segments by their physical
5122         addresses, if they have been set.
5123
5124 2010-08-23  Cary Coutant  <ccoutant@google.com>
5125
5126         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5127         symbols data.
5128         (Lib_group::include_member): Unlock object after deleting its
5129         symbols data.
5130         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5131         the bug fixed here.
5132
5133 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5134             Cary Coutant  <ccoutant@google.com>
5135
5136         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5137         constructor, and set_blocker.
5138         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5139         readsyms_blocker_.
5140         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5141         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5142         * testsuite/Makefile.am (start_lib_test): New test case.
5143         * testsuite/Makefile.in: Regenerate.
5144         * testsuite/start_lib_test_main.c: New file.
5145         * testsuite/start_lib_test_1.c: New file.
5146         * testsuite/start_lib_test_2.c: New file.
5147         * testsuite/start_lib_test_3.c: New file.
5148
5149 2010-08-19  Ian Lance Taylor  <iant@google.com>
5150
5151         * Makefile.in: Rebuild with automake 1.11.1.
5152         * aclocal.m4: Likewise.
5153         * testsuite/Makefile.in: Likewise.
5154
5155 2010-08-19  Ian Lance Taylor  <iant@google.com>
5156
5157         PR 10893
5158         * i386.cc (class Output_data_plt_i386): Update declarations.
5159         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5160         local_ifuncs_ fields.
5161         (Target_i386::do_plt_section_for_global): New function.
5162         (Target_i386::do_plt_section_for_local): New function.
5163         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5164         parameter; change all callers.  Initialize global_ifuncs_ and
5165         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5166         __rel_iplt_end.
5167         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5168         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5169         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5170         symbols.
5171         (Target_i386::make_plt_section): New function, broken out of
5172         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5173         (Target_i386::make_plt_entry): Call make_plt_section.
5174         (Target_i386::make_local_ifunc_plt_entry): New function.
5175         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5176         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5177         R_386_IRELATIVE to switch.
5178         (Target_i386::Scan::global): Likewise.
5179         (Target_i386::Relocate::relocate): Likewise.
5180         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5181         switch.
5182         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5183         (Target_x86_64::do_plt_section_for_global): New function.
5184         (Target_x86_64::do_plt_section_for_local): New function.
5185         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5186         parameter; change all callers.  If doing a static link define
5187         __rela_iplt_start and __rela_iplt_end.
5188         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5189         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5190         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5191         to point to .plt.
5192         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5193         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5194         switch.
5195         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5196         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5197         R_X86_64_IRELATIVE to switch.
5198         (Target_x86_64::Scan::global): Likewise.
5199         (Target_x86_64::Relocate::relocate): Likewise.
5200         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5201         switch.
5202         * target.h (class Target): Add plt_section_for_global and
5203         plt_section_for_local functions.  Add do_plt_section_for_global
5204         and do_plt_section_for_local virtual functions.
5205         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5206         clarifying comments.
5207         (Symbol::use_plt_offset): Handle IFUNC symbol.
5208         * object.cc (Sized_relobj::Sized_relobj): Initialize
5209         local_plt_offsets_.
5210         (Sized_relobj::local_has_plt_offset): New function.
5211         (Sized_relobj::local_plt_offset): New function.
5212         (Sized_relobj::set_local_plt_offset): New function.
5213         (Sized_relobj::do_count): Handle IFUNC symbol.
5214         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5215         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5216         is_ifunc_symbol functions.
5217         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5218         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5219         local_plt_offsets_ field.
5220         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5221         * output.h (class Output_section_data): Add non-const
5222         output_section function.
5223         (class Output_data_got): Update declarations.
5224         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5225         Add use_plt_offset parameter to global and local constructors.
5226         Change all callers.  Change local_sym_index_ field to 31 bits.
5227         Change GSYM_CODE and CONSTANT_CODE accordingly.
5228         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5229         doing a static link don't set sh_link field.
5230         (Output_data_got::Got_entry::write): Use PLT offset if
5231         appropriate.
5232         (Output_data_got::add_global_plt): New function.
5233         (Output_data_got::add_local_plt): New function.
5234         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5235         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5236         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5237         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5238         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5239         IFUNC conditional.
5240         * testsuite/ifunc-sel.h: New file.
5241         * testsuite/ifuncmain1.c: New file.
5242         * testsuite/ifuncmain1vis.c: New file.
5243         * testsuite/ifuncmod1.c: New file.
5244         * testsuite/ifuncdep2.c: New file.
5245         * testsuite/ifuncmain2.c: New file.
5246         * testsuite/ifuncmain3.c: New file.
5247         * testsuite/ifuncmod3.c: New file.
5248         * testsuite/ifuncmain4.c: New file.
5249         * testsuite/ifuncmain5.c: New file.
5250         * testsuite/ifuncmod5.c: New file.
5251         * testsuite/ifuncmain6pie.c: New file.
5252         * testsuite/ifuncmod6.c: New file.
5253         * testsuite/ifuncmain7.c: New file.
5254         * configure, testsuite/Makefile.in: Rebuild.
5255
5256 2010-08-18  Ian Lance Taylor  <iant@google.com>
5257
5258         * incremental.cc
5259         (Output_section_incremental_inputs::write_input_files): Add cast
5260         to avoid signed/unsigned comparison warning.
5261         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5262
5263 2010-08-12  Cary Coutant  <ccoutant@google.com>
5264
5265         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5266
5267 2010-08-13  Ian Lance Taylor  <iant@google.com>
5268
5269         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5270
5271 2010-08-12  Cary Coutant  <ccoutant@google.com>
5272             Doug Kwan  <dougkwan@google.com>
5273
5274         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5275         defintion overrides non-weak undef, remember that the original undef
5276         is not weak.
5277         * symtab.cc (Symbol_table::sized_write_global): For undef without
5278         an original weak binding, set binding to global in output.
5279         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5280         * testsuite/Makefile.in: Regenerate.
5281         * testsuite/strong_ref_weak_def.sh: New file.
5282         * testsuite/strong_ref_weak_def_1.c: Ditto.
5283         * testsuite/strong_ref_weak_def_2.c: Ditto.
5284
5285 2010-08-12  Cary Coutant  <ccoutant@google.com>
5286
5287         * testsuite/incremental_test.sh: Rewrite.
5288         * testsuite/incremental_test_1.c: Rewrite.
5289         * testsuite/incremental_test_2.c: Rewrite.
5290
5291 2010-08-12  Cary Coutant  <ccoutant@google.com>
5292
5293         * arm.cc (Target_arm::got_size): Add const.
5294         (Target_arm::got_entry_count): New function.
5295         (Target_arm::plt_entry_count): New function.
5296         (Target_arm::first_plt_entry_offset): New function.
5297         (Target_arm::plt_entry_size): New function.
5298         (Output_data_plt_arm::entry_count): New function.
5299         (Output_data_plt_arm::first_plt_entry_offset): New function.
5300         (Output_data_plt_arm::get_plt_entry_size): New function.
5301         * i386.cc (Target_i386::got_size): Add const.
5302         (Target_i386::got_entry_count): New function.
5303         (Target_i386::plt_entry_count): New function.
5304         (Target_i386::first_plt_entry_offset): New function.
5305         (Target_i386::plt_entry_size): New function.
5306         (Output_data_plt_i386::entry_count): New function.
5307         (Output_data_plt_i386::first_plt_entry_offset): New function.
5308         (Output_data_plt_i386::get_plt_entry_size): New function.
5309         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5310         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5311         * incremental.cc: Include target.h.
5312         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5313         parameter.  Adjust all callers.  Find incremental_got_plt section.
5314         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5315         section.
5316         (Output_section_incremental_inputs::set_final_data_size): Calculate
5317         size of incremental_got_plt section.
5318         (Output_section_incremental_inputs::do_write): Write the
5319         incremental_got_plt section.
5320         (Got_plt_view_info): New struct.
5321         (Local_got_offset_visitor): New class.
5322         (Global_got_offset_visitor): New class.
5323         (Global_symbol_visitor_got_plt): New class.
5324         (Output_section_incremental_inputs::write_got_plt): New function.
5325         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5326         Add parameter.  Adjust all callers.
5327         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5328         (Incremental_inputs::got_plt_section): New function.
5329         (Incremental_inputs::got_plt_section_): New data member.
5330         (Incremental_got_plt_reader): New class.
5331         * layout.cc (Layout::create_incremental_info_sections): Add the
5332         incremental_got_plt section.
5333         * object.h (Got_offset_list::get_list): New function.
5334         (Got offset_list::for_all_got_offsets): New function.
5335         (Sized_relobj::local_got_offset_list): New function.
5336         * powerpc.cc (Target_powerpc::got_size): Add const.
5337         (Target_powerpc::got_entry_count): New function.
5338         (Target_powerpc::plt_entry_count): New function.
5339         (Target_powerpc::first_plt_entry_offset): New function.
5340         (Target_powerpc::plt_entry_size): New function.
5341         (Output_data_plt_powerpc::entry_count): New function.
5342         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5343         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5344         * sparc.cc (Target_sparc::got_size): Add const.
5345         (Target_sparc::got_entry_count): New function.
5346         (Target_sparc::plt_entry_count): New function.
5347         (Target_sparc::first_plt_entry_offset): New function.
5348         (Target_sparc::plt_entry_size): New function.
5349         (Output_data_plt_sparc::entry_count): New function.
5350         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5351         (Output_data_plt_sparc::get_plt_entry_size): New function.
5352         * symtab.h (Symbol::got_offset_list): New function.
5353         (Symbol_table::for_all_symbols): New function.
5354         * target.h (Sized_target::got_entry_count): New function.
5355         (Sized_target::plt_entry_count): New function.
5356         (Sized_target::plt_entry_size): New function.
5357         * x86_64.cc (Target_x86_64::got_size): Add const.
5358         (Target_x86_64::got_entry_count): New function.
5359         (Target_x86_64::plt_entry_count): New function.
5360         (Target_x86_64::first_plt_entry_offset): New function.
5361         (Target_x86_64::plt_entry_size): New function.
5362         (Output_data_plt_x86_64::entry_count): New function.
5363         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5364         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5365
5366 2010-08-12  Cary Coutant  <ccoutant@google.com>
5367
5368         * archive.cc: Include incremental.h.
5369         (Archive::Archive): Initialize incremental_info_.
5370         (Archive::include_member): Record archive members in incremental info.
5371         (Add_archive_symbols::run): Record begin and end of an archive in
5372         incremental info.
5373         (Lib_group::include_member): Record objects in incremental info.
5374         * archive.h (Incremental_archive_entry): Forward declaration.
5375         (Archive::set_incremental_info): New member function.
5376         (Archive::incremental_info): New member function.
5377         (Archive::Unused_symbol_iterator): New class.
5378         (Archive::unused_symbols_begin): New member function.
5379         (Archive::unused_symbols_end): New member function.
5380         (Archive::incremental_info_): New data member.
5381         * incremental-dump.cc (find_input_containing_global): New function.
5382         (dump_incremental_inputs): Dump new incremental info sections.
5383         * incremental.cc: Include symtab.h.
5384         (Output_section_incremental_inputs): New class.
5385         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5386         new incremental info sections.
5387         (Sized_incremental_binary::do_check_inputs): Likewise.
5388         (Incremental_inputs::report_archive): Remove.
5389         (Incremental_inputs::report_archive_begin): New function.
5390         (Incremental_inputs::report_archive_end): New function.
5391         (Incremental_inputs::report_object): New function.
5392         (Incremental_inputs::finalize_inputs): Remove.
5393         (Incremental_inputs::report_input_section): New function.
5394         (Incremental_inputs::report_script): Rewrite.
5395         (Incremental_inputs::finalize): Do nothing but finalize string table.
5396         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5397         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5398         (Incremental_inputs::create_data_sections): New function.
5399         (Incremental_inputs::relocs_entsize): New function.
5400         (Output_section_incremental_inputs::set_final_data_size): New function.
5401         (Output_section_incremental_inputs::do_write): New function.
5402         (Output_section_incremental_inputs::write_header): New function.
5403         (Output_section_incremental_inputs::write_input_files): New function.
5404         (Output_section_incremental_inputs::write_info_blocks): New function.
5405         (Output_section_incremental_inputs::write_symtab): New function.
5406         * incremental.h (Incremental_script_entry): Forward declaration.
5407         (Incremental_object_entry): Forward declaration.
5408         (Incremental_archive_entry): Forward declaration.
5409         (Incremental_inputs): Forward declaration.
5410         (Incremental_inputs_header_data): Remove.
5411         (Incremental_inputs_header): Remove.
5412         (Incremental_inputs_header_write): Remove.
5413         (Incremental_inputs_entry_data): Remove.
5414         (Incremental_inputs_entry): Remove.
5415         (Incremental_inputs_entry_write): Remove.
5416         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5417         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5418         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5419         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5420         Likewise.
5421         (Incremental_input_entry): New class.
5422         (Incremental_script_entry): New class.
5423         (Incremental_object_entry): New class.
5424         (Incremental_archive_entry): New class.
5425         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5426         (Incremental_inputs::report_inputs): Remove.
5427         (Incremental_inputs::report_archive): Remove.
5428         (Incremental_inputs::report_archive_begin): New function.
5429         (Incremental_inputs::report_archive_end): New function.
5430         (Incremental_inputs::report_object): Change prototype.
5431         (Incremental_inputs::report_input_section): New function.
5432         (Incremental_inputs::report_script): Change prototype.
5433         (Incremental_inputs::get_reloc_count): New function.
5434         (Incremental_inputs::set_reloc_count): New function.
5435         (Incremental_inputs::create_data_sections): New function.
5436         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5437         (Incremental_inputs::inputs_section): New function.
5438         (Incremental_inputs::symtab_section): New function.
5439         (Incremental_inputs::relocs_section): New function.
5440         (Incremental_inputs::get_stringpool): Add const.
5441         (Incremental_inputs::command_line): Add const.
5442         (Incremental_inputs::inputs): Remove.
5443         (Incremental_inputs::command_line_key): New function.
5444         (Incremental_inputs::input_file_count): New function.
5445         (Incremental_inputs::input_files): New function.
5446         (Incremental_inputs::relocs_entsize): New function.
5447         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5448         (Incremental_inputs::finalize_inputs): Remove.
5449         (Incremental_inputs::Input_info): Remove.
5450         (Incremental_inputs::lock_): Remove.
5451         (Incremental_inputs::inputs_): Change type.
5452         (Incremental_inputs::inputs_map_): Remove.
5453         (Incremental_inputs::current_object_entry_): New data member.
5454         (Incremental_inputs::inputs_section_): New data member.
5455         (Incremental_inputs::symtab_section_): New data member.
5456         (Incremental_inputs::relocs_section_): New data member.
5457         (Incremental_inputs::reloc_count_): New data member.
5458         (Incremental_inputs_reader): New class.
5459         (Incremental_symtab_reader): New class.
5460         (Incremental_relocs_reader): New class.
5461         * layout.cc (Layout::finalize): Move finalization of incremental info
5462         and creation of incremental info sections to follow finalization of
5463         symbol table.  Set offsets for postprocessing sections.
5464         (Layout::create_incremental_info_sections): Call
5465         Incremental_inputs::create_data_sections.  Add incremental symtab
5466         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5467         sections to layout after input sections.
5468         * layout.h (struct Timespec): Forward declaration.
5469         (Layout::incremental_inputs): Add const.
5470         (Layout::create_incremental_info_sections): Add parameter.
5471         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5472         * object.cc: Include incremental.h.
5473         (Relobj::finalize_incremental_relocs): New function.
5474         (Sized_relobj::do_layout): Record input sections in incremental info.
5475         * object.h (Object::output_section): New function.
5476         (Object::output_section_offset): Moved from Relobj.
5477         (Object::get_incremental_reloc_base): New function.
5478         (Object::get_incremental_reloc_count): New function.
5479         (Object::do_output_section): New function.
5480         (Object::do_output_section_offset): Moved from Relobj.
5481         (Object::do_get_incremental_reloc_base): New function.
5482         (Object::do_get_incremental_reloc_count): New function.
5483         (Object::Object): Initialize new data members.
5484         (Relobj::output_section): Renamed do_output_section and moved to
5485         protected.
5486         (Relobj::output_section_offset): Moved to Object.
5487         (Relobj::do_get_incremental_reloc_base): New function.
5488         (Relobj::do_get_incremental_reloc_count): New function.
5489         (Relobj::allocate_incremental_reloc_counts): New function.
5490         (Relobj::count_incremental_reloc): New function.
5491         (Relobj::finalize_incremental_relocs): New function.
5492         (Relobj::next_incremental_reloc_index): New function.
5493         (Relobj::reloc_counts_): New data member.
5494         (Relobj::reloc_bases_): New data member.
5495         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5496         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5497         (Sized_relobj::incremental_relocs_scan): New function.
5498         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5499         (Sized_relobj::incremental_relocs_write): New function.
5500         (Sized_relobj::incremental_relocs_write_reltype): New function.
5501         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5502         incremental link.
5503         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5504         archives and object files elsewhere.
5505         (Add_symbols::run): Report object files here.
5506         (Finish_group::run): Report end of archive at end of group.
5507         * reloc.cc: Include layout.h, incremental.h.
5508         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5509         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5510         (Sized_relobj::incremental_relocs_scan): New function.
5511         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5512         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5513         (Sized_relobj::incremental_relocs_write): New function.
5514         (Sized_relobj::incremental_relocs_write_reltype): New function.
5515         * script.cc (read_input_script): Rewrite test for incremental link.
5516         Change call to Incremental_inputs::report_script.
5517         * symtab.h (Symbol_table::first_global_index): New function.
5518         (Symbol_table::output_count): New function.
5519
5520 2010-08-12  Doug Kwan  <dougkwan@google.com>
5521
5522         * arm.cc (Target_arm::merge_object_attributes): Check command line
5523         options --no-wchar-size-warning and --no-enum-size-warning.
5524         * options.h (General_options): Add ld-compatible options
5525         --no-enum-size-warning and --no-wchar-size-warning.
5526
5527 2010-08-04  Ian Lance Taylor  <iant@google.com>
5528
5529         * x86_64.cc (Target_x86_64::Scan::local): Use
5530         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5531         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5532         (Target_x86_64::Scan::global): Likewise.
5533         (Target_x86_64::Relocate::relocate): Likewise.
5534         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5535         Likewise.
5536
5537 2010-08-03  Cary Coutant  <ccoutant@google.com>
5538
5539         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5540         to reserve space in merged_strings vector. Keep total input size
5541         for stats.
5542         (Output_merge_string::do_print_merge_stats): Print total input size.
5543         * merge.h (Output_merge_string): Add input_size_ field.
5544         * stringpool.cc (Stringpool_template::string_length): Move
5545         implementations out of Stringpool_template class and place in
5546         stringpool.h.
5547         * stringpool.h (string_length): Move out of Stringpool_template.
5548
5549 2010-08-03  Ian Lance Taylor  <iant@google.com>
5550
5551         PR 11712
5552         * layout.cc (relaxation_loop_body): If address of load segment is
5553         set, adjust address to include headers if possible.
5554
5555 2010-08-03  Ian Lance Taylor  <iant@google.com>
5556
5557         * version.cc (version_string): Bump to 1.10.
5558
5559 2010-08-03  Ian Lance Taylor  <iant@google.com>
5560
5561         PR 11805
5562         * layout.h (enum Output_section_order): Define.
5563         (class Layout): Update declarations.
5564         * layout.cc (Layout::get_output_section): Add order parameter.
5565         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5566         is_first_non_relro parameters.  Change all callers.
5567         (Layout::choose_output_section): Likewise.
5568         (Layout::add_output_section_data): Likewise.
5569         (Layout::make_output_section): Likewise.  Set order.
5570         (Layout::default_section_order): New function.
5571         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5572         * output.cc (Output_section::Output_section): Initialize order_.
5573         Don't initialize deleted fields.
5574         (Output_segment::Output_segment): Don't initialize deleted
5575         fields.
5576         (Output_segment::add_output_section_to_load): New function
5577         replacing add_output_section.  Change all callers to call this or
5578         add_output_section_to_nonload.
5579         (Output_segment::add_output_section_to_nonload): New function.
5580         (Output_segment::remove_output_section): Rewrite.
5581         (Output_segment::add_initial_output_data): Likewise.
5582         (Output_segment::has_any_data_sections): Likewise.
5583         (Output_segment::is_first_section_relro): Likewise.
5584         (Output_segment::maximum_alignment): Likewise.
5585         (Output_segment::has_dynamic_reloc): New function replacing
5586         dynamic_reloc_count.  Change all callers.
5587         (Output_segment::has_dynamic_reloc_list): New function replacing
5588         dynamic_reloc_count_list.  Change all callers.
5589         (Output_segment::set_section_addresses): Rewrite.
5590         (Output_segment::set_offset): Rewrite.
5591         (Output_segment::find_first_and_last_list): Remove.
5592         (Output_segment::set_tls_offsets): Rewrite.
5593         (Output_segment::first_section_load_address): Likewise.
5594         (Output_segment::output_section_count): Likewise.
5595         (Output_segment::section_with_lowest_load_address): Likewise.
5596         (Output_segment::write_section_headers): Likewise.
5597         (Output_segment::print_sections_to_map): Likewise.
5598         * output.h (class Output_data): Remove dynamic_reloc_count_
5599         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5600         (Output_data::add_dynamic_reloc): Rewrite.
5601         (Output_data::has_dynamic_reloc): New function.
5602         (Output_data::dynamic_reloc_count): Remove.
5603         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5604         is_last_relro_, is_first_non_relro_, is_interp_,
5605         is_dynamic_linker_section_ fields.  Add order and set_order
5606         functions.  Remove is_relro_local, set_is_relro_local,
5607         is_last_relro, set_is_last_relro, is_first_non_relro,
5608         set_is_first_non_relro functions, is_interp, set_is_interp,
5609         is_dynamic_linker_section, and set_is_dynamic_linker_section
5610         functions.
5611         (class Output_segment): Change Output_data_list from std::list to
5612         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5613         output_bss_ fields.  Update declarations.
5614
5615 2010-08-02  Ian Lance Taylor  <iant@google.com>
5616
5617         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5618         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5619         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5620
5621 2010-08-02  Ian Lance Taylor  <iant@google.com>
5622
5623         PR 11855
5624         * script.cc (Script_options::Script_options): Initialize
5625         symbol_definitions_ and symbol_references_.
5626         (Script_options::add_symbol_assignment): Update
5627         symbol_definitions_ and symbol_references_.
5628         (Script_options::add_symbol_reference): New function.
5629         (script_symbol): New function.
5630         * script.h (class Script_options): Add symbol_definitions_ and
5631         symbol_references_ fields.
5632         (Script_options::referenced_const_iterator): New type.
5633         (Script_options::referenced_begin): New function.
5634         (Script_options::referenced_end): New function.
5635         (Script_options::is_referenced): New function.
5636         (Script_options::any_unreferenced): New function.
5637         * script-c.h (script_symbol): Declare.
5638         * yyscript.y (exp): Call script_symbol.
5639         * symtab.cc: Include "script.h".
5640         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5641         Change all callers.  Check symbols referenced by scripts.
5642         (Symbol_table::add_undefined_symbols_from_command_line): Add
5643         layout parameter.  Change all callers.
5644         (Symbol_table::do_add_undefined_symbols_from_command_line):
5645         Likewise.  Break out loop body.  Check symbols referenced by
5646         scripts.
5647         (Symbol_table::add_undefined_symbol_from_command_line): New
5648         function broken out of
5649         do_add_undefined_symbols_from_command_line.
5650         * symtab.h (class Symbol_table): Update declarations.
5651         * archive.cc: Include "layout.h".
5652         (Archive::should_include_member): Add layout parameter.  Change
5653         all callers.  Check for symbol mentioned in expression.
5654         * archive.h (class Archive): Update declaration.
5655         * object.cc (Sized_relobj::do_should_include_member): Add layout
5656         parameter.
5657         * object.h (Object::should_include_member): Add layout parameter.
5658         Change all callers.
5659         (Object::do_should_include_member): Add layout parameter.
5660         (class Sized_relobj): Update declaration.
5661         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5662         parameter.
5663         * dynobj.h (class Sized_dynobj): Update declaration.
5664         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5665         layout parameter.
5666         * plugin.h (class Sized_pluginobj): Update declaration.
5667
5668 2010-08-02  Ian Lance Taylor  <iant@google.com>
5669
5670         PR 11866
5671         * output.cc (Output_segment::set_offset): Search for the first and
5672         last sections rather than assuming that the list is in order.
5673         (Output_segment::find_first_and_last_list): New function.
5674         * output.h (class Output_segment): Update declarations.
5675         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5676         (relro_strip_test_SOURCES): New variable.
5677         (relro_strip_test_DEPENDENCIES): New variable.
5678         (relro_strip_test_LDFLAGS): New variable.
5679         (relro_strip_test_LDADD): New variable.
5680         (relro_strip_test.so): New target.
5681
5682 2010-08-02  Ian Lance Taylor  <iant@google.com>
5683
5684         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5685         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5686         (Target_i386::got_tlsdesc_section): New function.
5687         (Target_i386::got_section): Create space for GOT entries for
5688         TLSDESC relocations.
5689         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5690         R_386_TLS_GOTDESC.
5691         (Target_i386::Scan::global): Likewise.
5692         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5693         using TLSDESC GOT.
5694         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5695         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5696         (Target_x86_64::got_tlsdesc_section): New function.
5697         (Target_x86_64::got_section): Create space for GOT entries for
5698         TLSDESC relocations.
5699         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5700         R_386_TLS_GOTDESC.
5701         (Target_x86_64::Scan::global): Likewise.
5702         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5703         using TLSDESC GOT.
5704
5705 2010-08-02  Ian Lance Taylor  <iant@google.com>
5706
5707         * testsuite/final_layout.sh: Use dc to convert from hex to
5708         decimal.
5709
5710 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5711
5712         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5713         paramter to the call to gold::gc_process_relocs.
5714         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5715         paramter to the call to gold::gc_process_relocs.
5716         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5717         parameter to the call to gold::gc_process_relocs.
5718         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5719         template parameter to the call to gold::gc_process_relocs.
5720         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5721         paramter to the call to gold::gc_process_relocs.
5722         * gc.h (get_embedded_addend_size): New function.
5723         (gc_process_relocs): Save the size of the reloc for use by ICF.
5724         * icf.cc (get_section_contents): Get the addend from the text section
5725         for SHT_REL relocation sections.
5726         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5727         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5728         * int_encoding.h (read_from_pointer): New overloaded function.
5729         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5730         * testsuite/icf_sht_rel_addend_test.sh: New file.
5731         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5732         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5733
5734 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5735
5736         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5737         * Makefile.in: Regenerate.
5738         * testsuite/Makefile.in: Regenerate.
5739
5740 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5741
5742         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5743         * gold/testsuite/debug_msg.cc: Likewise.
5744         * gold/testsuite/odr_violation1.cc
5745         * gold/testsuite/odr_violation2.cc
5746
5747 2010-07-21  Cary Coutant  <ccoutant@google.com>
5748
5749         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5750         string, and length fields.
5751         (Output_merge_string::Merged_strings_list): New type.
5752         (Output_merge_string::Merged_strings_lists): New typedef.
5753         (Output_merge_string): Replace merged_strings_ with
5754         merged_strings_lists_.
5755         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5756         Merged_strings_list per input object and section.  Don't store pointer
5757         to the string.  Don't store length with each merged string entry.
5758         (Output_merge_string::finalize_merged_data): Loop over list of merged
5759         strings lists.  Recompute length of each merged string.
5760
5761 2010-07-15  Cary Coutant  <ccoutant@google.com>
5762
5763         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5764         here.
5765
5766 2010-07-14  Ian Lance Taylor  <iant@google.com>
5767
5768         * descriptors.cc (Descriptors::open): Report correct name in error
5769         message.
5770
5771 2010-07-13  Doug Kwan  <dougkwan@google.com>
5772
5773         * arm.cc (Arm_input_section::Arm_input_section): For a
5774         SHT_ARM_EXIDX section, always keeps the input sections.
5775         (Arm_input_section::set_exidx_section_link): New method.
5776         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5777         has_errors_ to false.
5778         (Arm_exidx_input_section::has_errors,
5779         Arm_exidx_input_section::set_has_errors): New methods.
5780         (Arm_exidx_input_section::has_errors_): New data member.
5781         (Arm_relobj::get_exidx_shndx_list): New method.
5782         (Arm_output_section::append_text_sections_to_list): Do not skip
5783         section without SHF_EXECINSTR.
5784         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5785         errors.
5786         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5787         section header.  Make error messages more verbose.  Check for
5788         a non-executable section linked to an EXIDX section.
5789         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5790         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5791         check that there is no deferred EXIDX section if we exit early.
5792         Instead of not making an EXIDX section in case of an error, make one
5793         and set the has_errors flag of it.
5794         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5795         in a relocatable link.
5796         (Target_arm::do_relax): Look for the EXIDX output section instead of
5797         assuming that it is called .ARM.exidx.
5798         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5799         section list.  Do not check for SHF_EXECINSTR section flags but
5800         skip any input section with errors.
5801         * output.cc (Output_section::Output_section): Initialize
5802         always_keeps_input_sections_ to false.
5803         (Output_section::add_input_section): Check for
5804         always_keeps_input_sections_.
5805         *  output.h (Output_section::always_keeps_input_sections,
5806         Output_section::set_always_keeps_input_sections): New methods.
5807         (Output_section::always_keeps_input_sections): New data member.
5808
5809 2010-07-13  Rafael Espindola  <espindola@google.com>
5810
5811         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5812         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5813
5814 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5815             Ian Lance Taylor  <iant@google.com>
5816
5817         * output.h (Output_section_lookup_maps::add_merge_section):
5818         Correct check of whether value was inserted.
5819         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5820         (Output_section_lookup_maps::add_relaxed_input_section):
5821         Likewise.
5822         * arm.cc (Target_arm::got_section): Remove used local os.
5823         * i386.cc (Target_i386::got_section): Likewise.
5824         * x86_64.cc (Target_x86_64::got_section): Likewise.
5825         * sparc.cc (Target_sparc::got_section): Likewise.
5826         (Target_sparc::relocate): Remove unused local have_got_offset.
5827         * powerpc.cc (Target_powerpc::relocate): Likewise.
5828
5829 2010-07-13  Ian Lance Taylor  <iant@google.com>
5830
5831         * compressed_output.cc (zlib_decompress): Fix signature in
5832         !HAVE_ZLIB_H case.
5833
5834         * archive.cc (Archive::include_member): Unlock an external member
5835         of a thin archive.  Don't bother to delete an object we know is
5836         NULL.
5837
5838 2010-07-12  Cary Coutant  <ccoutant@google.com>
5839
5840         * compressed_output.cc (zlib_decompress): New function.
5841         (get_uncompressed_size): New function.
5842         (decompress_input_section): New function.
5843         * compressed_output.h (get_uncompressed_size): New function.
5844         (decompress_input_section): New function.
5845         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5846         Handle compressed debug sections.
5847         * layout.cc (is_compressed_debug_section): New function.
5848         (Layout::output_section_name): Map compressed section names to
5849         canonical names.
5850         * layout.h (is_compressed_debug_section): New function.
5851         (is_debug_info_section): Recognize compressed debug sections.
5852         * merge.cc: Include compressed_output.h.
5853         (Output_merge_data::do_add_input_section): Handle compressed
5854         debug sections.
5855         (Output_merge_string::do_add_input_section): Handle compressed
5856         debug sections.
5857         * object.cc: Include compressed_output.h.
5858         (Sized_relobj::Sized_relobj): Initialize new data members.
5859         (build_compressed_section_map): New function.
5860         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5861         * object.h (Object::section_is_compressed): New method.
5862         (Object::do_section_is_compressed): New method.
5863         (Sized_relobj::Compressed_section_map): New type.
5864         (Sized_relobj::do_section_is_compressed): New method.
5865         (Sized_relobj::compressed_sections_): New data member.
5866         * output.cc (Output_section::add_input_section): Handle compressed
5867         debug sections.
5868         * reloc.cc: Include compressed_output.h.
5869         (Sized_relobj::write_sections): Handle compressed debug sections.
5870
5871 2010-07-08  Cary Coutant  <ccoutant@google.com>
5872
5873         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5874         weak when resolving to a dynamic def.
5875         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5876         for weak undef/dynamic def cases. Adjust callers.
5877         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5878         undef_binding_weak_.
5879         (Symbol_table::sized_write_globals): Adjust symbol binding.
5880         (Symbol_table::sized_write_symbol): Add binding parameter.
5881         * symtab.h (Symbol::set_undef_binding): New method.
5882         (Symbol::is_undef_binding_weak): New method.
5883         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5884         (Symbol_table::should_override): Add new parameter.
5885         (Symbol_table::sized_write_symbol): Add new parameter.
5886
5887         * testsuite/weak_undef_file1.cc: Add new test case.
5888         * testsuite/weak_undef_file2.cc: Fix header comment.
5889         * testsuite/weak_undef_test.cc: Add new test case.
5890
5891 2010-06-29  Doug Kwan  <dougkwan@google.com>
5892
5893         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5894         Initialize USE_SYMBOL_.
5895         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5896         definition.
5897         (Arm_reloc_property::uses_symbol_): New data member declaration.
5898         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5899         uses symbol value and symbol is undefined but not weakly undefined.
5900
5901 2010-06-28  Rafael Espindola  <espindola@google.com>
5902
5903         * plugin.cc (Plugin::load): Use dlerror.
5904
5905 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5906
5907         * symtab.cc (detect_odr_violations): When reporting an ODR
5908         violation, report an object where the symbol is defined.
5909
5910 2010-06-25  Doug Kwan  <dougkwan@google.com>
5911
5912         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5913         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5914         definition.
5915         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5916         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5917         target hook to detect function points.
5918         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5919         * icf.h (Icf::check_section_for_function_pointers): Change type of
5920         parameter SECTION_NAME to const reference to std::string.  Use
5921         target hook to determine if section may have unsafe pointers.
5922         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5923         method definition.
5924
5925 2010-06-21  Rafael Espindola  <espindola@google.com>
5926
5927         * fileread.cc (Input_file::find_fie): New
5928         (Input_file::open): Use Input_file::find_fie.
5929         * fileread.h (Input_file::find_fie): New
5930         * plugin.cc (set_extra_library_path): New.
5931         (Plugin::load): Add set_extra_library_path to the transfer vector.
5932         (Plugin_manager::set_extra_library_path): New.
5933         (Plugin_manager::add_input_file): Use the extra search path if set.
5934         (set_extra_library_path(): New.
5935         * plugin.h (Plugin_manager): Add set_extra_library_path and
5936         extra_search_path_.
5937
5938 2010-06-19  Cary Coutant  <ccoutant@google.com>
5939
5940         * layout.cc (gdb_sections): Add .debug_types.
5941         (lines_only_debug_sections): Likewise.
5942
5943 2010-06-18  Rafael Espindola  <espindola@google.com>
5944
5945         * plugin.cc (add_input_file,add_input_library)
5946         (Plugin_manager::add_input_file): Make filename arguments const.
5947         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5948         const.
5949
5950 2010-06-16  Doug Kwan  <dougkwan@google.com>
5951
5952         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5953         .ARM.attributes section if we have not merged any input
5954         attributes sections.
5955
5956 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5957
5958         * arm.cc: Allow combining objects with no EABI version
5959         information.
5960
5961 2010-06-15  Rafael Espindola  <espindola@google.com>
5962
5963         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5964
5965 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5966
5967         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5968         (struct iovec): Correct !HAVE_READV definition.
5969
5970 2010-06-10  Cary Coutant  <ccoutant@google.com>
5971
5972         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5973         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5974         reloc sections.
5975         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5976
5977         PR 11683
5978         * symtab.h (Symbol::is_placeholder): New member function.
5979         * target-reloc.h (relocate_section): Check for placeholder symbols.
5980
5981         * testsuite/Makefile.am (plugin_test_8): New test.
5982         (plugin_test_9): New test.
5983         * testsuite/Makefile.in: Regenerate.
5984
5985 2010-06-09  Nick Clifton  <nickc@redhat.com>
5986
5987         * yyscript.y (input_list_element): Allow strings prefixed with
5988         the '-' character.  Treat these as libraries.
5989         * script.cc (script_add_library): New function.  Adds a library
5990         specified by "-l<name>" found in an input script.
5991         * script-c.h: Add prototype for script_add_library.
5992
5993 2010-06-07  Doug Kwan  <dougkwan@google.com>
5994
5995         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5996         Restrict stub-group size to be within long conditional branch
5997         range when working around cortex-A8 erratum.
5998
5999 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6000
6001         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6002         #ifdef typo.
6003
6004 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6005
6006         PR gold/11658
6007         * output.cc
6008         (Output_section::Input_section_sort_entry::compare_section_ordering):
6009         Change to return non-zero correctly.
6010         (Output_section::Input_section_sort_section_order_index_compare
6011         ::operator()): Change to fix ambiguity in comparisons.
6012
6013 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6014
6015         * gold.h (is_wildcard_string): New function.
6016         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6017         (Layout::layout_eh_frame): Ditto.
6018         (Layout::find_section_order_index): New method.
6019         (Layout::read_layout_from_file): New method.
6020         * layout.h (Layout::find_section_order_index): New method.
6021         (Layout::read_layout_from_file): New method.
6022         (Layout::input_section_position_): New private member.
6023         (Layout::input_section_glob_): New private member.
6024         * main.cc (main): Call read_layout_from_file here.
6025         * options.h (--section-ordering-file): New option.
6026         * output.cc (Output_section::input_section_order_specified_): New
6027         member.
6028         (Output_section::Output_section): Initialize new member.
6029         (Output_section::add_input_section): Add new parameter.
6030         Keep input sections when --section-ordering-file is used.
6031         (Output_section::set_final_data_size): Sort input sections when
6032         section ordering file is specified.
6033         (Output_section::Input_section_sort_entry): Add new parameter.
6034         Check sorting type.
6035         (Output_section::Input_section_sort_entry::compare_section_ordering):
6036         New method.
6037         (Output_section::Input_section_sort_compare::operator()): Change to
6038         consider section_order_index.
6039         (Output_section::Input_section_sort_init_fini_compare::operator()):
6040         Change to consider section_order_index.
6041         (Output_section::Input_section_sort_section_order_index_compare
6042         ::operator()): New method.
6043         (Output_section::sort_attached_input_sections): Change to sort
6044         according to section order when specified.
6045         (Output_section::add_input_section<32, true>): Add new parameter.
6046         (Output_section::add_input_section<64, true>): Add new parameter.
6047         (Output_section::add_input_section<32, false>): Add new parameter.
6048         (Output_section::add_input_section<64, false>): Add new parameter.
6049         * output.h (Output_section::add_input_section): Add new parameter.
6050         (Output_section::input_section_order_specified): New
6051         method.
6052         (Output_section::set_input_section_order_specified): New method.
6053         (Input_section::Input_section): Initialize section_order_index_.
6054         (Input_section::section_order_index): New method.
6055         (Input_section::set_section_order_index): New method.
6056         (Input_section::section_order_index_): New member.
6057         (Input_section::Input_section_sort_section_order_index_compare): New
6058         struct.
6059         (Output_section::input_section_order_specified_): New member.
6060         * script-sections.cc (is_wildcard_string): Delete and move modified
6061         method to gold.h.
6062         (Output_section_element_input::Output_section_element_input): Modify
6063         call to is_wildcard_string.
6064         (Output_section_element_input::Input_section_pattern
6065         ::Input_section_pattern): Ditto.
6066         (Output_section_element_input::Output_section_element_input): Ditto.
6067         * testsuite/Makefile.am (final_layout): New test case.
6068         * testsuite/Makefile.in: Regenerate.
6069         * testsuite/final_layout.cc: New file.
6070         * testsuite/final_layout.sh: New file.
6071
6072 2010-06-01  Rafael Espindola  <espindola@google.com>
6073
6074         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6075
6076 2010-06-01  Rafael Espindola  <espindola@google.com>
6077
6078         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6079         visibility of symbols.
6080
6081 2010-05-27  Doug Kwan  <dougkwan@google.com>
6082
6083         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6084         from start of output section instead of address for a local symbol
6085         in a merged or relaxed section when doing a relocatable link.
6086
6087 2010-05-26  Rafael Espindola  <espindola@google.com>
6088
6089         PR 11604
6090         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6091         adding sections the garbage collector removed.
6092         * gold/testsuite/Makefile.am: Add test.
6093         * gold/testsuite/Makefile.in: Regenerate.
6094         * gold/testsuite/plugin_test_7.sh: New.
6095         * gold/testsuite/plugin_test_7_1.c: New.
6096         * gold/testsuite/plugin_test_7_2.c: New.
6097
6098 2010-05-26  Rafael Espindola  <espindola@google.com>
6099
6100         * script-sections.cc (Output_section_definition::set_section_addresses):
6101         Check for --section-start.
6102
6103 2010-05-26  Doug Kwan  <dougkwan@google.com>
6104
6105         * arm.cc (Arm_scan_relocatable_relocs): New class.
6106         (Target_arm::relocate_special_relocatable): New method.
6107         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6108         (Arm_relocate_functions::thumb_branch_common): Same.
6109         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6110         instead of Default_scan_relocatable_relocs.
6111         * target-reloc.h (relocate_for_relocatable): Let target handle
6112         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6113         * target.h (Sized_target::relocate_special_relocatable): New method.
6114
6115 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6116
6117         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6118
6119 2010-05-23  Doug Kwan  <dougkwan@google.com>
6120
6121         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6122         instead of a cast.
6123         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6124         with a direct branch, not a conditional branch, to a stub.
6125         * merge.cc (Output_merge_base::record_input_section): New method
6126         defintion.
6127         (Output_merge_data::do_add_input_section): Record input section if
6128         keeps-input-sections flag is set.
6129         (Output_merge_string::do_add_input_section): Ditto.
6130         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6131         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6132         INPUT_SECTIONS_.
6133         (Output_merge_base::keeps_input_sections,
6134         Output_merge_base::set_keeps_input_sections,
6135         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6136         method definitions.
6137         (Output_merge_base::Input_sections): New type declaration.
6138         (Output_merge_base::input_sections_begin,
6139         Output_merge_base::input_sections_end,
6140         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6141         (Output_merge_base::bool keeps_input_sections_,
6142         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6143         Output_merge_base::input_sections_): New data members.
6144         (Output_merge_data::do_set_keeps_input_sections): New method
6145         defintion.
6146         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6147         * output.cc (Output_section::Input_section::relobj): Move method
6148         defintion from class declaration to here and handle merge sections.
6149         (Output_section::Input_section::shndx): Ditto.
6150         (Output_section::Output_section): Remove initializations of removed
6151         data members and initialize new data member LOOKUP_MAPS_.
6152         (Output_section::add_input_section): Set keeps-input-sections flag
6153         for a newly created merge output section as appropriate.  Adjust code
6154         to use Output_section_lookup_maps class.
6155         (Output_section::add_relaxed_input_section): Adjst code for lookup
6156         maps code refactoring.
6157         (Output_section::add_merge_input_section): Add a new parameter
6158         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6159         class.  If adding input section to a newly created merge output
6160         section fails, remove the new merge section.
6161         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6162         Adjust code for use of the Output_section_lookup_maps class.
6163         (Output_section::find_merge_section): Ditto.
6164         (Output_section::build_lookup_maps): New method defintion.
6165         (Output_section::find_relaxed_input_section): Adjust code to use
6166         Output_section_lookup_maps class.
6167         (Output_section::get_input_sections): Export merge sections.  Adjust
6168         code to use Output_section_lookup_maps class.
6169         (Output_section:::add_script_input_section): Adjust code to use
6170         Output_section_lookup_maps class.  Update lookup maps for merge
6171         sections also.
6172         (Output_section::discard_states): Use Output_section_lookup_maps.
6173         (Output_section::restore_states): Same.
6174         * output.h (Merge_section_properties): Move class defintion out of
6175         Output_section.
6176         (Output_section_lookup_maps): New class.
6177         (Output_section::Input_section::is_merge_section): New method
6178         defintion.
6179         (Output_section::Input_section::relobj): Move defintion out of class
6180         defintion.  Declare method only.
6181         (Output_section::Input_section::shndx): Ditto.
6182         (Output_section::Input_section::output_merge_base): New method defintion.
6183         (Output_section::Input_section::u2_.pomb): New union field.
6184         (Output_section::Merge_section_by_properties_map,
6185         Output_section::Output_section_data_by_input_section_map,
6186         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6187         Remove types.
6188         (Output_section::add_merge_input_section): Add new parameter
6189         KEEPS_INPUT_SECTIONS.
6190         (Output_section::build_lookup_maps): New method declaration.
6191         (Output_section::merge_section_map_,
6192         Output_section::merge_section_by_properties_map_,
6193         Output_section::relaxed_input_section_map_,
6194         Output_section::is_relaxed_input_section_map_valid_): Remove data
6195         members.
6196         (Output_section::lookup_maps_): New data member.
6197
6198 2010-05-21  Doug Kwan  <dougkwan@google.com>
6199
6200         PR gold/11619
6201         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6202         avoid a compilation error.
6203
6204 2010-05-19  Rafael Espindola  <espindola@google.com>
6205
6206         * script-sections.cc (Output_section_definition::allocate_to_segment):
6207         Update the phdrs_list even when the output section is NULL.
6208         * testsuite/Makefile.am: Add test.
6209         * testsuite/Makefile.in: Regenerate.
6210         * testsuite/script_test_9.cc: New.
6211         * testsuite/script_test_9.sh: New.
6212         * testsuite/script_test_9.t: New.
6213
6214 2010-05-19  Doug Kwan  <dougkwan@google.com>
6215
6216         * arm.cc (Arm_input_section::original_size): New method.
6217         (Arm_input_section::do_addralign): Add a cast.
6218         (Arm_input_section::do_output_offset): Remove static cast.
6219         (Arm_input_section::original_addralign,
6220          Arm_input_section::original_size_): Change type to uint32_t.
6221         (Arm_input_section::init): Add safe casts for section alignment
6222         and size.
6223         (Arm_input_section::set_final_data_size): Do not set address and
6224         offset of stub table.
6225         (Arm_output_section::fix_exidx_coverage): Change use of of
6226         Output_section::Simple_input_section to that of
6227         Output_section::Input_section.
6228         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6229         except for the first pass.
6230         * output.cc (Output_section::get_input_sections): Change type of
6231         input_sections to std::list<Input_section>.
6232         (Output_section::add_script_input_section): Rename from
6233         Output_section::add_simple_input_section.  Change type of SIS
6234         parameter from Simple_input_section to Input_section.
6235         * output.h (Output_section::Simple_input_section): Remove class.
6236         (Output_section::Input_section): Change class visibility to public.
6237         (Output_section::Input_section::addralign): Use stored alignments
6238         for special input sections if set.
6239         (Output_section::Input_section::set_addralign): New method.
6240         (Output_section::get_input_sections): Change parameter type from
6241         list of Simple_input_section to list of Input_section.
6242         (Output_section::add_script_input_section): Rename from
6243         Output_section::add_simple_input_section. Change first parameter's
6244         type from Simple_input_section to Input_section and remove the
6245         second and third parameters.
6246         * script-sections.cc (Input_section::Input_section_list): Change
6247         type to list of Output_section::Input_section/
6248         (Input_section_info::Input_section_info): Change parameter type of
6249         INPUT_SECTION to Output_section::Input_section.
6250         (Input_section_info::input_section): Change return type.
6251         (Input_section_info::input_section_): Change type to
6252         Output_section::Input_section.
6253         (Output_section_element_input::set_section_addresses): Adjust code
6254         to use Output_section::Input_section instead of
6255         Output_section::Simple_input_section.  Adjust code for renaming
6256         of Output_section::add_simple_input_section.
6257         (Orphan_output_section::set_section_addresses): Ditto.
6258
6259 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6260
6261         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6262         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6263
6264 2010-05-18  Rafael Espindola  <espindola@google.com>
6265
6266         * options.cc (General_options::finalize): Handle -nostdlib.
6267         * options.h (nostdlib): New option.
6268         * script.cc (script_add_search_dir): Handle -nostdlib.
6269
6270 2010-05-12  Doug Kwan  <dougkwan@google.com>
6271
6272         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6273         attributes section only if there no attributes section after merging.
6274         (Target_arm::merge_object_attributes): Move value of
6275         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6276         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6277         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6278         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6279         and arm_attr_merge_7.stdout.
6280         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6281         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6282         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6283         arm_attr_merge_7b.o): New rules.
6284         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6285         arm_attr_merge_7
6286         * testsuite/Makefile.in: Regenerate.
6287         * testsuite/arm_attr_merge.sh: New file.
6288         * testsuite/arm_attr_merge_[67][ab].s: Same.
6289
6290 2010-05-05  Nick Clifton  <nickc@redhat.com>
6291
6292         * po/es.po: Updated Spanish translation.
6293
6294 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6295
6296         * Makefile.am (install-exec-local): Properly install gold as
6297         default cross linker.
6298         * Makefile.in: Regenerated.
6299
6300 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6301             Nick Clifton  <nickc@redhat.com>
6302
6303         * configure.ac (install_as_default): Define and set to false
6304         unless --enable-gold or --enable-gold=both/gold has been
6305         specified.
6306         * configure: Regenerate.
6307
6308         * Makefile.am (install-exec-local): Install the executable as
6309         'ld.gold'.  If install_as_default is true then also install it as
6310         'ld'.
6311         * Makefile.in: Regenerated.
6312
6313 2010-04-24  Ian Lance Taylor  <iant@google.com>
6314
6315         * layout.cc (Layout::layout_reloc): In relocatable link don't
6316         combine reloc sections for grouped sections.
6317
6318 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6319
6320         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6321         sections that are not ordinary to icf.
6322         * icf.cc (get_section_contents): Handle relocation pointing to section
6323         with no object or shndx information.
6324         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6325         * testsuite/Makefile.in: Regenerate.
6326         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6327         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6328
6329 2010-04-22  Ian Lance Taylor  <iant@google.com>
6330
6331         * expression.cc (Expression::Expression_eval_info): Add
6332         result_alignment_pointer field.
6333         (Expression::eval_with_dot): Add result_alignment_pointer
6334         parameter.  Change all callers.
6335         (Expression::eval_maybe_dot): Likewise.
6336         (class Binary_expression): Add alignment_pointer parameter to
6337         left_value and right_value.  Change all callers.
6338         (BINARY_EXPRESSION): Set result alignment.
6339         (class Trinary_expression): Add alignment_pointer parameter to
6340         arg2_value and arg3_value.  Change all callers.
6341         (Trinary_cond::value): Set result alignment.
6342         (Max_expression::value, Min_expression::value): Likewise.
6343         (Align_expression::value): Likewise.
6344         * script-sections.cc (class Sections_element): Add dot_alignment
6345         parameter to set_section_addresses virtual function.  Update
6346         instantiations.
6347         (class Output_section_element): Likewise.
6348         (Script_sections::create_segments): Add dot_alignment parameter.
6349         Change all callers.
6350         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6351         (Script_sections::set_phdrs_clause_addresses): Likewise.
6352         * script-sections.h: Update declarations.
6353         * script.h: Update declarations.
6354         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6355         min_p_align.
6356         * testsuite/script_test_3.t: Set large alignment.
6357         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6358         segment has expected alignment.
6359
6360 2010-04-22  Nick Clifton  <nickc@redhat.com>
6361
6362         * po/gold.pot: Updated by the Translation project.
6363         * po/vi.po: Updated Vietnamese translation.
6364
6365 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6366
6367         * testsuite/Makefile.am (check_PROGRAMS): Add
6368         icf_virtual_function_folding_test.
6369         * testsuite/Makefile.in: Regenerated.
6370
6371 2010-04-15  Andrew Haley  <aph@redhat.com>
6372
6373         * options.h (merge_exidx_entries): New option.
6374         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6375         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6376         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6377         (Target_arm::merge_exidx_entries): New function.
6378         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6379         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6380         to Arm_exidx_fixup constructor.
6381         Add new arg, merge_exidx_entries.
6382         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6383         Arm_output_section::fix_exidx_coverage.
6384
6385 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6386
6387         * icf.cc (get_section_contents): Check for preemptible functions.
6388         Ignore addend when appropriate.
6389         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6390         section folded.
6391         (add_from_relobj): Check for section folded.
6392         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6393         * symtab.h (should_add_dynsym_entry): Add new parameter.
6394         * target-reloc.h (scan_relocs): Check for section folded.
6395         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6396         Check reloc types for function pointers in shared objects.
6397         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6398         case.
6399         (icf_preemptible_functions_test): New test case.
6400         (icf_string_merge_test): New test case.
6401         * testsuite.Makefile.in: Regenerate.
6402         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6403         bar_glob.  Refactor code.
6404         * testsuite/icf_preemptible_functions_test.cc: New file.
6405         * testsuite/icf_preemptible_functions_test.sh: New file.
6406         * testsuite/icf_string_merge_test.cc: New file.
6407         * testsuite/icf_string_merge_test.sh: New file.
6408         * testsuite/icf_virtual_function_folding_test.cc: New file.
6409         * testsuite/icf_virtual_function_folding_test.sh: New file.
6410
6411 2010-04-14  Doug Kwan  <dougkwan@google.com>
6412
6413         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6414         for local symbol recounting if we remove a section due to ICF.
6415         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6416         there are no regular objects in input.
6417
6418 2010-04-13  Doug Kwan  <dougkwan@google.com>
6419
6420         * arm.cc (Arm_input_section::set_final_data_size): Compute
6421         accurate final data size instead of using current data size.
6422
6423 2010-04-09  Doug Kwan  <dougkwan@google.com>
6424
6425         * layout.cc (Layout::choose_output_section): Handle script section
6426         types.
6427         (Layout::make_output_section_for_script): Add section type parameter.
6428         Handle script section types.
6429         * layout.h (Layout::make_output_section_for_script): Add section
6430         type parameter.
6431         * output.cc (Output_section::Output_section): Initialize data member
6432         is_noload_.
6433         (Output_section::do_reset_address_and_file_offset): Do not set address
6434         to 0 if section is a NOLOAD section.
6435         * output.h (Output_section::is_noload): New method.
6436         (Output_section::set_is_noload): Ditto.
6437         (Output_section::is_noload_): New data member.
6438         * script-c.h (Script_section_type): New enum type.
6439         (struct Parser_output_section_header): Add new file section_type.
6440         * script-sections.cc (Sections_element::output_section_name): Add
6441         parameter for returning script section type.
6442         (Output_section_definition::output_section_name): Ditto.
6443         (Output_section_definition::section_type)P; New method.
6444         (Output_section_definiton::script_section_type_name): Ditto.
6445         (Output_section_definition::script_section_type_): New data member.
6446         (Output_section_definition::Output_section_definition): Initialize
6447         data member Output_section_definition::script_section_type_.
6448         (Output_section_definition::create_sections): Pass script section type
6449         to Layout::make_output_section_for_script.
6450         (Output_section_definition::output_section_name): Return script
6451         section type to caller.
6452         (Output_section_definition::set_section_address): Do not advance
6453         dot value and load address if section type is NOLOAD.  Set address
6454         of NOLOAD sections regardless of section flags.
6455         (Output_section_definition::print): Print section type if it is
6456         not SCRIPT_SECTION_TYPE_NONE.
6457         (Output_section_definition::section_type): New method.
6458         (Output_section_definition::script_section_type_name): Ditto.
6459         (Script_sections::output_section_name): Add new parameter
6460         PSECTION_TYPE for returning script section type.  Pass it to
6461         section elements.  Handle discard sections.
6462         (Sort_output_sections::operator()): Handle NOLOAD sections.
6463         * script-sections.h (Script_sections::Section_type): New enum type.
6464         (Script_sections::output_section_name): Add a new parameter for
6465         returning script section type.
6466         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6467         INFO and NOLOAD.
6468         * yyscript.y (union): Add new field SECTION_TYPE.
6469         (COPY, DSECT, INFO, NOLOAD): New tokens.
6470         (opt_address_and_section_type): Change type to output_section_header.
6471         (section_type): New non-terminal
6472         (section_header): Handle section type.
6473         (opt_address_and_section_type): Return section type value.
6474
6475 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6476
6477         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6478         * testsuite/plugin_common_test_2.c (foo): Likewise.
6479
6480 2010-04-08  Doug Kwan  <dougkwan@google.com>
6481
6482         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6483         Output_merge_data.
6484         * output.cc (Output_section::add_merge_input_section): Simplify
6485         code and return status of Output_merge_base::add_input_section.
6486         Update merge section map only if Output_merge_base::add_input_section
6487         returns true.
6488
6489 2010-04-07  Doug Kwan  <dougkwan@google.com>
6490
6491         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6492         if section is marked as containing instructions but has no mapping
6493         symbols.
6494         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6495         correct section index.
6496         (Arm_relobj::find_linked_text_section): Ditto.
6497
6498 2010-04-07  Cary Coutant  <ccoutant@google.com>
6499
6500         * archive.cc (include_member): Destroy Read_symbols_data object before
6501         releasing file.
6502         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6503         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6504         (Read_symbols_data::~Read_symbols_data) New destructor.
6505         (Section_relocs::Section_relocs) New constructor.
6506         (Section_relocs::~Section_relocs) New destructor.
6507         (Read_relocs_data::Read_relocs_data) New constructor.
6508         (Read_relocs_data::~Read_relocs_data) New destructor.
6509         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6510         pointers to NULL after deleting.
6511
6512 2010-04-07  Doug Kwan  <dougkwan@google.com>
6513
6514         * arm.cc: Replace "endianity" with "endianness" in comments.
6515         (Arm_exidx_cantunwind): Ditto.
6516         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6517         (Arm_relobj::merge_flags_and_attributes): New method.
6518         (Arm_relobj::merge_flags_and_attributes_): New data member.
6519         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6520         (Arm_relobj::scan_sections_for_stubs): Ditto.
6521         (Arm_relobj::do_read_symbols): Check to see if we really want to
6522         merge processor-specific flags and attributes.  Exit early if
6523         an object is empty except for section names and the undefined symbol.
6524         (Target_arm::do_finalize_sections): Move check for ELF format to
6525         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6526         attributes from a regular object only when we have determined that
6527         it is aapropriate.  Do not create an .ARM.attributes section in
6528         output if there is no regular input object.
6529         (Target_arm::merge_processor_specific_flags): Check
6530         --warn-mismatch before printing any error.
6531         (Target_arm::merge_object_attributes): Ditto.
6532         * gold.cc (queue_middle_tasks): Handle the case in which there is
6533         no regular object in input.
6534         * options.cc (General_options::parse_EB): New method.
6535         (General_options::parse_EL): Same.
6536         (General_options::General_options): Initialize endianness_.
6537         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6538         New options.
6539         (General_options::Endianness): New enum.
6540         (General_options::endianness): New method.
6541         (General_options::endianness_): New data member.
6542         * parameters.cc (Parameters::set_options): Check target endianness.
6543         (Parameters::set_target_once): Ditto.
6544         (Parameters::check_target_endianness): New method.
6545         (parameters_force_valid_target): If either -EL or -EB is specified,
6546         use it to define endianness of default target.
6547         * parameters.h (Parameters::check_target_endianness): New method
6548         declaration.
6549         * target.h (class Target): Change "endianity" to "endianness"
6550         in comments.
6551
6552 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6553
6554         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6555         * configure: Regenerate.
6556         * Makefile.in: Regenerate.
6557         * testsuite/Makefile.in: Regenerate.
6558
6559 2010-04-06  Cary Coutant  <ccoutant@google.com>
6560
6561         gcc PR lto/42757
6562         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6563         prevailing definitions of common symbols.
6564         * testsuite/plugin_test_6.sh: New test case.
6565         * testsuite/plugin_common_test_1.c: New test case.
6566         * testsuite/plugin_common_test_2.c: New test case.
6567         * testsuite/Makefile.am (plugin_test_6): New test case.
6568         * testsuite/Makefile.in: Regenerate.
6569
6570 2010-04-06  Nick Clifton  <nickc@redhat.com>
6571
6572         * po/vi.po: New Vietnamese translation.
6573
6574 2010-03-30  Doug Kwan  <dougkwan@google.com>
6575
6576         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6577
6578 2010-03-25  Doug Kwan  <dougkwan@google.com>
6579
6580         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6581         to avoid a conversion warning on a 32-bit host.
6582
6583 2010-03-24  Ian Lance Taylor  <iant@google.com>
6584
6585         * testsuite/script_test_3.t: Add a TLS segment.
6586         * testsuite/Makefile.am (check_PROGRAMS): Add
6587         tls_phdrs_script_test.
6588         (tls_phdrs_script_test_SOURCES): Define.
6589         (tls_phdrs_script_test_DEPENDENCIES): Define.
6590         (tls_phdrs_script_test_LDFLAGS): Define.
6591         (tls_phdrs_script_test_LDADD): Define.
6592         * testsuite/Makefile.in: Rebuild.
6593
6594 2010-03-23  Cary Coutant  <ccoutant@google.com>
6595
6596         * fileread.cc (find_or_make_view): Fix comment.
6597
6598 2010-03-23  Ian Lance Taylor  <iant@google.com>
6599
6600         * script-sections.cc (class Orphan_section_placement): Define
6601         PLACE_TLS and PLACE_TLS_BSS.
6602         (Orphan_section_placement::Orphan_section_placement): Initialize
6603         new places.
6604         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6605         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6606         (tls_script_test_SOURCES): Define.
6607         (tls_script_test_DEPENDENCIES): Define.
6608         (tls_script_test_LDFLAGS): Define.
6609         (tls_script_test_LDADD): Define.
6610         * testsuite/Makefile.in: Rebuild.
6611
6612 2010-03-22  Doug Kwan  <dougkwan@google.com>
6613
6614         * arm.cc (Arm_relocate_functions::abs8,
6615         Arm_relocate_functions::abs16): Use correct check for overflow
6616         specified in the ARM ELF specs.
6617         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6618         target of a BLX instruction specially.
6619         (Reloc_stub::stub_type_for_reloc): Ditto.
6620         (Relocate::relocate): Use symbolic names instead of numeric relocation
6621         codes to report error.
6622         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6623         workaround.
6624         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6625         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6626         thumb2_blx_out_of_range.stdout
6627         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6628         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6629         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6630         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6631         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6632         thumb2_blx_in_range, thumb2_blx_in_range.o,
6633         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6634         thumb2_blx_out_of_range.o): New rules.
6635         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6636         thumb2_blx_in_range and thumb2_blx_out_of_range.
6637         * testsuite/Makefile.in: Regenerate.
6638         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6639         * testsuite/thumb_blx_in_range.s: New file.
6640         * testsuite/thumb_blx_out_of_range.s: New file.
6641
6642 2010-03-22  Rafael Espindola  <espindola@google.com>
6643
6644         * archive.cc (Should_include): Move to archive.h.
6645         (should_include_member): Make it a member of Archive.
6646         (Lib_group): New.
6647         (Add_lib_group_symbols): New.
6648         * archive.h: Include options.h.
6649         (Archive_member): Moved from Archive.
6650         (Should_include): Moved from archive.cc.
6651         (Lib_group): New.
6652         (Add_lib_group_symbols): New.
6653         * dynobj.cc (do_should_include_member): New.
6654         * dynobj.h (do_should_include_member): New.
6655         * gold.cc (queue_initial_tasks): Update call to queue.
6656         * main.cc (main): Print lib group stats.
6657         * object.cc (do_should_include_member): New.
6658         * object.h: Include archive.h.
6659         (Object::should_include_member): New.
6660         (Object::do_should_include_member): New.
6661         (Sized_relobj::do_should_include_member): New.
6662         * options.cc (General_options::parse_start_lib): New.
6663         (General_options::parse_end_lib): New.
6664         (Input_arguments::add_file): Handle lib groups.
6665         (Input_arguments::start_group): Check we are not in a lib.
6666         (Input_arguments::start_lib): New.
6667         (Input_arguments::end_lib): New.
6668         * options.h (General_options): Add start_lib and end_lib.
6669         (Input_argument::lib_): New.
6670         (Input_argument::lib): New.
6671         (Input_argument::is_lib): New.
6672         (Input_file_lib): New.
6673         (Input_arguments::in_lib_): New.
6674         (Input_arguments::in_lib): New.
6675         (Input_arguments::start_lib): New.
6676         (Input_arguments::end_lib_): New.
6677         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6678         in unused members as preempted.
6679         (Sized_pluginobj::do_should_include_member): New.
6680         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6681         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6682         return the blocker.
6683         (Read_symbols::do_whole_lib_group): New.
6684         (Read_symbols::do_lib_group): New.
6685         (Read_symbols::do_read_symbols): Handle lib groups.
6686         (Read_symbols::get_name): Handle lib groups.
6687         * readsyms.h (Read_symbols): Add an archive member pointer.
6688         (Read_symbols::do_whole_lib_group): New.
6689         (Read_symbols::do_lib_group): New.
6690         (Read_symbols::member_): New.
6691         * script.cc (read_input_script): Update call to queue_soon.
6692
6693 2010-03-19  Doug Kwan  <dougkwan@google.com>
6694
6695         * arm.cc (Stub_table::Stub_table): Initialize new data members
6696         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6697         (Stub_table::add_reloc_stub): Assign stub offset and update
6698         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6699         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6700         New data members.
6701         (Stub_table::update_data_size_and_addralign): Use
6702         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6703         instead of going over all reloc stubs.
6704         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6705         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6706         Stringpool_template::offset_ to size of Stringpool_char.
6707         (Stringpool_template::new_key_offset): Remove code to initialize
6708         Stringpool_template::offset_.
6709         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6710         Stringpool_template::offset_ to zero.
6711
6712 2010-03-15  Doug Kwan  <dougkwan@google.com>
6713
6714         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6715         offset_.
6716         (Stringpool_template::new_key_offset): New method.
6717         (Stringpool_template::add_string): Assign offsets when adding new
6718         strings.
6719         (Stringpool_template::set_string_offsets): Do not set string offsets
6720         when not optimizing.
6721         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6722         member size_.
6723         (Chunked_vector::clear): Clear size_.
6724         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6725         (Chunked_vector::size): Return size_.
6726         (Chunked_vector::push_back): Use size_ to find insert position.
6727         (Chunked_vector::size_): New data member.
6728         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6729         (Stringpool_template::new_key_offset): New method declaration.
6730         (Stringpool_template::offset_): New data member.
6731
6732 2010-03-15   Rafael Espindola  <espindola@google.com>
6733
6734         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6735         Add_symbols' constructor.
6736         * readsyms.h (Add_symbols): Remove the input_group member.
6737
6738 2010-03-10  Ian Lance Taylor  <iant@google.com>
6739
6740         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6741         target to ask whether a reference to a symbol requires a stack
6742         split.
6743         * target.h (Target::is_call_to_non_split): New function.
6744         (Target::do_is_call_to_non_split): Declare virtual function.
6745         * target.cc: Include "symtab.h".
6746         (Target::do_is_call_to_non_split): New function.
6747         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6748
6749 2010-03-10  Cary Coutant  <ccoutant@google.com>
6750
6751         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6752         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6753         (File_read::open[2]): Add whole_file_view_ to list of views.
6754         (File_read::make_view): Remove test of whole_file_view_.
6755         (File_read::find_or_make_view): Create whole_file_view_ if
6756         necessary.
6757         (File_read::clear_views): Replace bool parameter with enum;
6758         adjust all callers.  Don't delete views with permanent data;
6759         do delete cached views and views from archives if
6760         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6761         if clearing the corresponding view.
6762         * fileread.h (File_read::Clear_views_mode): New enum.
6763         (File_read::View::is_permanent_view): New method.
6764         (File_read::clear_views): Replace bool parameter
6765         with enum; adjust all callers.
6766         * options.h (General_options): Change keep_files_mapped option;
6767         add map_whole_files.
6768         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6769         releasing the file.
6770         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6771         the file.
6772
6773 2010-03-10  David S. Miller  <davem@davemloft.net>
6774
6775         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6776
6777 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6778
6779         * icf.cc (get_section_contents): Add '@' marker after processing the
6780         merge reloc.
6781
6782 2010-03-08  Doug Kwan  <dougkwan@google.com>
6783
6784         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6785         due to a conversion warning.
6786         (Arm_relobj::update_output_local_symbol_count): Check for local
6787         symbol with unset output index.
6788
6789 2010-03-05  Ian Lance Taylor  <iant@google.com>
6790
6791         * options.h (class General_options): Add --spare-dynamic-tags.
6792         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6793         --spare-dynamic-tags.
6794
6795 2010-03-05  Ian Lance Taylor  <iant@google.com>
6796
6797         * incremental.cc: Include "libiberty.h".
6798
6799 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6800
6801         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6802         function, is_info_ member.
6803         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6804         (Versions::Versions): Update caller.
6805         (Versions::define_base_version): Likewise.
6806         (Versions::add_def): Likewise.
6807
6808 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6809
6810         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6811         (Scan::possible_function_pointer_reloc): New function.
6812         (Scan::local_reloc_may_be_function_pointer): Change to call
6813         possible_function_pointer_reloc.
6814         (Scan::global_reloc_may_be_function_pointer): Ditto.
6815         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6816         relocations in ".data.rel.ro._ZTV" section.
6817         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6818         * testsuite/icf_safe_so_test.cc: Ditto.
6819         * testsuite/icf_safe_test.cc: Ditto.
6820         * testsuite/icf_safe_test.sh: Ditto.
6821
6822 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6823             Ian Lance Taylor  <iant@google.com>
6824
6825         * target-reloc.h (relocate_section): Check the symbol table index
6826         for -1U before setting the local symbol index.
6827         (scan_relocatable_relocs): If copying the relocation, record that
6828         the local symbol is required.
6829         * object.h (Symbol_value::is_output_symtab_index_set): New
6830         function.
6831         (Symbol_value::may_be_discarded_from_output_symtab): New
6832         function.
6833         (Symbol_value::has_output_symtab_entry): New function.
6834         (Symbol_value::needs_output_symtab_entry): Remove.
6835         (Symbol_value::output_symtab_index): Make sure the symbol index is
6836         set.
6837         (Symbol_value::set_output_symtab_index): Make sure the symbol
6838         index is not set.  Make sure the new index is valid.
6839         (Symbol_value::set_must_have_output_symtab_entry): New function.
6840         (Symbol_value::has_output_dynsym_entry): New function.
6841         (Symbol_value::set_output_dynsym_index): Make sure the new index
6842         is valid.
6843         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6844         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6845         local symbol if permitted.
6846         (Sized_relobj::do_finalize_local_symbols): Call
6847         is_output_symtab_index_set rather than needs_output_symtab_entry.
6848         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6849         rather than needs_output_symtab_entry.  Call
6850         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6851         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6852         is_output_symtab_index_set rather than needs_output_symtab_entry.
6853         * testsuite/discard_locals_relocatable_test.c: New file.
6854         * testsuite/discard_locals_test.sh: Test -r.
6855         * testsuite/Makefile.am (check_DATA): Add
6856         discard_locals_relocatable_test1.syms,
6857         discard_local_relocatable_test2.syms.
6858         (MOSTLYCLEANFILES): Likewise.  Also add
6859         discard_locals_relocatable_test1.lout and
6860         discard_locals_relocatable_test2.out.
6861         (discard_locals_relocatable_test1.syms): New target.
6862         (discard_locals_relocatable_test.o): New target.
6863         (discard_locals_relocatable_test1.out): New target.
6864         (discard_locals_relocatable_test2.syms): New target.
6865         (discard_locals_relocatable_test2.out): New target.
6866         (various): Add missing ../ld-new dependencies.
6867         * testsuite/Makefile.in: Rebuild.
6868
6869 2010-03-03  Nick Clifton  <nickc@redhat.com>
6870
6871         * po/fi.po: New Finnish translation.
6872
6873 2010-03-01  Doug Kwan  <dougkwan@google.com>
6874
6875         * layout.cc (Layout::Layout): Force section types of .init_array*,
6876         .preinit_array* and .fini_array* sections.
6877         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6878         Fix check of return value of std::string::find.().
6879         (Output_section::Input_section_sort_compare::operator()): Remove
6880         comment about .init_array.
6881         (Output_section::Input_section_sort_init_fini_compare::operator()):
6882         New method.
6883         (Output_section::sort_attached_input_sections): Handle .init_array
6884         and .fini_array specially.
6885         * output.h (Output_section::Inut_section_sort_compare): Update
6886         comment.
6887         (Output_section::Input_section_sort_init_fini_compare): New struct.
6888
6889 2010-02-26  Doug Kwan  <dougkwan@google.com>
6890
6891         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6892         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6893         * testsuite/debug_msg.sh: Avoid matching source line number for
6894         use of global variable undef_int.
6895
6896 2010-02-26  Doug Kwan  <dougkwan@google.com>
6897
6898         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6899         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6900         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6901         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6902         * options.cc (General_options::General_options): Initialize member
6903         fix_v4bx_.
6904         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6905         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6906         and rm_no_fix_v4bx.stdout
6907         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6908         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6909         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6910         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6911         and arm_no_fix_v4bx.
6912         * Makefile.in: Regenerate.
6913         * testsuite/arm_fix_v4bx.s: New file.
6914         * testsuite/arm_fix_v4bx.sh: Ditto.
6915
6916 2010-02-24  Doug Kwan  <dougkwan@google.com>
6917
6918         * arm.cc (Target_arm::got_section): Make the .got section the first
6919         non RELRO section in the data segment.
6920         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6921         suffixes of section names.
6922
6923 2010-02-24  Doug Kwan  <dougkwan@google.com>
6924
6925         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6926         flags and attributes merging if an input file is a binary file.
6927         * fileread.cc (Input_file::open): Record format of original file.
6928         * fileread.h (Input_file::Format): New enum type.
6929         (Input_file::Input_file): Initialize data member format_.
6930         (Input_file::format): New method definition.
6931         (Input_file::format_):: New data member.
6932
6933 2010-02-24  Doug Kwan  <dougkwan@google.com>
6934
6935         * arm.cc (Arm_output_data_got): New class.
6936         (ARM_TCB_SIZE): New constant
6937         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6938         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6939         If user uses a script with a SECTIONS clause, issue only a warning
6940         for a misplaced EXIDX input section.  Otherwise, issue an error.
6941         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6942         garbage collection.
6943         (Target_arm::got_mode_index_entry): Handle static linking.
6944         (Target_arm::Scan::local): Ditto.
6945         (Target_arm::Scan::global): Ditto.
6946         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6947         all incorrectly implemented relocations.
6948         (Target_arm::fix_exidx_coverage): Pass layout to
6949         Arm_output_section::fix_exidx_coverage.
6950         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6951         from ".ARM.exidx." and ".ARM.extab.".
6952
6953 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6954
6955         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6956         section if it does not already exist.
6957         * attributes.cc (Attributes_section_data::Attributes_section_data):
6958         Don't crash if size is zero.
6959
6960 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6961             Ian Lance Taylor  <iant@google.com>
6962
6963         * gold.cc (queue_middle_tasks): If no input files were opened,
6964         exit.
6965         * workqueue.h (Task_function::Task_function): Assert that there is
6966         a blocker.
6967
6968 2010-02-22  Doug Kwan  <dougkwan@google.com>
6969
6970         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6971         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6972         types to avoid warnings due to different uint64_t implementations
6973         on different hosts.
6974
6975 2010-02-21  Doug Kwan  <dougkwan@google.com>
6976
6977         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6978         handling of the maximum backward branch offset.
6979         (Arm_relocate_functions::thumb_branch_common): Ditto.
6980         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6981         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6982         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6983         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6984         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6985         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6986         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6987         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6988         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6989         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6990         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6991         thumb2_bl_out_of_range.o): New rules.
6992         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6993         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6994         thumb2_bl_out_of_range
6995         * testsuite/Makefile.in: Regenerate.
6996         * testsuite/arm_bl_in_range.s: New file.
6997         * testsuite/arm_bl_out_of_range.s: Ditto.
6998         * testsuite/arm_branch_in_range.sh: Ditto.
6999         * testsuite/arm_branch_range.t: Ditto.
7000         * testsuite/thumb2_branch_range.t: Ditto.
7001         * testsuite/thumb_bl_in_range.s: Ditto.
7002         * testsuite/thumb_bl_out_of_range.s: Ditto.
7003         * testsuite/thumb_branch_range.t: Ditto.
7004
7005 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7006
7007         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7008         Add reloc offset information.
7009         * icf.cc (get_section_contents): Change iterators to point to the new
7010         vectors. Add reloc offset information to the contents.
7011         * icf.h (Icf::Sections_reachable_info): New typedef.
7012         (Icf::Sections_reachable_list): New typedef.
7013         (Icf::Offset_info): New typedef.
7014         (Icf::Reloc_info): New struct typedef.
7015         (Icf::Reloc_info_list): New typedef.
7016         (Icf::symbol_reloc_list): Delete method.
7017         (Icf::addend_reloc_list): Delete method.
7018         (Icf::section_reloc_list): Delete method.
7019         (Icf::reloc_info_list): New method.
7020         (Icf::reloc_info_list_): New member.
7021
7022 2010-02-19  Doug Kwan  <dougkwan@google.com>
7023
7024         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7025         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7026         * arm.cc (Arm_relocation_functions): New forward declaration.
7027         (Target_arm::Target_arm): Initialize new data members
7028         got_mod_index_offset_ and tls_base_symbol_defined_.
7029         (Target_arm::Relocate::relocate_tls): New method.
7030         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7031          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7032         New methods.
7033         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7034         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7035         (Target_arm::got_mod_index_offset_,
7036         Target_arm::tls_base_symbol_defined_): New data members.
7037         (Target_arm::Scan::local, Target::Scan::global,
7038         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7039         relocations.
7040
7041 2010-02-18  Doug Kwan  <dougkwan@google.com>
7042
7043         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7044         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7045         text section as a parameter becuase some broken tools may not set
7046         the link in section header.
7047         (Target_arm::has_got_section): New method.
7048         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7049         without any mapping symbol as data only.  Remove warning.
7050         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7051         link in its section header, try to discover the link by inspecting the
7052         REL31 relocation at the beginning of the section.
7053         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7054         in error message.
7055         (Target_arm::Scan::global): Treat any reference to the symbol
7056         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7057
7058 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7059
7060         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7061         (Scan::global_reloc_may_be_function_pointer): New function.
7062         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7063         (Scan::global_reloc_may_be_function_pointer): New function.
7064         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7065         (Scan::global_reloc_may_be_function_pointer): New function.
7066         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7067         (Scan::global_reloc_may_be_function_pointer): New function.
7068         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7069         (Scan::global_reloc_may_be_function_pointer): New function.
7070         (Scan::possible_function_pointer_reloc): New function.
7071         (Target_x86_64::can_check_for_function_pointers): New function.
7072         * gc.h (gc_process_relocs): Scan relocation types to determine if
7073         function pointers were taken for targets that support it.
7074         * icf.cc (Icf::find_identical_sections): Include functions for
7075         folding in safe ICF whose pointer is not taken.
7076         * icf.h (Secn_fptr_taken_set): New typedef.
7077         (fptr_section_id_): New member.
7078         (section_has_function_pointers): New function.
7079         (set_section_has_function_pointers): New function.
7080         (check_section_for_function_pointers): New function.
7081         * options.h: Fix comment for safe ICF option.
7082         * target.h (can_check_for_function_pointers): New function.
7083         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7084         Modify icf_safe_test for X86-64.
7085         * testsuite/Makefile.in: Regenerate.
7086         * testsuite/icf_safe_so_test.cc: New file.
7087         * testsuite/icf_safe_so_test.sh: New file.
7088         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7089         (main): Change to take pointer to function kept_func_3.
7090         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7091         folding is done correctly for X86-64.
7092
7093 2010-02-12  David S. Miller  <davem@davemloft.net>
7094
7095         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7096         is_symbolless parameter.
7097         (Output_reloc<SHT_REL>::is_symbolless): New.
7098         (Output_reloc<SHT_REL>::is_symbolless_): New.
7099         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7100         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7101         (Output_reloc<SHT_RELA>::is_symbolless): New.
7102         (Output_data_reloc::add_global): Handle is_symbolless.
7103         (Output_data_reloc::add_global_relative): Likewise.
7104         (Output_data_reloc::add_local): Likewise.
7105         (Output_data_reloc::add_local_relative): Likewise.
7106         (Output_data_reloc::add_symbolless_global_addend): New.
7107         (Output_data_reloc::add_symbolless_local_addend): New.
7108         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7109         is_symbolless.
7110         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7111         instead of ->is_relative_
7112         (Output_reloc::write): Likewise.
7113         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7114         (Output_reloc::write_rel): Simplify.
7115
7116         * sparc.cc (Target_sparc::Scan::local): Use
7117         ->add_symbolless_local_addend as needed.
7118         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7119         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7120         based upon relocation offset.
7121
7122 2010-02-11  Doug Kwan  <dougkwan@google.com>
7123
7124         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7125         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7126         beginning of function.
7127         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7128         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7129         parameter is_32bit in calls to should_apply_static_reloc.
7130         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7131         (check_DATA): Add arm_abs_global.stdout.
7132         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7133         arm_abs_global.stdout): New rules.
7134         (MOSTLLYCLEANFILES): Add arm_abs_global
7135         * Makefile.in: Regenerate.
7136         * testsuite/arm_abs_global.s: New file.
7137         * testsuite/arm_abs_global.sh: Ditto.
7138         * testsuite/arm_abs_lib.s: Ditto.
7139
7140 2010-02-11  Ian Lance Taylor  <iant@google.com>
7141
7142         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7143         Read_relocs task.
7144         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7145         Allocate_commons_task first.
7146         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7147         task, rather than symtab_lock_.
7148         (Gc_process_relocs::~Gc_process_relocs): New function.
7149         (Gc_process_relocs::is_runnable): Check this_blocker_.
7150         (Gc_process_relocs::locks): Use next_blocker_ rather than
7151         blocker_.
7152         (Scan_relocs::~Scan_relocs): New function.
7153         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7154         symtab_lock_.
7155         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7156         next_blocker_.
7157         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7158         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7159         constructor accordingly.
7160         (class Gc_process_relocs): Likewise.
7161         (class Scan_relocs): Likewise.
7162         * common.h (class Allocate_commons_task): Remove symtab_lock_
7163         field, and corresponding constructor parameter.
7164         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7165         symtab_lock_.
7166         (Allocate_commons_task::locks): Likewise.
7167
7168 2010-02-11  Ian Lance Taylor  <iant@google.com>
7169
7170         * gold-threads.h (class Once): Define.
7171         (class Initialize_lock): Rewrite as child of Once.
7172         * gold-threads.cc (class Once_initialize): Define.
7173         (once_pointer_control): New static variable.
7174         (once_pointer, once_arg): New static variables.
7175         (c_run_once): New static function.
7176         (Once::Once, Once::run_once, Once::internal_run): New functions.
7177         (class Initialize_lock_once): Remove.
7178         (initialize_lock_control): Remove.
7179         (initialize_lock_pointer): Remove.
7180         (initialize_lock_once): Remove.
7181         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7182         (Initialize_lock::initialize): Rewrite.
7183         (Initialize_lock::do_run_once): New function.
7184         * archive.cc (Archive::interpret_header): Only clear name if it is
7185         not already empty.
7186         * fileread.cc: Include "gold-threads.h"
7187         (file_counts_lock): New static variable.
7188         (file_counts_initialize_lock): Likewise.
7189         (File_read::release): Only increment counts when using --stats.
7190         Use a lock around the increment.
7191         * parameters.cc (class Set_parameters_target_once): Define.
7192         (set_parameters_target_once): New static variable.
7193         (Parameters::Parameters): Move here from parameters.h.
7194         (Parameters::set_target): Rewrite.
7195         (Parameters::set_target_once): New function.
7196         (Parameters::clear_target): Move here and rewrite.
7197         * parameters.h (class Parameters): Update declarations.  Add
7198         set_parameters_target_once_ field.
7199         (Parameters::Parameters): Move to parameters.cc.
7200         (Parameters::clear_target): Likewise.
7201         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7202         task.
7203         (Start_group::~Start_group): New function.
7204         (Start_group::is_runnable): New function.
7205         (Start_group::locks, Start_group::run): New functions.
7206         (Finish_group::run): Change saw_undefined to size_t.
7207         * readsyms.h (class Start_group): Define.
7208         (class Finish_group): Change saw_undefined_ field to size_t.
7209         (Finish_group::Finish_group): Remove saw_undefined and
7210         this_blocker parameters.  Change all callers.
7211         (Finish_group::set_saw_undefined): New function.
7212         (Finish_group::set_blocker): New function.
7213         * symtab.h (class Symbol_table): Change saw_undefined to return
7214         size_t.  Change saw_undefined_ field to size_t.
7215         * target-select.cc (Set_target_once::do_run_once): New function.
7216         (Target_selector::Target_selector): Initialize set_target_once_
7217         field.  Don't initialize lock_ and initialize_lock_ fields.
7218         (Target_selector::instantiate_target): Rewrite.
7219         (Target_selector::set_target): New function.
7220         * target-select.h (class Set_target_once): Define.
7221         (class Target_selector): Update declarations.  Make
7222         Set_target_once a friend.  Remove lock_ and initialize_lock_
7223         fields.  Add set_target_once_ field.
7224
7225 2010-02-10  Ian Lance Taylor  <iant@google.com>
7226
7227         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7228         queueing any tasks.
7229         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7230         (queue_middle_tasks): Add all blockers before queueing any tasks.
7231         (queue_final_tasks): Likewise.
7232         * token.h (Task_token::add_blockers): New function.
7233         * object.h (Input_objects::number_of_relobjs): New function.
7234
7235 2010-02-10  Ian Lance Taylor  <iant@google.com>
7236
7237         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7238         shared, not if not position independent.
7239         * x86_64.cc (Relocate::relocate_tls): Likewise.
7240         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7241         (tls_pie_pic_test): New target.
7242         * testsuite/Makefile.in: Rebuild.
7243
7244         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7245         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7246         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7247         * testsuite/Makefile.in: Rebuild.
7248
7249 2010-02-09  David S. Miller  <davem@davemloft.net>
7250
7251         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7252         R_SPARC_RELATIVE using ->add_local_relative().
7253         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7254
7255         * output.h (Output_data_dynamic::add_section_size): New method
7256         that takes two Output_data objects.
7257         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7258         entry param.  Handle it in initializers.
7259         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7260         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7261         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7262         arg.
7263         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7264         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7265         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7266         for dynrel_includes_plt.
7267         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7268         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7269         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7270         before .rela.plt
7271         (Target_sparc::do_finalize_sections): Update to pass true for
7272         dynrel_includes_plt.
7273         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7274         output before .rela.plt
7275         (Target_powerpc::do_finalize_sections): Update to pass true for
7276         dynrel_includes_plt when 32-bit.
7277
7278 2010-02-08  Doug Kwan  <dougkwan@google.com>
7279
7280         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7281         method.
7282         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7283         Arm_relobj::scan_section_for_cortex_a8_stubs,
7284         Arm_relobj::do_relocation_section): Instead of calling
7285         Output_section::output_address, use faster
7286         Arm_relobj::simple_input_section_output_address.
7287
7288 2010-02-08  David S. Miller  <davem@davemloft.net>
7289
7290         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7291         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7292         relocation helper function.
7293
7294         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7295         just like R_SPARC_GOT{10,13,22}.
7296         (Target_sparc::Scan::local): Likewise.
7297         (Target_sparc::Relocate:relocate): Likewise.
7298
7299 2010-02-06  Ian Lance Taylor  <iant@google.com>
7300
7301         * configure.ac: Rewrite targetobjs duplicate removal code to use
7302         only shell constructs.
7303         * configure: Rebuild.
7304
7305 2010-02-05  Doug Kwan  <dougkwan@google.com>
7306
7307         PR 11247
7308         * arm.cc (Arm_relobj::section_is_scannable): New method.
7309         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7310         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7311
7312 2010-02-04  Doug Kwan  <dougkwan@google.com>
7313
7314         PR 11247
7315         * arm-reloc-property.cc (cstdio): Include.
7316         * configure.ac (targetobjs): Remove duplicates.
7317         * configure: Regenerate.
7318         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7319         big and little endian version for a given address size.
7320
7321 2010-02-03  Doug Kwan  <dougkwan@google.com>
7322
7323         * arm-reloc-property.cc
7324         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7325         definition.
7326         * arm-reloc-property.h
7327         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7328         New method definition.
7329         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7330         declaration.
7331         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7332         overflow to N.
7333         (GOT_PREL): Change implemented to Y.
7334         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7335         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7336         (Arm_relocate_functions::movw_abs_nc): Remove method.
7337         (Arm_relocate_functions::movt_abs): Ditto.
7338         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7339         (Arm_relocate_functions::thm_movt_abs): Ditto.
7340         (Arm_relocate_functions::movw_rel_nc): Ditto.
7341         (Arm_relocate_functions::movw_rel): Ditto.
7342         (Arm_relocate_functions::movt_rel): Ditto.
7343         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7344         (Arm_relocate_functions:thm_movw_rel): Ditto.
7345         (Arm_relocate_functions:thm_movt_rel): Ditto.
7346         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7347         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7348         New method definitions.
7349         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7350         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7351         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7352         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7353         (Target_arm::Relocate::relocate): Check for non-static or
7354         unimplemented relocation code and exit early.  Change calls to
7355         Target_arm::reloc_uses_thumb_bit and
7356         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7357         instead.  Refactor code to handle similar relocations to increase
7358         code sharing.  Remove check for unsupported relocation code in switch
7359         statement.
7360         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7361         relocation property table to find out size.  Change error message to
7362         print out the name of a relocation code instead of the numeric value.
7363         (Target_arm::scan_reloc_for_stub): Use relocation property table
7364         instead of calling Target_arm::reloc_uses_thumb_bit().
7365
7366 2010-02-02  Doug Kwan  <dougkwan@google.com>
7367
7368         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7369         types of relaxed input section.
7370
7371 2010-02-02  Doug Kwan  <dougkwan@google.com>
7372
7373         * Makefile.am (HFILES): Add arm-reloc-property.h.
7374         (DEFFILES): New.
7375         (TARGETSOURCES): Add arm-reloc-property.cc
7376         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7377         (libgold_a_SOURCES): $(DEFFILES)
7378         * Makefile.in: Regenerate.
7379         * arm-reloc-property.cc: New file.
7380         * arm-reloc-property.h: New file.
7381         * arm-reloc.def: New file.
7382         * arm.cc: Update comments.
7383         (arm-reloc-property.h): New included header.
7384         (arm_reloc_property_table): New global variable.
7385         (Target_arm::do_select_as_default_target): New method definition.
7386         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7387         arm-reloc-property to targ_extra_obj.
7388         * parameters.cc (set_parameters_target): Call
7389         Target::select_as_default_target().
7390         * target.h (Target::select_as_default_target): New method definition.
7391         (Target::do_select_as_default_target): Same.
7392
7393 2010-02-01  Doug Kwan  <dougkwan@google.com>
7394
7395         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7396         first_output_text_section_.
7397         (Arm_exidx_fixup::first_output_text_section): New method definition.
7398         (Arm_exidx_fixup::first_output_text_section_): New data member.
7399         (Arm_exidx_fixup::process_exidx_section): Record the first text
7400         output section seen.
7401         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7402         and entsize in output section header.
7403
7404 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7405
7406         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7407         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7408         (Arm_relocate_functions::thm_alu11): New Method.
7409         (Arm_relocate_functions::thm_pc8): New Method.
7410         (Arm_relocate_functions::thm_pc12): New Method.
7411         (Target_arm::Scan::local): Handle the relocations.
7412         (Target_arm::Scan::global): Likewise.
7413         (Target_arm::Relocate::relocate): Likewise.
7414         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7415
7416 2010-01-29  Doug Kwan  <dougkwan@google.com>
7417
7418         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7419         of relocation types as ld.
7420
7421 2010-01-29  Doug Kwan  <dougkwan@google.com>
7422
7423         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7424         to public.
7425         (Arm_relocate_functions::thumb_branch_common): Ditto.
7426         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7427         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7428         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7429         Arm_relocate_functions::jump24): Remove.
7430         (Target_arm::Relocate::relocate): Adjust code to call
7431         Arm_relocation_functions::arm_branch_common and
7432         Arm_relocation_functions::thumb_branch_common instead of their removed
7433         wrappers.  Merge switch-cases together to reduce source code size.
7434
7435 2010-01-29  Doug Kwan  <dougkwan@google.com>
7436
7437         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7438         output_local_symbol_count_needs_update_.
7439         (Arm_relobj::output_local_symbol_count_needs_update,
7440          Arm_relobj::set_output_local_symbol_count_needs_update,
7441          Arm_relobj::update_output_local_symbol_count): New methods.
7442         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7443         member.
7444         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7445         of pointed function as in a R_ARM_PREL31 relocation.
7446         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7447         for output local symbol count updating.
7448         (Target_arm::do_relax): Update output local symbol counts in objects
7449         if necessary.
7450         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7451
7452 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7453
7454         * arm.cc: Added support for the ARM relocations:
7455         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7456         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7457         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7458         movw_prel_nc).
7459         (Arm_relocate_functions::movw_rel): New method.
7460         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7461         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7462         thm_movw_prel_nc).
7463         (Arm_relocate_functions::thm_movw_rel): New method.
7464         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7465         thm_movt_prel).
7466         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7467         relocations.
7468         (Target_arm::Scan::global): Likewise.
7469         (Target_arm::Relocate::relocate): Likewise.
7470         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7471         Likewise.
7472
7473 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7474
7475         * arm.cc: Added support for ARM group relocations.
7476         (Target_arm::reloc_needs_sym_origin): New method.
7477         (Arm_relocate_functions::calc_grp_kn): New method.
7478         (Arm_relocate_functions::calc_grp_residual): New method.
7479         (Arm_relocate_functions::calc_grp_gn): New method.
7480         (Arm_relocate_functions::arm_grp_alu): New Method.
7481         (Arm_relocate_functions::arm_grp_ldr): New Method.
7482         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7483         (Arm_relocate_functions::arm_grp_ldc): New Method.
7484         (Target_arm::Scan::local): Handle the ARM group relocations.
7485         (Target_arm::Scan::global): Likewise.
7486         (Target_arm::Relocate::relocate): Likewise.
7487         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7488         Likewise.
7489
7490 2010-01-26  Doug Kwan  <dougkwan@google.com>
7491
7492         * arm.cc (set): Include.
7493         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7494         pointer type.
7495         (Arm_output_section::Text_section_list): New type.
7496         (Arm_output_section::append_text_sections_to_list): New method.
7497         (Arm_output_section::fix_exidx_coverage): Ditto.
7498         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7499         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7500         Relobj::set_section_offset() instead of
7501         Sized_relobj::invalidate_section_offset().
7502         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7503         parameter for section headers. Ignore relocation sections for
7504         unallocated sections and EXIDX sections.
7505         (Target_arm::fix_exidx_coverage): New method.
7506         (Target_arm::output_section_address_less_than): New type.
7507         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7508         linked text section instead of the EXIDX section.
7509         (Arm_output_section::create_stub_group): Add an assertion to check
7510         that this is not an EXIDX output section.
7511         (Arm_output_section::append_text_sections_to_list): New method.
7512         (Arm_output_section::fix_exidx_coverage): Ditto.
7513         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7514         Arm_relobj::section_needs_reloc_stub_scanning.
7515         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7516         first pass.
7517         (Target_arm::fix_exidx_coverage): New method.
7518         * object.h (Relobj::set_output_section): New method.
7519         (Sized_relobj::invalidate_section_offset): Remove method.
7520         (Sized_relobj::do_invalidate_section_offset): Remove method.
7521         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7522
7523 2010-01-25  Doug Kwan  <dougkwan@google.com>
7524
7525         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7526         Fix warning due to signed and unsigned comparison on a 32-bit host.
7527
7528 2010-01-22  Doug Kwan  <dougkwan@google.com>
7529
7530         * arm.cc (Target_arm::do_relax): Record an output section for section
7531         offset adjustment it contains any stub table that has changed.
7532         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7533         offsets in an output section if necessary.
7534         * output.cc (Output_section::Output_section): Initialize
7535         section_offsets_need_adjustments_.
7536         (Output_section::add_input_section_for_script): Renamed to
7537         Output_section::add_simple_input_section.
7538         (Output_section::save_states): Add a comment.
7539         (Output_section::discard_states): New method defintion.
7540         (Output_section::adjust_section_offsets): Same.
7541         * output.h (Output_section::add_input_section_for_script): Renamed to
7542         Output_section::add_simple_input_section.
7543         (Output_section::discard_states): New method declaration.
7544         (Output_section::adjust_section_offsets): Same.
7545         (Output_section::section_offsets_need_adjustment,
7546         Output_section::set_section_offsets_need_adjustment): New method
7547         definitions.
7548         (Output_section::section_offsets_need_adjustment_): New data member.
7549         * script-sections.cc
7550         (Output_section_element_input::set_section_address): Adjust code for
7551         renaming of Output_section::add_input_section_for_script.
7552         (Orphan_output_section::set_section_address): Same.
7553
7554 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7555
7556         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7557         Fix_v4bx enum values .
7558         * gold/options.h (General_options): New option definitions.
7559         (General_options::fix_v4bx): New method.
7560         (General_options::Fix_v4bx): New enum.
7561         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7562         (General_options::parse_fix_v4bx_interworking): New method.
7563
7564 2010-01-22  Doug Kwan  <dougkwan@google.com>
7565
7566         * arm.cc (Arm_exidx_fixup): New class.
7567
7568 2010-01-21  Doug Kwan  <dougkwan@google.com>
7569
7570         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7571         classes.
7572         (Arm_exidx_section_offset_map): New type.
7573
7574 2010-01-21  Doug Kwan  <dougkwan@google.com>
7575
7576         * arm.cc (Arm_exidx_input_section): New class.
7577         (Arm_relobj::exidx_input_section_by_link,
7578         Arm_relobj::exidx_input_section_by_shndx,
7579         Arm_relobj::make_exidx_input_section): New methods.
7580         (read_arm_attributes_section): Remove.
7581         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7582         information about them.
7583         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7584         to here.
7585
7586 2010-01-20  Doug Kwan  <dougkwan@google.com>
7587
7588         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7589         Input_section_specifier to Section_id.
7590         (Target_arm::new_arm_input_section: Adjust code for change of key
7591         type.
7592         (Target_arm::find_arm_input_section): Ditto.
7593         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7594         (Section_id): Remove.
7595         (Garbage_collection::Section_id_hash): Remove.
7596         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7597         (Section_id): Remove.
7598         (Icf::Section_id_hash): Remove.
7599         * object.h (Section_id, Const_section_id, Section_id_hash,
7600         Const_section_id_hash): New type definitions.
7601         * output.cc (Output_section::add_relaxed_input_section): Change to
7602         use Const_section_id instead of Input_section_specifier as key type.
7603         (Output_section::add_merge_input_section): Ditto.
7604         (Output_section::build_relaxation_map): Change to use Section_id
7605         instead of Input_section_specifier as key type.
7606         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7607         Ditto.
7608         (Output_section::convert_input_sections_to_relaxed_sections): Change
7609         to use Const_section_id instead of Input_section_specifier as key type.
7610         (Output_section::find_merge_section): Ditto.
7611         (Output_section::find_relaxed_input_section): Ditto.
7612         * output.h (Input_section_specifier): Remove class.
7613         (Output_section::Output_section_data_by_input_section_map): Change
7614         key type to Const_section_id.
7615         (Output_section::Output_relaxed_input_section_by_input_section_map):
7616         Ditto.
7617         (Output_section::Relaxation_map): Change key type to Section_id.
7618
7619 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7620
7621         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7622         (class Arm_v4bx_stub): New class.
7623         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7624         (Stub_factory::make_arm_v4bx_stub): New method.
7625         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7626         (Stub_table::empty): Handle v4bx stubs.
7627         (Stub_table::add_arm_v4bx_stub): New method.
7628         (Stub_table::find_arm_v4bx_stub): New method.
7629         (Arm_relocate_functions::v4bx): New method.
7630         (Target_arm::fix_v4bx): New method.
7631         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7632         (Stub_table::relocate_stubs): Likewise.
7633         (Stub_table::do_write): Likewise.
7634         (Stub_table::update_data_size_and_addralign): Likewise.
7635         (Stub_table::finalize_stubs):  Likewise.
7636         (Target_arm::Scan::local): Likewise.
7637         (Target_arm::Scan::global): Likewise.
7638         (Target_arm::do_finalize_sections): Likewise.
7639         (Target_arm::Relocate::relocate): Likewise.
7640         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7641         Likewise.
7642         (Target_arm::scan_reloc_for_stub): Likewise.
7643         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7644
7645 2010-01-19  Ian Lance Taylor  <iant@google.com>
7646
7647         * output.cc (Output_section_headers::do_sized_write): Write large
7648         segment count to sh_info field.
7649         (Output_file_header::do_sized_write): For large segment count,
7650         write PN_XNUM to e_phnum field.
7651
7652 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7653
7654         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7655         (Arm_relocate_functions::thm_jump8): New function.
7656         (Arm_relocate_functions::thm_jump11): New function.
7657         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7658         R_ARM_THM_JUMP11.
7659         (Target_arm::Scan::global): Likewise.
7660         (Target_arm::Relocate::relocate): Likewise.
7661         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7662         Likewise.
7663
7664 2010-01-14  Doug Kwan  <dougkwan@google.com>
7665
7666         * arm.cc (map, utility): Include headers.
7667         (Target_arm::apply_cortex_a8_workaround): New method.
7668         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7669         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7670         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7671         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7672         the --[no-]fix-cortex-a8 command line options.
7673         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7674         (Target_arm::relocate_stub): Use addend in instruction template.
7675         * options.h (DEFINE_bool): Set the user-set flag.
7676         (General_options): Add --[no-]-fix-cortex options.
7677         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7678         : Update fast look-up map after conversion.
7679
7680 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7681
7682         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7683         in the first pass of do_layout.
7684
7685 2010-01-13  Doug Kwan  <dougkwan@google.com>
7686
7687         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7688         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7689         apparent compiler problem of not folding static constant integral
7690         data members of elfcpp::Elf_sizes<32>.
7691
7692 2010-01-13  Doug Kwan  <dougkwan@google.com>
7693
7694         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7695         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7696         Arm_relobj::scan_section_for_cortex_a8_erratum,
7697         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7698         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7699         sections to scan for relocation stubs into a new method
7700         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7701         relocation and Cortex-A8 stub scanning.
7702         (Target_arm::do_relax): Force stubs to be after stubbed sections
7703         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7704         the beginning of a new relaxation pass.  Update a comment.
7705         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7706
7707 2010-01-12  Ian Lance Taylor  <iant@google.com>
7708
7709         * target-reloc.h (visibility_error): New inline function.
7710         (relocate_section): Call visibility_error.
7711         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7712         (MOSTLYCLEANFILES): Likewise.
7713         (protected_4_pic.o, protected_3.err): New targets.
7714         * testsuite/protected_4.cc: New file.
7715
7716 2010-01-12  Doug Kwan  <dougkwan@google.com>
7717
7718         * arm.cc (Cortex_a8_reloc): New class.
7719         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7720         and cortex_a8_relocs_info_.
7721         (Target_arm::fix_cortex_a8): New method definition.
7722         (Target_arm::Cortex_a8_relocs_info): New type.
7723         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7724         New data member declarations.
7725         (Target_arm::scan_reloc_for_stub): Record information about
7726         relocations for THUMB branches that might be exempted from the
7727         Cortex-A8 workaround.
7728         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7729         at the beginning of a relaxation pass.
7730
7731 2010-01-12  Doug Kwan  <dougkwan@google.com>
7732
7733         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7734         (Arm_relobj::Mapping_symbol_position,
7735          Arm_reloj::Mapping_symbol_position_less,
7736          Arm_relobj::Mapping_symbols_info): New types.
7737         (Target_arm::is_mapping_symbol_name): New method definition.
7738         (Arm_relobj::do_count_local_symbols): Save information about mapping
7739         symbols.
7740
7741 2010-01-11  Doug Kwan  <dougkwan@google.com>
7742
7743         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7744         Arm_relocate_functions::thumb32_branch_upper,
7745         Arm_relocate_functions::thumb32_branch_lower,
7746         Arm_relocate_functions::thumb32_cond_branch_offset,
7747         Arm_relocate_functions::thumb32_cond_branch_upper,
7748         Arm_relocate_functions::thumb32_cond_branch_lower,
7749         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7750         branch offset encoding.
7751         (Arm_relocate_functions::thumb_branch_common): Use new branch
7752         offset encoding methods to avoid code duplication.
7753         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7754         (Stub_addend_reader::operator()): Use new branch encoding method
7755         to avoid code duplication.
7756
7757 2010-01-11  Doug Kwan  <dougkwan@google.com>
7758
7759         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7760         (Target_arm::do_finalize_sections): Define special EXIDX section
7761         symbols only if referenced.
7762         * gc.h (Garbage_collection::add_reference): New method.
7763         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7764         code duplication.
7765
7766 2010-01-11  Ian Lance Taylor  <iant@google.com>
7767
7768         * script.cc (Version_script_info::build_expression_list_lookup):
7769         Change complaing about duplicate wildcard match from error to
7770         warning.
7771
7772         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7773         of 2009-12-30.
7774         (Version_script_info::Version_script_info): Initialize globs_,
7775         default_version_, default_is_global_, and exact_.  Don't
7776         initialize globals_ or locals_.
7777         (Version_script_info::build_lookup_tables): Build local symbols
7778         first.
7779         (Version_script_info::unquote): New function.
7780         (Version_script_info::add_exact_match): New function.
7781         (Version_script_info::build_expression_list_lookup): Remove lookup
7782         parameter.  Add is_global parameter.  Change all callers.  Handle
7783         wildcard pattern specially.  Unquote pattern.  Call
7784         add_exact_match.
7785         (Version_script_info::get_name_to_match): New function.
7786         (Version_script_info::get_symbol_version): New function.
7787         (Version_script_info::get_symbol_version_helper): Remove.
7788         (Version_script_info::check_unmatched_names): Call unquote.
7789         * script.h (class Version_script_info): Change get_symbol_version
7790         to be non-inline and add is_global parameter; change all callers.
7791         Rewrite symbol_is_local.  Update declarations.  Define struct
7792         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7793         Remove globals_ and locals_ members.  Add exact_, globs_,
7794         default_version_, is_global_.
7795         (Version_script_info::Glob): Remove pattern, add expression and
7796         is_global.  Update constructor.  Change all callers.
7797         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7798         default version.
7799         (Versions::symbol_section_contents): If a symbol is undefined, or
7800         defined in a dynamic object, set the version index to
7801         VER_NDX_LOCAL.
7802         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7803         symbol_is_local.
7804         (Symbol_table::add_from_pluginobj): Likewise.
7805         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7806
7807 2010-01-11  Doug Kwan  <dougkwan@google.com>
7808
7809         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7810         (incremental_dump_LDADD): Add linking option for libintl.
7811         * Makefile.in: Regenerate.
7812
7813 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7814
7815         PR gold/11144
7816         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7817         instead of -Ds.
7818         * testsuite/Makefile.in: Regenerated.
7819
7820 2010-01-10  Doug Kwan  <dougkwan@google.com>
7821
7822         * options.h (DEFINE_var): Use parentheses around argument varname__
7823         in macro body to avoid any unintended subsequent substitutions.
7824
7825 2010-01-10  Ian Lance Taylor  <iant@google.com>
7826
7827         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7828         candidates before doing symbol resolution.
7829
7830         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7831         ODR candidates if only one is weak.
7832
7833 2010-01-08  Ian Lance Taylor  <iant@google.com>
7834
7835         * script.cc (Version_script_info::build_expression_list_lookup):
7836         Don't warn about ambiguous version, just record the ambiguity.
7837         (Version_script_info::get_symbol_version_helper): Give error if
7838         version is ambiguous.
7839
7840 2010-01-08  Doug Kwan  <dougkwan@google.com>
7841
7842         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7843         prev_data_size_ and prev_addralign_.  Remove initializer for
7844         deleted data member has_been_changed_.
7845         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7846         to determine if the table is empty.
7847         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7848         Remove.
7849         (Stub_table::add_reloc_stub): Define method in class definition
7850         instead of just declaring it there.
7851         (Stub_table::add_cortex_a8_stub): New method definition.
7852         (Stub_table::update_data_size_and_addralign): Ditto.
7853         (Stub_table::finalize_stubs): Ditto.
7854         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7855         (Stub_table::do_addralign_): Return address alignment in the
7856         (Stub_table::do_reset_address_and_file_offset): Define method in
7857         class definition instead of declaring it there.  Set current data
7858         size to be the data size of the previous pass.
7859         (Stub_table::set_final_data_size): Use current data size as the
7860         final data size.
7861         (Stub_table::relocate_stub): Change parameter type of stub from
7862         Reloc_stub pointer to Stub pointer.
7863         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7864         (Stub_table::Cortex_a8_stub_list): New typedef.
7865         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7866          Stub_table::prev_addralign_): New data member.
7867         (Arm_relobj::Arm_relobj): Initialize data member
7868         section_has_cortex_a8_workaround_.
7869         (Arm_relobj::section_has_cortex_a8_workaround,
7870          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7871          definitions.
7872         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7873         declarations.
7874         (Target_arm::relocate_stub): Change parameter type of stub from
7875         Reloc_stub pointer to Stub pointer.
7876         (Insn_template::size, Insn_template::alignment): Handle
7877         THUMB16_SPECIAL_TYPE.
7878         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7879          Stub_table::update_data_size_and_addralign,
7880          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7881         definitions.
7882         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7883         (Stub_table::do_write): Ditto.
7884         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7885
7886 2010-01-08  Ian Lance Taylor  <iant@google.com>
7887
7888         PR 11108
7889         * symtab.h (class Symbol): Remove fields is_target_special_ and
7890         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7891         (Symbol::is_defined_in_discarded_section): New function.
7892         (Symbol::set_is_defined_in_discarded_section): New function.
7893         (Symbol::has_plt_offset): Rewrite.
7894         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7895         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7896         Don't initialize is_target_special_ or has_plt_offset_.
7897         Initialize is_defined_in_discarded_section_.
7898         (Symbol_table::add_from_relobj): If appropriate, set
7899         is_defined_in_discarded_section.
7900         * resolve.cc (Symbol::override_base_with_special): Don't test
7901         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7902         * target-reloc.h (relocate_section): Do special handling for
7903         symbols defined in discarded sections for global symbols as well
7904         as local symbols.
7905
7906 2010-01-08  Ian Lance Taylor  <iant@google.com>
7907
7908         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7909         the SHT_SYMTAB case.
7910
7911 2010-01-08  Ian Lance Taylor  <iant@google.com>
7912
7913         * object.cc (Sized_relobj::do_layout): Don't get confused if
7914         layout_eh_frame returns NULL.
7915
7916 2010-01-08  Ian Lance Taylor  <iant@google.com>
7917
7918         PR 11084
7919         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7920         dynamic symbol table, use the normal symbol table.
7921         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7922         symbol table.
7923
7924 2010-01-08  Ian Lance Taylor  <iant@google.com>
7925
7926         PR 11072
7927         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7928         sections.
7929
7930 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7931
7932         * version.cc (print_version): Change to "Copyright 2010".
7933
7934 2010-01-08  Ian Lance Taylor  <iant@google.com>
7935
7936         PR 10287
7937         PR 11063
7938         * i386.cc (class Target_i386): Change return type of plt_section
7939         to be non-const.
7940         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7941         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7942         tls_desc_rel_ field.
7943         (Output_data_plt_i386::rel_tls_desc): New function.
7944         (Target_i386::rel_tls_desc_section): New function.
7945         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7946         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7947         R_386_TLS_DESC reloc in rel_tls_desc_section.
7948         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7949         Define struct Tlsdesc_info.
7950         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7951         (Target_x86_64::do_reloc_symbol_index): New function.
7952         (Target_x86_64::add_tlsdesc_info): New function.
7953         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7954         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7955         tlsdesc_rel_ field.
7956         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7957         all callers.
7958         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7959         (Target_x86_64::rela_tlsdesc_section): New function.
7960         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7961         handling.
7962         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7963         (Target_x86_64::do_reloc_addend): New function.
7964         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7965         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7966         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7967         (Output_reloc::type): New function.
7968         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7969         (Output_reloc::is_target_specific): New function.
7970         (Output_reloc::target_arg): New function.
7971         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7972         absolute relocs and target specific relocs.
7973         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7974         add_target_specific.
7975         (class Output_data_reloc) [SHT_RELA]: Likewise.
7976         * output.cc (Output_reloc::Output_reloc): Add four new versions
7977         for absolute relocs and target specific relocs.
7978         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7979         (Output_reloc::get_symbol_index): Likewise.
7980         (Output_reloc::local_section_offset): Check that local_sym_index_
7981         is not TARGET_CODE or 0.
7982         (Output_reloc::symbol_value): Likewise.
7983         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7984         reloc.
7985         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7986         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7987         functions.
7988         * layout.cc (add_target_dynamic_tags): Use output section for
7989         DT_PLTRELSZ and DT_JMPREL.
7990
7991 2010-01-07  Ian Lance Taylor  <iant@google.com>
7992
7993         PR 11061
7994         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7995         function.
7996         (class Output_data_reloc_generic): Define.
7997         (class Output_data_reloc_base): Change base class to
7998         Output_data_reloc_generic.  Change add() method to call
7999         bump_relative_reloc_count for a relative reloc.  Remove
8000         sort_relocs_ field.
8001         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8002         to sort_relocs().
8003         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8004         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8005         appropriate.
8006         * layout.h (class Layout): Update declaration.
8007
8008 2010-01-07  Ian Lance Taylor  <iant@google.com>
8009
8010         * output.h (class Output_data): Add const version of
8011         output_section and do_output_section.
8012         (class Output_section_data): Add const version of
8013         do_output_section.
8014         (class Output_section): Likewise.
8015         * layout.cc (Layout::add_target_dynamic_tags): New function.
8016         * layout.h (class Layout): Update declarations.
8017         * arm.cc (Target_arm::do_finalize_sections): Use
8018         add_target_dynamic_tags.
8019         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8020         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8021         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8022         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8023
8024 2010-01-07  Ian Lance Taylor  <iant@google.com>
8025
8026         PR 11042
8027         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8028         object as needed.
8029
8030 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8031             Ian Lance Taylor  <iant@google.com>
8032
8033         PR 11019
8034         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8035         Xindex::read_symtab_xindex.
8036
8037 2010-01-07  Doug Kwan  <dougkwan@google.com>
8038
8039         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8040         (Insn_template::thumb16_bcond_insn): New method declaration.
8041         (Insn_template): Fix spelling.
8042         (Stub::thumb16_special): New method declaration.
8043         (Stub::do_write): Define virtual method which was previously pure
8044         virtual.
8045         (Stub::do_thumb16_special): New method declaration.
8046         (Stub::do_fixed_endian_write): New template member.
8047         (Reloc_stub::do_write): Remove.
8048         (Reloc_stub::do_fixed_endian_write): Remove.
8049         (Cortex_a8_stub): New class definition.
8050         (Stub_factory::make_cortex_a8_stub): New method definition.
8051         (Stub_factory::Stub_factory): Add missing static storage class
8052         qualifier for elf32_arm_stub_a8_veneer_blx.
8053
8054 2010-01-07  Ian Lance Taylor  <iant@google.com>
8055
8056         PR 10980
8057         * options.h (class General_options): Add --warn-unresolved-symbols
8058         and --error-unresolved-symbols.
8059         * errors.cc (Errors::undefined_symbol): Implement
8060         --warn-unresolved-symbols.
8061
8062         * options.h (class General_options): Add -z text and -z textoff.
8063         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8064
8065 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8066
8067         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8068         (Garbage_collection::cident_sections): New function.
8069         (Garbage_collection::add_cident_section): New function.
8070         (Garbage_collection::cident_sections_): New member.
8071         (gc_process_relocs): Add references to sections whose names are C
8072         identifiers.
8073         * gold.h (cident_section_start_prefix): New constant.
8074         (cident_section_stop_prefix): New constant.
8075         (is_cident): New function.
8076         * layout.cc (Layout::define_section_symbols): Replace string constants
8077         with the newly defined constants.
8078         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8079         C identifiers.
8080         * testsuite/Makefile.am: Add gc_orphan_section_test.
8081         * testsuite/Makefile.in: Regenerate.
8082         * testsuite/gc_orphan_section_test.cc: New file.
8083         * testsuite/gc_orphan_section_test.sh: New file.
8084
8085 2010-01-06  Ian Lance Taylor  <iant@google.com>
8086
8087         PR 10980
8088         * options.h (class General_options): Add --warn-shared-textrel.
8089         * layout.cc (Layout::finish_dynamic_section): Implement
8090         --warn-shared-textrel.
8091
8092         PR 10980
8093         * options.h (class General_options): Add --warn-multiple-gp.
8094
8095 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8096
8097         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8098         $(THREADSLIB) and $(LIBDL).
8099         * Makefile.in: Rebuild.
8100
8101 2010-01-06  Ian Lance Taylor  <iant@google.com>
8102
8103         PR 10980
8104         * options.cc (General_options::parse_section_start): New function.
8105         (General_options::section_start): New function.
8106         (General_options::General_options): Initialize all members.
8107         * options.h: Include <map>
8108         (class General_options): Add --section-start.  Add section_starts_
8109         member.
8110         * layout.cc (Layout::attach_allocated_section_to_segment): If
8111         --section-start was used, set the address of the segment.  Remove
8112         local sort_sections.
8113         (Layout::relaxation_loop_body): If the address of the load segment
8114         has been set by --section-start, don't use it.
8115         * output.h (Output_segment::update_flags_for_output_section): New
8116         function.
8117         * output.cc (Output_segment::add_output_section): Call
8118         update_flags_for_output_section.
8119
8120 2010-01-05  Ian Lance Taylor  <iant@google.com>
8121
8122         PR 10980
8123         * options.h (class General_options): Add --undefined-version.
8124         * script.cc (struct Version_expression): Add was_matched_by_symbol
8125         field.
8126         (Version_script_info::matched_symbol): New function.
8127         (Version_script_info::get_symbol_version_helper): Call
8128         matched_symbol.
8129         (Version_script_info::check_unmatched_names): New function.
8130         * script.h (class Version_script_info): Update declarations.
8131         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8132
8133         * options.h (class General_options): Use DEFINE_bool_alias for
8134         allow_multiple_definition.
8135         * resolve.cc (Symbol_table::should_override): Don't test
8136         allow_multiple_definition.
8137
8138         PR 10980
8139         * options.h (class General_options): Add --cref.
8140         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8141         until after printing cref table.
8142         * cref.cc: Include "symtab.h".
8143         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8144         (Cref_table_compare::operator()): New function.
8145         (Cref_inputs::gather_cref): New function.
8146         (filecol): New static const.
8147         (Cref_inputs::print_cref): New function.
8148         (Cref::print_cref): New function.
8149         * cref.h: Include <cstdio>.
8150         (class Cref): Update declarations.
8151         * mapfile.h (Mapfile::file): New function.
8152         * object.h (class Object): Define Symbols.  Declare virtual
8153         do_get_global_symbols.
8154         (Object::get_global_symbols): New function.
8155         * object.cc (Input_objects::add_object): Pass object to cref_ if
8156         --cref.
8157         (Input_objects::archive_start): Likewise.
8158         (Input_objects::archive_stop): Likewise.
8159         (Input_objects::print_cref): New function.
8160         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8161         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8162         --cref.
8163         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8164         function.
8165         * plugin.h (class Sized_pluginobj): Update declarations.
8166
8167 2010-01-05  Ian Lance Taylor  <iant@google.com>
8168
8169         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8170         to is_default_version.  Rename insdef to insdefault.
8171         (Symbol_table::add_from_relobj): Rename def to is_default_version
8172         and local to is_forced_local.
8173         (Symbol_table::add_from_pluginobj): Likewise.
8174         (Symbol_table::add_from_dynobj): Likewise.
8175         (Symbol_table::define_special_symbol): Rename insdef to
8176         insdefault.
8177
8178 2010-01-04  Ian Lance Taylor  <iant@google.com>
8179
8180         PR 10980
8181         * options.h (class General_options): Add
8182         --allow-multiple-definition and -z muldefs.
8183         * resolve.cc (Symbol_table::should_override): Don't warn about a
8184         multiple symbol definition if --allow-multiple-definition or -z
8185         muldefs.
8186
8187         PR 10980
8188         * options.h (class General_options): Add --add-needed and
8189         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8190         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8191         error if --copy-dt-needed-entries aka --add-needed is used and
8192         would cause a change in behaviour.
8193
8194         PR 10980
8195         * options.h (class General_options): Add -G as a short version of
8196         --shared.  Add no-op options -assert, -g, and -i.
8197
8198 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8199
8200         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8201         check for .text or .gnu.linkonce.t sections.
8202         * icf.cc (Icf::find_identical_sections): Ditto.
8203         Change the detection for mangled function name within the section
8204         name.
8205         * icf.h (is_section_foldable_candidate): New function.
8206
8207 2009-12-30  Ian Lance Taylor  <iant@google.com>
8208
8209         PR 10980
8210         * options.h (class General_options): Permit two dashes with
8211         --retain-symbols-file.
8212
8213 2009-12-30  Ian Lance Taylor  <iant@google.com>
8214
8215         PR 10979
8216         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8217         don't put the file header and segment headers in the text
8218         segment.
8219
8220         PR 10979
8221         * common.cc (Sort_commons::operator()): Stabilize sort when both
8222         entries are NULL.
8223         (Symbol_table::do_allocate_commons_list): When allocating common
8224         symbols, skip a symbol which is no longer common.
8225         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8226         an object before checking its type.
8227         * testsuite/common_test_2.c: New file.
8228         * testsuite/common_test_3.c: New file.
8229         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8230         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8231         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8232         (common_test_2_pic.o, common_test_2.so): New targets.
8233         (common_test_3_pic.o, common_test_3.so): New targets.
8234         * testsuite/Makefile.in: Rebuild.
8235
8236         PR 10979
8237         * script.cc (read_input_script): If we see a new SECTIONS clause,
8238         and we have added an input section, give an error.
8239         * layout.h (class Layout): Add have_added_input_section function.
8240         Add have_added_input_section_ field.
8241         * layout.cc (Layout::Layout): Initialize
8242         have_added_input_section_.
8243         (Layout::layout): Set have_added_input_section_.
8244         (Layout::layout_eh_frame): Likewise.
8245
8246 2009-12-30  Ian Lance Taylor  <iant@google.com>
8247
8248         PR 10931
8249         * options.h (class General_options): Add --sort-common option.
8250         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8251         * common.cc (Sort_common): Add sort_order parameter to
8252         constructor.  Add sort_order_ field.
8253         (Sort_commons::operator): Check sort_order_.
8254         (Symbol_table::allocate_commons): Determine the sort order.
8255         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8256         Change all callers.
8257         (Symbol_table::do_allocate_commons_list): Likewise.
8258
8259 2009-12-30  Ian Lance Taylor  <iant@google.com>
8260
8261         PR 10916
8262         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8263         symbols from this object, don't change the visibility of an
8264         undefined symbol.
8265         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8266
8267 2009-12-30  Ian Lance Taylor  <iant@google.com>
8268
8269         PR 10861
8270         * script.h (class Version_script_info): Define Language enum.
8271         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8272         new fields globals_, locals_, and is_finalized_.
8273         * script.cc: Various formatting fixes.
8274         (class Parser_closure): Change language_stack_ from a vector of
8275         std::string to one of Version_script_info::Language.  Adjust all
8276         uses accordingly.
8277         (class Lazy_demangler): Remove.
8278         (struct Version_expression): Change language from std::string to
8279         Version_script_info::Language.
8280         (Version_script_info::Version_script_info): New function.
8281         (Version_script_info::~Version_script_info): Don't call clear.
8282         (Version_script_info::finalize): New function.
8283         (Version_script_info::build_lookup_tables): New function.
8284         (Version_script_info::build_expression_list_lookup): New
8285         function.
8286         (Version_script_info::get_symbol_version_helper): Rewrite to use
8287         lookup tables.
8288         (Version_script_info::print_expression_list): Adjust to use
8289         Version_script_info::Language.
8290         (script_push_lex_into_version_mode): Check that the version script
8291         has not been finalized.
8292         (version_script_push_lang): Change language string to
8293         Version_script_info::Language.
8294         * options.cc (Command_line::version_script): New function.
8295         * options.h (class General_options): Add finalize_dynamic_list
8296         function.  Change version_script from declaration to definition.
8297         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8298         * testsuite/version_script.map: Remove duplicate def of foo.
8299         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8300         version_script.map.
8301         * testsuite/Makefile.in: Rebuild.
8302
8303 2009-12-30  Ian Lance Taylor  <iant@google.com>
8304
8305         PR 10843
8306         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8307         if the input symbol index is 0, make the output symbol index 0.
8308
8309 2009-12-30  Ian Lance Taylor  <iant@google.com>
8310
8311         PR 10670
8312         * options.h (class General_options): Add -x/--discard-all.
8313         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8314         --discard-all.  If the local symbol needs a dynamic entry, check
8315         that before handling --discard-locals.
8316
8317 2009-12-30  Ian Lance Taylor  <iant@google.com>
8318
8319         PR 10450
8320         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8321         flags to PF_R.
8322         (Output_segment::add_output_section): Don't change the flags if
8323         the type is PT_TLS.
8324
8325         PR 10450
8326         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8327         GNU hash table if they need a dynamic value.  Otherwise, don't add
8328         them if they are defined in a dynamic object or are forced local.
8329
8330 2009-12-29  Ian Lance Taylor  <iant@google.com>
8331
8332         PR 10450
8333         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8334         .gnu.hash table for a 32-bit target.
8335
8336         PR 10450
8337         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8338         regular and a dynamic object only needs a dynamic symbol table
8339         entry if it is externally visible.
8340
8341         PR 10450
8342         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8343         constructor.  Add global_offset_table_ field.
8344         (Target_i386::got_section): Set global_offset_table_.
8345         (Target_i386::do_finalize_sections): Set global_offset_table_
8346         size.
8347         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8348         in constructor.  Add global_offset_table_ field.
8349         (Target_x86_64::got_section): Set global_offset_table_.
8350         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8351         size.
8352
8353         * layout.cc (Layout::Layout): Initialize increase_relro_.
8354         (Layout::get_output_section): Add is_relro, is_last_relro, and
8355         is_first_non_relro parameters.  Change all callers.
8356         (Layout::choose_output_section): Likewise.
8357         (Layout::add_output_section_data): Likewise.
8358         (Layout::make_output_section): Likewise.
8359         (Layout::set_segment_offsets): Clear increase_relro when using a
8360         linker script.
8361         * layout.h (class Layout): Add increase_relro method.  Add
8362         increase_relro_ field.  Update declarations.
8363         * output.cc (Output_section::Output_section): Initialize
8364         is_last_relro_ and is_first_non_relro_.
8365         (Output_segment::add_output_section): Group relro sections is
8366         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8367         (Output_segment::maximum_alignment): Remove relro handling.
8368         (Output_segment::set_section_addresses): Add increase_relro
8369         parameter.  Change all callers.  Add initial alignment to align
8370         relro sections on separate page.  Remove old relro handling.
8371         (Output_segment::set_section_list_addresses): Remove in_relro
8372         parameter.  Change all callers.
8373         (Output_segment::set_offset): Add increase parameter.  Change all
8374         callers.  Remove old relro handling.
8375         * output.h (class Output_section): Add new methods: is_last_relro,
8376         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8377         Add is_last_relro_ and is_first_non_relro_ fields.
8378         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8379         Create separate .got.plt section.  Call increase_relro.
8380         * x86_64.cc (Target_x86_64::got_section): Likewise.
8381         * testsuite/relro_script_test.t: Add .got.plt.
8382
8383         PR 10450
8384         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8385         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8386         (Layout::finalize): Call set_dynamic_symbol_size.
8387         (Layout::set_dynamic_symbol_size): New function.
8388         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8389         set_dynamic_symbol_size.
8390
8391         PR 10450
8392         * output.h (class Output_section): Add is_entsize_zero_ field.
8393         * output.cc (Output_section::Output_section): Initialize
8394         is_entsize_zero_.
8395         (Output_section::set_entsize): If two different entsizes are
8396         requested, force it to zero.
8397         (Output_section::add_input_section): Set flags for .debug_str
8398         before updating section flags.  Set entsize.
8399         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8400         and SHF_STRING if all input sections have those flags.
8401
8402 2009-12-29   Rafael Espindola  <espindola@google.com>
8403
8404         * main.cc (main): Fix the sys time reporting.
8405         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8406         reporting.
8407
8408 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8409
8410         * options.cc (General_options::parse_version): Allow -v to exit
8411         without an error if there is nothing to link.
8412
8413 2009-12-29  Ian Lance Taylor  <iant@google.com>
8414
8415         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8416         using a version of gcc before 4.1.
8417         * configure: Rebuild.
8418
8419 2009-12-28  Chris Demetriou  <cgd@google.com>
8420
8421         * attributes.cc (Output_attributes_section_data::do_write): Use
8422         std::vector::front rather than std::vector::data.
8423
8424 2009-12-28  Ian Lance Taylor  <iant@google.com>
8425
8426         * symtab.h (class Symbol_table): Add enum Defined.
8427         * resolve.cc (Symbol_table::should_override): Add defined
8428         parameter.  Change all callers.  Test whether object is NULL
8429         before calling a method on it.
8430         (Symbol_table::report_resolve_problem): Add defined parameter.
8431         Change all callers.
8432         (Symbol_table::should_override_with_special): Likewise.
8433         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8434         parameter.  Change all callers.
8435         (Symbol_table::do_define_in_output_data): Likewise.
8436         (Symbol_table::define_in_output_segment): Likewise.
8437         (Symbol_table::do_define_in_output_segment): Likewise.
8438         (Symbol_table::define_as_constant): Likewise.
8439         (Symbol_table::do_define_as_constant): Likewise.
8440         * script.h (class Symbol_assignment): Add is_defsym parameter to
8441         constructor; change all callers.
8442         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8443         parameter.  Change all callers.  Add is_defsym_ field.
8444         (class Parser_closure): Add parsing_defsym parameter to
8445         constructor; change all callers.  Add parsing_defsym accessor
8446         function.  Add parsing_defsym_ field.
8447
8448 2009-12-28  Ian Lance Taylor  <iant@google.com>
8449
8450         * gold.cc (queue_middle_tasks): Fix formatting.
8451         * object.cc (Relobj::is_section_name_included): Likewise.
8452
8453 2009-12-23  Ian Lance Taylor  <iant@google.com>
8454
8455         * i386.cc (Target_i386::do_calls_non_split): Recognize
8456         -fsplit-stack prologue for a function with a static chain.
8457         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8458         -fsplit-stack prologue when using %r11.
8459
8460 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8461
8462         * options.cc (General_options::parse_version): Make -v continue and do
8463         the link like GNU ld does.
8464
8465 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8466
8467         * Makefile.am (CCFILES): Add timer.cc.
8468         (HFILES): Add timer.h.
8469         * configure.ac: Check for sysconf and times.
8470         * main.cc: include timer.h.
8471         (main): Use Timer instead of get_run_time.
8472         * timer.cc: New.
8473         * timer.h: New.
8474         * workqueue.cc: include timer.h.
8475         (Workqueue::find_and_run_task):
8476         Report user, sys and wall time.
8477         * Makefile.in: Regenerate.
8478         * config.in: Regenerate.
8479         * configure: Regenerate.
8480
8481 2009-12-16  Doug Kwan  <dougkwan@google.com>
8482
8483         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8484         sections.
8485         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8486         relaxed input sections.
8487         * output.cc (Output_section::find_relaxed_input_section): Change
8488         return type to Output_relaxed_input_section pointer.  Adjust code
8489         for new type of relaxed_input_section_map_.
8490         * output.h (Output_section::find_relaxed_input_section): Change
8491         return type to Output_relaxed_input_section pointer.
8492         (Output_section::Output_relaxed_input_section_by_input_section_map):
8493         New type.
8494         (Output_section::relaxed_input_section_map_): Change type to
8495         Output_section::Output_relaxed_input_section_by_input_section_map.
8496         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8497         input section.
8498
8499 2009-12-15  Ian Lance Taylor  <iant@google.com>
8500
8501         * layout.cc (Layout::create_shstrtab): Only write out after input
8502         sections if we are compressing debug sections.
8503
8504 2009-12-15  Ian Lance Taylor  <iant@google.com>
8505
8506         * archive.cc (Archive::add_symbols): Only look up a symbol without
8507         a version if there is, in fact, a version.
8508
8509 2009-12-14  Ian Lance Taylor  <iant@google.com>
8510
8511         Revert -Wshadow changes, all changes from:
8512         2009-12-11  Doug Kwan  <dougkwan@google.com>
8513         2009-12-11  Nick Clifton  <nickc@redhat.com>
8514         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8515
8516 2009-12-11  Doug Kwan  <dougkwan@google.com>
8517
8518         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8519         due to -Wshadow.
8520         * attributes.cc (Object_attribute::size): Ditto.
8521         (Attributes_section_data::size): Ditto.
8522         (Attributes_section_data::Attributes_section_data): Ditto.
8523         (Output_attributes_section_data::do_write): Ditto.
8524         * attributes.h (Object_attribute::set_type): Ditto.
8525         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8526
8527 2009-12-11  Nick Clifton  <nickc@redhat.com>
8528
8529         * archive.cc: Fix shadowed variable warnings.
8530         * arm.cc: Likewise.
8531         * compressed_output.cc: Likewise.
8532         * compressed_output.h: Likewise.
8533         * configure: Likewise.
8534         * dwarf_reader.cc: Likewise.
8535         * dynobj.cc: Likewise.
8536         * dynobj.h: Likewise.
8537         * ehframe.cc: Likewise.
8538         * ehframe.h: Likewise.
8539         * errors.cc: Likewise.
8540         * expression.cc: Likewise.
8541         * fileread.cc: Likewise.
8542         * fileread.h: Likewise.
8543         * freebsd.h: Likewise.
8544         * i386.cc: Likewise.
8545         * icf.cc: Likewise.
8546         * incremental.h: Likewise.
8547         * layout.cc: Likewise.
8548         * layout.h: Likewise.
8549         * mapfile.cc: Likewise.
8550         * merge.cc: Likewise.
8551         * merge.h: Likewise.
8552         * object.cc: Likewise.
8553         * object.h: Likewise.
8554         * options.h: Likewise.
8555         * output.cc: Likewise.
8556         * output.h: Likewise.
8557         * parameters.cc: Likewise.
8558         * plugin.cc: Likewise.
8559         * powerpc.cc: Likewise.
8560         * reduced_debug_output.cc: Likewise.
8561         * reduced_debug_output.h: Likewise.
8562         * reloc.cc: Likewise.
8563         * reloc.h: Likewise.
8564         * resolve.cc: Likewise.
8565         * script-sections.cc: Likewise.
8566         * script.cc: Likewise.
8567         * script.h: Likewise.
8568         * sparc.cc: Likewise.
8569         * symtab.cc: Likewise.
8570         * symtab.h: Likewise.
8571         * target-select.cc: Likewise.
8572         * target-select.h: Likewise.
8573         * token.h: Likewise.
8574         * workqueue.cc: Likewise.
8575         * workqueue.h: Likewise.
8576         * x86_64.cc: Likewise.
8577
8578 2009-12-10  Doug Kwan  <dougkwan@google.com>
8579
8580         * arm.cc (attributes.h): New include.
8581         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8582         (Arm_relobj::~Arm_relobj): Delete object pointed by
8583         attributes_section_data_.
8584         (Arm_relobj::attributes_section_data): New method definition.
8585         (Arm_relobj::attributes_section_data_): New data member declaration.
8586         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8587         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8588         attributes_section_data_.
8589         (Arm_dynobj::attributes_section_data): New method definition.
8590         (Arm_dynobj::attributes_section_data_): New data member declaration.
8591         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8592         initialization value of may_use_blx_ to false.
8593         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8594         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8595         object attributes to compute results instead of hard-coding.
8596         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8597         Target_arm::get_secondary_compatible_arch,
8598         Target_arm::set_secondary_compatible_arch
8599         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8600         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8601         New method declarations.
8602         (Target_arm::get_aeabi_object_attribute): New method definition.
8603         (Target_arm::attributes_section_data_): New data member declaration.
8604         (read_arm_attributes_section): New template definition.
8605         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8606         (Arm_dynobj::do_read_symbols): Ditto.
8607         (Target_arm::do_finalize_sections): Merge attributes sections from
8608         input.  Check for BLX use after attributes section merging.
8609         Fix __exidx_start and __exidx_end visibility.  Create an
8610         .ARM.attributes section if necessary.
8611         (Target_arm::get_secondary_compatible_arch,
8612         Target_arm::set_secondary_compatible_arch,
8613         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8614         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8615         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8616         New method definitions.
8617
8618 2009-12-09  Ian Lance Taylor  <iant@google.com>
8619
8620         * plugin.cc (Plugin::load): Don't cast from void* to a function
8621         pointer.
8622
8623 2009-12-09  Ian Lance Taylor  <iant@google.com>
8624
8625         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8626         information fields.
8627
8628 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8629
8630         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8631         Replace two_file_shared_1.so with two_file_shared_2.so.
8632         * testsuite/Makefile.in: Regenerated.
8633
8634 2009-12-08  Doug Kwan  <dougkwan@google.com>
8635
8636         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8637         (HFILES): Add attributes.h and int_encoding.h.
8638         * Makefile.in: Regenerate.
8639         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8640         function definitions to int_encoding.cc
8641         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8642         prototypes to int_encoding.h
8643         * reduced_debug_output.cc (int_encoding.h): New include.
8644         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8645         function definitions to int_encoding.cc
8646         (insert_into_vector, read_from_pointer): Move template definitions to
8647         int_encoding.h
8648         * attributes.cc: New file.
8649         * attributes.h: New file.
8650         * int_encoding.cc: New file.
8651         * int_encoding.h: New file.
8652
8653 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8654
8655         PR gold/11055
8656         * incremental-dump.cc (dump_incremental_inputs): New.
8657         (main): Use dump_incremental_inputs.
8658
8659 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8660
8661         PR gold/10893
8662         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8663         checking elfcpp::STT_FUNC.
8664         (Target_i386::Relocate::relocate): Likewise.
8665         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8666
8667         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8668         symbols from shared libraries into normal FUNC symbols.
8669
8670         * symtab.h (Symbol): Add is_func and use it.
8671
8672 2009-12-05  Doug Kwan  <dougkwan@google.com>
8673
8674         * arm.cc (Target_arm::arm_info): Initialize new fields
8675         attributes_section and attributes_vendor.
8676         * i386.cc (Target_i386::i386_info): Same.
8677         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8678         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8679         fields attributes_section and attributes_vendor.
8680         * sparc.cc (Target_sparc::sparc_info): Same.
8681         * target.h (Target::attributes_section, Target::attributes_vendor,
8682         Target::is_attributes_section, Target::attribute_arg_type,
8683         Target::attributes_order): New method definitions.
8684         (Target::Target_info::attributes_section,
8685         Target::Target_info::attributes_vendor): New fields.
8686         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8687         virtual method definitions.
8688         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8689         attributes_section and attributes_vendor.
8690         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8691
8692 2009-12-05  Doug Kwan  <dougkwan@google.com>
8693
8694         * arm.cc: Update comments about interworking and stub generation.
8695         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8696         considered as non-PIC.
8697         (Arm_relocate_functions::base_abs): Fix formatting.
8698         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8699         of function to use GOT entry address instead of offset.
8700         (Target_arm::Scan::global): Issue an error if a symbol would need a
8701         PLT does not get one because it is untyped.  Remove code to create
8702         dynamic symbols for relative branches.
8703         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8704         takes unsigned integer instead of boolean.
8705
8706 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8707
8708         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8709         (two_file_test_LDADD): Likewise.
8710         (common_test_1_LDADD): Likewise.
8711         (exception_test_LDADD) Likewise.
8712         (weak_test_LDADD): Likewise.
8713         (many_sections_test_LDADD): Likewise.
8714         (initpri1_LDADD): Likewise.
8715         (script_test_1_LDADD): Likewise.
8716         (script_test_2_LDADD): Likewise.
8717         (justsyms_LDADD): Likewise.
8718         (binary_test_LDADD): Likewise.
8719         (large_LDADD): Likewise.
8720         * testsuite/Makefile.in: Regenerated.
8721
8722 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8723
8724         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8725         (Symbol_table::override_with_special): Likewise.
8726         (Symbol_table::add_from_object): Likewise.
8727
8728 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8729
8730         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8731         Don't set the data_offset twice.
8732
8733 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8734
8735         * testsuite/Makefile.in: Regenerate.
8736
8737 2009-12-03  Doug Kwan  <dougkwan@google.com>
8738
8739         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8740         (Target_arm::do_finalize_sections): Add parameter for symbol table
8741         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8742         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8743         parameter for symbol table pointer.
8744         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8745         an additional parameter for a pointer to symbol table.
8746         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8747         parameter for a symbol table pointer.
8748         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8749         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8750         Ditto.
8751         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8752         parameter for a symbol table pointer.
8753
8754 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8755
8756         * incremental.cc (Incremental_inputs_header)
8757         (Incremental_inputs_header_write, Incremental_inputs_entry)
8758         (Incremental_inputs_entry_write): Move ...
8759         * incremental.h (Incremental_inputs_header)
8760         (Incremental_inputs_header_write, Incremental_inputs_entry)
8761         (Incremental_inputs_entry_write): here.
8762
8763 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8764
8765         * incremental.cc (make_sized_incremental_binary): Set the target.
8766         Error if it is incompatible.
8767         * output.h (Output_file): Add filename method.
8768
8769 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8770
8771         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8772         from the get_* methods.
8773
8774 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8775
8776         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8777         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8778         Write 0 for the data_offset of scripts.
8779
8780 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8781
8782         * testsuite/Makefile.am: Add the incremental_test.sh test.
8783         * testsuite/incremental_test.sh: New.
8784         * testsuite/incremental_test_1.c: New.
8785         * testsuite/incremental_test_2.c: New.
8786
8787 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8788
8789         * incremental-dump.cc (main): Fix typos.
8790
8791 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8792
8793         PR gold/11025
8794         * incremental-dump.cc (main): Use llu to print 64 bit values.
8795
8796 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8797             H.J. Lu  <hongjiu.lu@intel.com>
8798
8799         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8800         $(LIBDL).
8801         (incremental_dump_LDADD): Likewise.
8802         * Makefile.in: Regenerated.
8803
8804 2009-11-25  Doug Kwan  <dougkwan@google.com>
8805
8806         Revert:
8807
8808         2009-11-25  Doug Kwan  <dougkwan@google.com>
8809
8810                 * arm.cc (Target_arm::Target_arm): Move method definition
8811                 outside of class definition.  Add code to handle
8812                 --target1-rel, --target1-abs and --target2= options.
8813                 (Target_arm::get_reloc_reloc_type): Change method to be
8814                 non-static and const.
8815                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8816                 New data member declaration.
8817                 (Target_arm::Scan::local, Target_arm::Scan::global,
8818                 Target_arm::Relocate::relocate,
8819                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8820                 Adjust call to Target_arm::get_real_reloc_type.
8821                 (Target_arm::get_real_reloc_type): Use command line options
8822                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8823                 * options.h (--target1-rel, --target1-abs, --target2): New
8824                 ARM-only options.
8825
8826 2009-11-25  Doug Kwan  <dougkwan@google.com>
8827
8828         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8829         class definition.  Add code to handle --target1-rel, --target1-abs
8830         and --target2= options.
8831         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8832         and const.
8833         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8834         member declaration.
8835         (Target_arm::Scan::local, Target_arm::Scan::global,
8836         Target_arm::Relocate::relocate,
8837         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8838         call to Target_arm::get_real_reloc_type.
8839         (Target_arm::get_real_reloc_type): Use command line options to
8840         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8841         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8842         options.
8843
8844 2009-11-25  Doug Kwan  <dougkwan@google.com>
8845
8846         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8847         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8848         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8849         formatting.
8850         (Arm_relocate_functions::thm_call): Replace body with a call to
8851         Arm_relocate_functions::thumb_branch_common.
8852         (Arm_relocate_functions::thm_jump24,
8853         Arm_relocate_functions::thm_xpc22): New method definitions.
8854         (Arm_relocate_functions::thumb_branch_common): New method definition.
8855         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8856         operator.
8857         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8858         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8859
8860 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8861
8862         * Makefile.am: Build incremental-dump
8863         * Makefile.in: Regenerate.
8864         * incremental-dump.cc: New.
8865         * incremental.cc (Incremental_inputs_header_data,
8866         Incremental_inputs_entry_data): Move to incremental.h
8867         * incremental.h: (Incremental_inputs_header_data,
8868         Incremental_inputs_entry_data): Move from incremental.cc
8869
8870 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8871
8872         * incremental.cc (Incremental_inputs_header,
8873         Incremental_inputs_header_write, Incremental_inputs_entry,
8874         Incremental_inputs_entry_write): Add a typedef with the data type.
8875
8876 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8877
8878         * incremental.cc (Incremental_inputs_header,
8879         Incremental_inputs_header_write, Incremental_inputs_entry,
8880         Incremental_inputs_entry_write): Update comment about which
8881         type has the filed descriptions.
8882
8883 2009-11-15  Doug Kwan  <dougkwan@google.com>
8884
8885         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8886         (Arm_relocate_functions::arm_branch_common): Change method defintion
8887         in class definition to a method declaration and update list of formal
8888         parameters.
8889         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8890         Arm_relocation_functions::jump24): Adjust call to
8891         Arm_relocate_functions::arm_branch_common.  Update list of formal
8892         parameters.
8893         (Arm_relocate_functions::xpc25): New method definition.
8894         (Arm_relocate_functions::arm_branch_common): Move method defintion
8895         out from class definition.  Use stubs for mode-switching and extending
8896         branch ranges.
8897         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8898         specially.  Change code to enable use of stubs in ARM branches.
8899
8900 2009-11-10  Doug Kwan  <dougkwan@google.com>
8901
8902         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8903         in method declaration.
8904         (Target_arm::relocate_stub): New method declaration.
8905         (Target_arm::default_target): Change to return a pointer instead of
8906         a const reference.
8907         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8908         Target_arm::default_target.
8909         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8910         method definition.
8911         (Target_arm::relocate_section): Adjust view.
8912         (Target_arm::relocate_stub): New method definition.
8913
8914 2009-11-10  Doug Kwan  <dougkwan@google.com>
8915
8916         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8917         a format warning.
8918         * incremental.cc (open_incremental_binary): Initialized local
8919         variables to avoid warnings.
8920         * object.cc (make_elf_object): Ditto.
8921         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8922         a format warning.
8923
8924 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8925
8926         PR gold/10930
8927         * testsuite/plugin_test.c: Include "config.h".
8928
8929 2009-11-09  Doug Kwan  <dougkwan@google.com>
8930
8931         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8932         (arm_symbol_value): Remove.
8933         (Arm_relocate_functions::arm_branch_common,
8934         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8935         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8936         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8937         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8938         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8939         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8940         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8941         Arm_relocate_functions::thm_mobw_abs_nc,
8942         Arm_relocate_functions::thm_mov_abs,
8943         Arm_relocate_functions::movw_prel_nc,
8944         Arm_relocate_functions::thm_movt_abs,
8945         Arm_relocate_functions::movt_prel,
8946         Arm_relocate_functions::thm_movw_prel_nc,
8947         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8948         (Target_arm::Relocate::relocate): Only decompose address into two
8949         parts if relocation type uses the thumb-bit and pass the actual
8950         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8951         calls to methods in Arm_relocate_functions for this change.
8952
8953 2009-11-08  Ian Lance Taylor  <iant@google.com>
8954
8955         PR 10925
8956         * reloc.cc: Instantiate
8957         Sized_relobj::initialize_input_to_output_maps and
8958         Sized_relobj:free_input_to_output_maps.
8959
8960 2009-11-06  Ian Lance Taylor  <iant@google.com>
8961
8962         PR 10876
8963         * defstd.cc (in_segment): Set only_if_ref true for "end".
8964
8965 2009-11-06  Doug Kwan  <dougkwan@google.com>
8966
8967         * arm.cc (class Reloc_stub): Correct a comment.
8968         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8969         (Target_arm::scan_section_for_stubs): New method declaration.
8970         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8971         Change methods from private to protected.
8972         (Target_arm::do_may_relax): New method definition.
8973         (Target_arm::do_relax, Target_arm::group_sections,
8974         Target_arm::scan_reloc_for_stub,
8975         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8976         (Target_arm::arm_input_section_map_): New data member declaration.
8977         (Target_arm::scan_reloc_for_stub,
8978         Target_arm::scan_reloc_section_for_stubs,
8979         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8980         Target_arm::do_relax): New method definitions.
8981
8982 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8983
8984         * configure.ac: Check for (struct stat)::st_mtim
8985         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8986         * config.in: Regenerate.
8987         * configure: Regenerate.
8988
8989 2009-11-05  Ian Lance Taylor  <iant@google.com>
8990
8991         PR 10910
8992         * output.cc (Output_segment::add_output_section): Add missing
8993         return statement.
8994
8995 2009-11-04  Ian Lance Taylor  <iant@google.com>
8996
8997         PR 10880
8998         * object.h (class Object): Add is_needed and set_is_needed
8999         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9000         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9001         defined in a dynamic object and referenced by a regular object,
9002         set is_needed for the dynamic object.
9003         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9004         if the file is marked with as_needed and it is not needed.
9005
9006 2009-11-04  Ian Lance Taylor  <iant@google.com>
9007
9008         PR 10887
9009         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9010         tags if data is discarded by linker script.
9011         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9012         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9013         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9014         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9015
9016 2009-11-04  Ian Lance Taylor  <iant@google.com>
9017
9018         * layout.cc (Layout::get_output_section): Add is_interp and
9019         is_dynamic_linker_section parameters.  Change all callers.
9020         (Layout::choose_output_section): Likewise.
9021         (Layout::make_output_section): Likewise.
9022         (Layout::add_output_section_data): Add is_dynamic_linker_section
9023         parameter.  Change all callers.
9024         * layout.h (class Layout): Update declarations.
9025         * output.h (class Output_section): Add is_interp, set_is_interp,
9026         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9027         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9028         generate_code_fills_at_write_ to a bitfield.
9029         * output.cc (Output_section::Output_sections): Initialize new
9030         fields.
9031         (Output_segment::add_output_section): Add do_sort parameter.
9032         Change all callers.
9033
9034 2009-11-03  Ian Lance Taylor  <iant@google.com>
9035
9036         PR 10860
9037         * options.h (class General_options): Add --warn-common.
9038         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9039         merging two common symbols.
9040         (Symbol_table::should_override): Handle --warn-common when merging
9041         a common symbol with a defined symbol.  Use report_resolve_problem
9042         for multiple definitions.
9043         (Symbol_table::report_resolve_problem): New function.
9044         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9045
9046 2009-11-03  Doug Kwan  <dougkwan@google.com>
9047
9048         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9049         stub_factory_.
9050         (Target_arm::stub_factory): New method definition.
9051         (Target_arm::new_arm_input_section,
9052         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9053         Target_arm::reloc_uses_thumb_bit): New method declarations.
9054         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9055         New type definitions.
9056         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9057         member declarations.
9058         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9059         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9060         New method definitions.
9061
9062 2009-11-03  Ian Lance Taylor  <iant@google.com>
9063
9064         * options.h (class General_options): Add --warn_constructors.
9065
9066 2009-11-03  Ian Lance Taylor  <iant@google.com>
9067
9068         PR 10893
9069         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9070         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9071
9072 2009-11-03  Ian Lance Taylor  <iant@google.com>
9073
9074         PR 10895
9075         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9076         --msgid-bugs-address.
9077         (install-pdf): New target.
9078         (install-data_yes): Look up one directory to find mkinstalldirs.
9079
9080 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9081
9082         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9083         tree.
9084
9085 2009-10-30  Doug Kwan  <dougkwan@google.com>
9086
9087         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9088
9089 2009-10-30  Doug Kwan  <dougkwan@google.com>
9090
9091         * arm.cc (Stub_addend_reader): New struct template definition
9092         and partial specializations.
9093         (Stub_addend_reader::operator()): New method definition for a
9094         partially specialized template.
9095
9096 2009-10-30  Doug Kwan  <dougkwan@google.com>
9097
9098         * arm.cc (Arm_relobj::processor_specific_flags): New method
9099         definition.
9100         (Arm_relobj::do_read_symbols): New method declaration.
9101         (Arm_relobj::processor_specific_flags_): New data member declaration.
9102         (Arm_dynobj): New class definition.
9103         (Target_arm::do_finalize_sections): Add input_objects parameter.
9104         (Target_arm::do_adjust_elf_header): New method declaration.
9105         (Target_arm::are_eabi_versions_compatible,
9106         (Target_arm::merge_processor_specific_flags): New method declaration.
9107         (Target_arm::do_make_elf_object): New overloaded method definitions
9108         and declaration.
9109         (Arm_relobj::do_read_symbols): New method definition.
9110         (Arm_dynobj::do_read_symbols): Ditto.
9111         (Target_arm::do_finalize_sections): Add input_objects parameters.
9112         Merge processor-specific flags from all input objects.
9113         (Target_arm::are_eabi_versions_compatible,
9114         Target_arm::merge_processor_specific_flags,
9115         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9116         New method definitions.
9117         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9118         Input_objects pointer type parameter.
9119         * layout.cc (Layout::finalize): Pass input objects to target's.
9120         finalize_sections function.
9121         * output.cc (Output_file_header::do_sized_write): Set ELF file
9122         header's processor-specific flags.
9123         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9124         Input_objects pointer type parameter.
9125         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9126         * target.h (Input_objects): New forward class declaration.
9127         (Target::processor_specific_flags,
9128         Target::are_processor_specific_flags_sect): New method definitions.
9129         (Target::finalize_sections): Add input_objects parameter.
9130         (Target::Target): Initialize processor_specific_flags_ and
9131         are_processor_specific_flags_set_.
9132         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9133         parameter.
9134         (Target::set_processor_specific_flags): New method definition.
9135         (Target::processor_specific_flags_,
9136         Target::are_processor_specific_flags_set_): New data member
9137         declarations.
9138         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9139         Input_objects pointer type parameter.
9140
9141 2009-10-30  Doug Kwan  <dougkwan@google.com>
9142
9143         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9144
9145 2009-10-28  Ian Lance Taylor  <iant@google.com>
9146
9147         * object.h (class Relobj): Drop options parameter from
9148         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9149         do_scan_relocs, do_relocate.  Change all callers.
9150         (class Sized_relobj): Drop options parameters from
9151         do_gc_process_relocs, do_scan_relocs, do_relocate,
9152         do_relocate_sections, relocate_sections, emit_relocs_scan,
9153         emit_relocs_scan_reltype.  Change all callers.
9154         (struct Relocate_info): Remove options field and all references to
9155         it.
9156         * reloc.h (class Read_relocs): Remove options constructor
9157         parameter and options_ field.  Change all callers.
9158         (class Gc_process_relocs, class Scan_relocs): Likewise.
9159         (class Relocate_task): Likewise.
9160         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9161         all callers.
9162         (scan_relocatable_relocs): Likewise.
9163         * target.h (class Sized_target): Remove options parameter from
9164         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9165         all callers.
9166         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9167         callers.
9168         * arm.cc: Update functions to remove options parameters.
9169         * i386.cc: Likewise.
9170         * powerpc.cc: Likewise.
9171         * sparc.cc: Likewise.
9172         * x86_64.cc: Likewise.
9173         * testsuite/testfile.cc: Likewise.
9174
9175 2009-10-28  Doug Kwan  <dougkwan@google.com>
9176
9177         * arm.cc (Arm_relobj): New class definition.
9178         (Arm_relobj::scan_sections_for_stubs,
9179         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9180         New method definitions.
9181
9182 2009-10-28  Cary Coutant  <ccoutant@google.com>
9183
9184         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9185         (Plugin::cleanup_done_): New member.
9186         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9187         (Plugin_manager::cleanup_done_): Remove.
9188         (Plugin_manager::add_input_file): Edit error message.
9189         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9190         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9191
9192 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9193
9194         * fileread.cc: (File_read::View::~View): Use the new
9195         data_ownership_ filed.
9196         (File_read::~File_read): Dispose the new whole_file_view_.
9197         (File_read::open): Mmap the whole file if needed.
9198         (File_read::open): Use whole_file_view_ instead of contents_.
9199         (File_read::find_view): Use whole_file_view_ if applicable.
9200         (File_read::do_read): Use whole_file_view_ instead of contents_.
9201         (File_read::make_view): Use whole_file_view_ instead of contents_,
9202         update File_read::View::View call.
9203         (File_read::find_or_make_view): Update File_read::View::View
9204         call.
9205         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9206         remove contents_
9207         (File_read::View::Data_ownership): New enum.
9208         (File_read::View::View): Replace bool mapped_ with Data_ownership
9209         argument.
9210         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9211         (File_read::View::data_ownership_): New field.
9212         (File_read::contents_): Remove (replaced by whole_file_view_).
9213         (File_read::whole_file_view_): New field.
9214         * options.h (class General_options): Add --keep-files-mapped.
9215
9216 2009-10-27  Cary Coutant  <ccoutant@google.com>
9217
9218         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9219         * testsuite/Makefile.am (plugin_test_5): New test case.
9220         * testsuite/Makefile.in: Regenerate.
9221
9222 2009-10-25  Doug Kwan  <dougkwan@google.com>
9223
9224         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9225         from private to protected to allow access by child class.
9226         (Sized_relobj::do_relocate_sections): New method declaration.
9227         (Sized_relobj::relocate_sections): Virtualize.
9228         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9229         Sized_relobj::relocate_sections.  Instantiate template explicitly
9230         for different target sizes and endianity.
9231
9232 2009-10-24  Doug Kwan  <dougkwan@google.com>
9233
9234         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9235         (Arm_input_section::as_arm_input_section): New method.
9236         (Arm_output_section): New class definition.
9237         (Arm_output_section::create_stub_group,
9238         Arm_output_section::group_sections): New method definitions.
9239
9240 2009-10-22  Doug Kwan  <dougkwan@google.com>
9241
9242         * arm.cc (Arm_input_section): New class definition.
9243         (Arm_input_section::init, Arm_input_section:do_write,
9244         Arm_input_section::set_final_data_size,
9245         Arm_input_section::do_reset_address_and_file_offset): New method
9246         definitions.
9247
9248 2009-10-21  Doug Kwan  <dougkwan@google.com>
9249
9250         * arm.cc (Stub_table, Arm_input_section): New forward class
9251         declarations.
9252         (Stub_table): New class defintion.
9253         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9254         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9255         New method definition.
9256
9257 2009-10-21  Doug Kwan  <dougkwan@google.com>
9258
9259         * arm.cc: Update copyright comments.
9260         (Target_arm): New forward class template declaration.
9261         (Arm_address): New type.
9262         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9263         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9264         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9265         constants.
9266         (Insn_template): Same.
9267         (DEF_STUBS): New macro.
9268         (Stub_type): New enum type.
9269         (Stub_template): New class definition.
9270         (Stub): Same.
9271         (Reloc_stub): Same.
9272         (Stub_factory): Same.
9273         (Target_arm::Target_arm): Initialize may_use_blx_ and
9274         should_force_pic_veneer_.
9275         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9276         Target_arm::should_force_pic_veneer,
9277         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9278         Target_arm::using_thumb_only, Target_arm:;default_target): New
9279         method defintions.
9280         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9281         New data member declarations.
9282         (Insn_template::size, Insn_template::alignment): New method defintions.
9283         (Stub_template::Stub_template): New method definition.
9284         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9285         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9286         (Stub_factory::Stub_factory): New method definition.
9287         * gold.h (string_hash): New template.
9288         * output.h (Input_section_specifier::hash_value): Use
9289         gold::string_hash.
9290         (Input_section_specifier::string_hash): Remove.
9291         * stringpool.cc (Stringpool_template::string_hash): Use
9292         gold::string_hash.
9293
9294 2009-10-20  Doug Kwan  <dougkwan@google.com>
9295
9296         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9297         symbols of relaxed input sections.
9298         * output.h (Output_section::find_relaxed_input_section): Make
9299         method public.
9300
9301 2009-10-16  Doug Kwan  <dougkwan@google.com>
9302
9303         * dynobj.cc (Versions::Versions): Initialize version_script_.
9304         Only insert base version symbol definition for a shared object
9305         if version script defines any version versions.
9306         (Versions::define_base_version): New method definition.
9307         (Versions::add_def): Check that base version is not needed.
9308         (Versions::add_need): Define base version lazily.
9309         * dynobj.h (Versions::define_base_version): New method declaration.
9310         (Versions::needs_base_version_): New data member declaration.
9311         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9312         (check_DATA): Add no_version_test.stdout.
9313         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9314         New make rules.
9315         * testsuite/Makefile.in: Regenerate.
9316         * testsuite/no_version_test.c: New file.
9317         * testsuite/no_version_test.sh: Ditto.
9318
9319 2009-10-16  Doug Kwan  <dougkwan@google.com>
9320
9321         * expression.cc (class Segment_start_expression): New class definition.
9322         (Segment_start_expression::value): New method definition.
9323         (script_exp_function_segment_start): Return a new
9324         Segment_start_expression.
9325         * gold/script-c.h (script_saw_segment_start_expression): New function
9326         prototype.
9327         * script-sections.cc (Script_sections::Script_sections): Initialize
9328         SAW_SEGMENT_START_EXPRESSION_ to false.
9329         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9330         and -Tbbs options to specify section addresses if given in
9331         command line and no SEGMENT_START expression is seen in a script.
9332         * script-sections.h (Script_sections::saw_segment_start_expression,
9333         Script_sections::set_saw_segment_start_expression): New method
9334         definition.
9335         (Script_sections::saw_segment_start_expression_): New data member
9336         declaration.
9337         * script.cc (script_saw_segment_start_expression): New function.
9338         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9339         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9340         script_test_7.sh and script_test_8.sh.
9341         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9342         script_test_8.stdout.
9343         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9344         (script_test_6, script_test_6.stdout, script_test_7,
9345         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9346         * Makefile.in: Regenerate.
9347         * testsuite/script_test_6.sh: New file.
9348         * testsuite/script_test_6.t: Same.
9349         * testsuite/script_test_7.sh: Same.
9350         * testsuite/script_test_7.t: Same.
9351         * testsuite/script_test_8.sh: Same.
9352
9353 2009-10-16  Doug Kwan  <dougkwan@google.com>
9354
9355         * output.cc (Output_segment::set_section_list_address): Cast
9356         expressions to unsigned long long type to avoid format warnings.
9357
9358 2009-10-15  Ian Lance Taylor  <iant@google.com>
9359
9360         * script.cc (Script_options::add_symbol_assignment): Always add a
9361         dot assignment to script_sections_.
9362         * script-sections.cc (Script_sections::add_dot_assignment):
9363         Initialize if necessary.
9364
9365         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9366         program headers with no load segment if there is a linker script.
9367
9368         * layout.cc (Layout::set_segment_offsets): Align the file offset
9369         to the segment aligment for -N or -n with no load segment.
9370         * output.cc (Output_segment::add_output_section): Don't crash if
9371         the first section is a TLS section.
9372         (Output_segment::set_section_list_addresses): Print an error
9373         message if the address moves backward in a linker script.
9374         * script-sections.cc
9375         (Output_section_element_input::set_section_addresses): Don't
9376         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9377         (Orphan_output_section::set_section_addresses): Likewise.
9378
9379 2009-10-15  Doug Kwan  <dougkwan@google.com>
9380
9381         * layout.cc (Layout::finish_dynamic_section): Generate tags
9382         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9383         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9384         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9385
9386 2009-10-14  Ian Lance Taylor  <iant@google.com>
9387
9388         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9389         fields.
9390         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9391         data_shdr fields of relinfo.
9392         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9393         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9394         R_386_TLS_LDO_32, adjust based on section flags.
9395         (Target_i386::Relocate::fix_up_ldo): Remove.
9396
9397 2009-10-13  Ian Lance Taylor  <iant@google.com>
9398
9399         Add support for -pie.
9400         * options.h (class General_options): Add -pie and
9401         --pic-executable.
9402         (General_options::output_is_position_independent): Test -pie.
9403         (General_options::output_is_executable): Return true if not shared
9404         and not relocatable.
9405         (General_options::output_is_pie): Remove.
9406         * options.cc (General_options::finalize): Reject incompatible uses
9407         of -pie.
9408         * gold.cc (queue_middle_tasks): A -pie link is not static.
9409         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9410         * symtab.cc (Symbol::final_value_is_known): Return false if
9411         output_is_position_independent.
9412         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9413         output_is_position_independent.
9414         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9415         output_is_position_independent.
9416         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9417         output_is_position_independent.
9418         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9419         two_file_pie_test.
9420         (basic_pie_test.o, basic_pie_test): New targets.
9421         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9422         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9423         (two_file_pie_test): New target.
9424         * testsuite/Makefile.in: Rebuild.
9425         * README: Remove note saying that -pie is not supported.
9426
9427 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9428
9429         * options.h (class General_options): Add -init and -fini.
9430         * layout.cc (Layout::finish_dynamic_section): Emit
9431         given init and fini functions.
9432
9433 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9434
9435         * gc.h (gc_process_relocs): Check if icf is enabled using new
9436         function.
9437         * gold.cc (queue_initial_tasks): Likewise.
9438         (queue_middle_tasks): Likewise.
9439         * object.cc (do_layout): Likewise.
9440         * symtab.cc (is_section_folded): Likewise.
9441         * main.cc (main): Likewise.
9442         * reloc.cc (Read_relocs::run): Likewise.
9443         (Sized_relobj::do_scan_relocs): Likewise.
9444         * icf.cc (is_function_ctor_or_dtor): New function.
9445         (Icf::find_identical_sections): Check if function is ctor or dtor when
9446         safe icf is chosen.
9447         * options.h (General_options::icf): Change option to be an enum.
9448         (Icf_status): New enum.
9449         (icf_enabled): New method.
9450         (icf_safe_folding): New method.
9451         (set_icf_status): New method.
9452         (icf_status_): New variable.
9453         * (options.cc) (General_options::finalize): Set icf_status_.
9454         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9455         icf_test and icf_keep_unique_test to use the --icf enum flag.
9456         * testsuite/icf_safe_test.sh: New file.
9457         * testsuite/icf_safe_test.cc: New file.
9458
9459 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9460
9461         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9462         includes to gc.h and icf.h.
9463         * arm.cc: Include gc.h.
9464         * gold.cc: Likewise.
9465         * i386.cc: Likewise.
9466         * powerpc.cc: Likewise.
9467         * sparc.cc: Likewise.
9468         * x86_64.cc: Likewise.
9469         * gc.h: Include icf.h.
9470
9471 2009-10-11  Ian Lance Taylor  <iant@google.com>
9472
9473         * plugin.cc: Include "gold.h" before other header files.
9474
9475 2009-10-10  Chris Demetriou  <cgd@google.com>
9476
9477         * options.h (Input_file_argument::Input_file_type): New enum.
9478         (Input_file_argument::is_lib_): Replace with...
9479         (Input_file_argument::type_): New member.
9480         (Input_file_argument::Input_file_argument): Take Input_file_type
9481         'type' rather than boolean 'is_lib' as second argument.
9482         (Input_file_argument::is_lib): Use type_.
9483         (Input_file_argument::is_searched_file): New function.
9484         (Input_file_argument::may_need_search): Handle is_searched_file.
9485         * options.cc (General_options::parse_library): Support -l:filename.
9486         (General_options::parse_just_symbols): Update for Input_file_argument
9487         changes.
9488         (Command_line::process): Likewise.
9489         * archive.cc (Archive::get_file_and_offset): Likewise.
9490         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9491         * script.cc (read_script_file, script_add_file): Likewise.
9492         * fileread.cc (Input_file::Input_file): Likewise.
9493         (Input_file::will_search_for): Handle is_searched_file.
9494         (Input_file::open): Likewise.
9495         * readsyms.cc (Read_symbols::get_name): Likewise.
9496         * testsuite/Makefile.am (searched_file_test): New test.
9497         * testsuite/Makefile.in: Regenerate.
9498         * testsuite/searched_file_test.cc: New file.
9499         * testsuite/searched_file_test_lib.cc: New file.
9500
9501 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9502             Ian Lance Taylor  <iant@google.com>
9503
9504         * descriptor.cc: Include <cstdio> and "binary-io.h".
9505         (Descriptors::open): Open the files in binary mode always.
9506         * script.cc (Lex::get_token): Treat \r as whitespace.
9507
9508 2009-10-09  Ian Lance Taylor  <iant@google.com>
9509
9510         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9511
9512 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9513             Ian Lance Taylor  <iant@google.com>
9514
9515         * configure.ac: Check for readv function also.
9516         * fileread.cc (readv): Define if not HAVE_READV.
9517         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9518         does not exist.
9519         * config.in: Regenerate.
9520         * configure: Regenerate.
9521
9522 2009-10-09  Doug Kwan  <dougkwan@google.com>
9523
9524         * layout.cc (Layout::make_output_section): Call target hook to make
9525         ordinary output section.
9526         (Layout::finalize): Adjust parameter list of call the
9527         Target::may_relax().
9528         * layout.h (class Layout::section_list): New method.
9529         * merge.h (Output_merge_base::entsize): Change visibility to public.
9530         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9531         New methods.
9532         (Output_merge_string::do_is_string): New method.
9533         * object.cc (Sized_relobj::do_setup): renamed from
9534         Sized_relobj::set_up.
9535         * object.h (Sized_relobj::adjust_shndx,
9536         Sized_relobj::initializ_input_to_output_maps,
9537         Sized_relobj::free_input_to_output_maps): Change visibilities to
9538         protected.
9539         (Sized_relobj::setup): Virtualize.
9540         (Sized_relobj::do_setup): New method declaration.
9541         (Sized_relobj::invalidate_section_offset,
9542         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9543         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9544         * options.cc (parse_int): New function.
9545         * options.h (parse_int): New declaration.
9546         (DEFINE_int): New macro.
9547         (stub_group_size): New option.
9548         * output.cc (Output_section::Output_section): Initialize memebers
9549         merge_section_map_, merge_section_by_properties_map_,
9550         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9551         (Output_section::add_input_section): Handled deferred code-fill
9552         generation and remove an old comment.
9553         (Output_section::add_relaxed_input_section): New method definition.
9554         (Output_section::add_merge_input_section): Use merge section by
9555         properties map to speed to search.  Update merge section maps
9556         as appropriate.
9557         (Output_section::build_relaxation_map): New method definition.
9558         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9559         Same.
9560         (Output_section::relax_input_section): Renamed to
9561         Output_section::convert_input_sections_to_relaxed_sections and change
9562         interface to take a vector of pointers to relaxed sections.
9563         (Output_section::find_merge_section,
9564         Output_section::find_relaxed_input_section): New method definitions.
9565         (Output_section::is_input_address_mapped,
9566         Output_section::output_offset, Output_section::output_address):
9567         Use output section data maps to speed up searching.
9568         (Output_section::find_starting_output_address): Add comments.
9569         (Output_section::do_write,
9570         Output_section::write_to_postprocessing_buffer): Do code-fill
9571         generation as appropriate.
9572         (Output_section::get_input_sections): Invalidate relaxed input section
9573         map.
9574         (Output_section::restore_states): Adjust type of checkpoint .
9575         Invalidate relaxed input section map.
9576         * output.h (Output_merge_base): New class declaration.
9577         (Input_section_specifier): New class defintion.
9578         (class Output_relaxed_input_section) Change base class to
9579         Output_section_data_build.
9580         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9581         base class initializer.
9582         (Output_section::add_relaxed_input_section): New method declaration.
9583         (Output_section::Input_section): Change visibility to protected.
9584         (Output_section::Input_section::relobj,
9585         Output_section::Input_section::shndx): Handle relaxed input sections.
9586         Output_section::input_sections) Change visibility to protected.  Also
9587         define overload to return a non-const pointer.
9588         (Output_section::Merge_section_properties): New class defintion.
9589         (Output_section::Merge_section_by_properties_map,
9590         Output_section::Output_section_data_by_input_section_map,
9591         Output_section::Relaxation_map): New types.
9592         (Output_section::relax_input_section): Rename method to
9593         Output_section::convert_input_sections_to_relaxed_sections and change
9594         interface to take a vector of relaxed section pointers.
9595         (Output_section::find_merge_section,
9596         Output_section::find_relaxed_input_section,
9597         Output_section::build_relaxation_map,
9598         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9599         New method declarations.
9600         (Output_section::merge_section_map_
9601         Output_section::merge_section_by_properties_map_,
9602         Output_section::relaxed_input_section_map_,
9603         Output_section::is_relaxed_input_section_map_valid_,
9604         Output_section::generate_code_fills_at_write_): New data members.
9605         * script-sections.cc
9606         (Output_section_element_input::set_section_addresses): Call
9607         current_data_size and addralign methods of relaxed input sections.
9608         (Orphan_output_section::set_section_addresses): Call current_data_size
9609         and addralign methods of relaxed input sections.
9610         * symtab.cc (Symbol_table::compute_final_value): Extract template
9611         from the body of Symbol_table::sized_finalize_symbol.
9612         (Symbol_table::sized_finalized_symbol): Call
9613         Symbol_table::compute_final_value.
9614         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9615         (Symbol_table::compute_final_value): New templated method declaration.
9616         * target.cc (Target::do_make_output_section): New method defintion.
9617         * target.h (Target::make_output_section): New method declaration.
9618         (Target::relax): Add more parameters for input objects, symbol table
9619         and layout.  Adjust call to do_relax.
9620         (Target::do_make_output_section): New method declaration.
9621         (Target::do_relax): Add parameters for input objects, symbol table
9622         and layout.
9623
9624 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9625
9626         * pread.c: Include stdio.h.
9627
9628 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9629
9630         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9631         defined.
9632
9633 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9634
9635         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9636         Change read_shndx type to unsigned int.
9637         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9638         int.
9639         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9640         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9641         Change read_shndx type to unsigned int.
9642         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9643         int.
9644         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9645         * layout.cc (Layout::create_symtab_sections): Cast the result of
9646         local_symcount * symsize to off_t in the gold_assert.
9647
9648 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9649
9650         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9651         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9652         R_ARM_BASE_ABS.
9653         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9654         (Arm_relocate_functions::thm_abs5): New function.
9655         (Arm_relocate_functions::abs12): New function.
9656         (Arm_relocate_functions::abs16): New function.
9657         (Arm_relocate_functions::base_abs): New function.
9658         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9659         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9660         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9661         R_ARM_BASE_ABS.
9662         (Scan::global): Likewise.
9663         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9664         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9665         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9666         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9667         R_ARM_BASE_ABS.
9668
9669 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9670
9671         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9672         (Arm_relocate_functions::movt_prel): New function.
9673         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9674         (Arm_relocate_functions::thm_movt_prel): New function.
9675         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9676         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9677         (Scan::global, Relocate::relocate): Likewise.
9678         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9679
9680 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9681
9682         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9683         Incremental_checker.
9684         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9685         unsigned int.
9686         (class Incremental_inputs_header): New class.
9687         (Incremental_inputs_header_writer): Edit comment.
9688         (Incremental_inputs_entry): New class.
9689         (Incremental_inputs_entry_writer): Edit comment.
9690         (Sized_incremental_binary::do_find_incremental_inputs_section):
9691         Add *strtab_shndx parameter, fill it.
9692         (Sized_incremental_binary::do_check_inputs): New method.
9693         (Incremental_checker::can_incrementally_link_output_file): Use
9694         Sized_incremental_binary::check_inputs.
9695         (Incremental_inputs::report_command_line): Save command line in
9696         command_line_.
9697         * incremental.h:
9698         (Incremental_binary::find_incremental_inputs_section): New
9699         method.
9700         (Incremental_binary::do_find_incremental_inputs_section): Add
9701         strtab_shndx parameter.
9702         (Incremental_binary::do_check_inputs): New pure virtual method.
9703         (Sized_incremental_binary::do_check_inputs): Declare.
9704         (Incremental_checker::Incremental_checker): Add incremental_inputs
9705         parameter, use it to initialize incremental_inputs_.
9706         (Incremental_checker::incremental_inputs_): New field.
9707         (Incremental_checker::command_line): New method.
9708         (Incremental_checker::inputs): New method.
9709         (Incremental_checker::command_line_): New field.
9710
9711 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9712
9713         * incremental.cc: Include <cstdarg> and "target-select.h".
9714         (vexplain_no_incremental): New function.
9715         (explain_no_incremental): New function.
9716         (Incremental_binary::error): New method.
9717         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9718         method.
9719         (make_sized_incremental_binary): New function.
9720         (open_incremental_binary): New function.
9721         (can_incrementally_link_file): Add checks if output is ELF and has
9722         inputs section.
9723         * incremental.h: Include "elfcpp_file.h" and "output.h".
9724         (Incremental_binary): New class.
9725         (Sized_incremental_binary): New class.
9726         (open_incremental_binary): Declare.
9727         * object.cc (is_elf_object): Use
9728         elfcpp::Elf_recognizer::is_elf_file.
9729         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9730         * output.h (Output_file::filesize): New method.
9731
9732 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9733
9734         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9735         New function.
9736         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9737         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9738         function.
9739         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9740         function.
9741         (Arm_relocate_functions::movw_abs_nc): New function.
9742         (Arm_relocate_functions::movt_abs): New function.
9743         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9744         (Arm_relocate_functions::thm_movt_abs): New function.
9745         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9746         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9747         (Scan::global): Likewise.
9748         (Relocate::relocate): Likewise.
9749         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9750
9751 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9752
9753         * arm.cc (Arm_relocate_functions::got_prel) New function.
9754         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9755         (Relocate::relocate): Likewise.
9756         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9757
9758 2009-10-06  Ian Lance Taylor  <iant@google.com>
9759
9760         * options.h (class General_options): Define
9761         split_stack_adjust_size parameter.
9762         * object.h (class Object): Add uses_split_stack_ and
9763         has_no_split_stack_ fields.  Add uses_split_stack and
9764         has_no_split_stack accessor functions.  Declare
9765         handle_split_stack_section.
9766         (class Reloc_symbol_changes): Define.
9767         (class Sized_relobj): Define Function_offsets.  Declare
9768         split_stack_adjust, split_stack_adjust_reltype, and
9769         find_functions.
9770         * object.cc (Object::handle_split_stack_section): New function.
9771         (Sized_relobj::do_layout): Call handle_split_stack_section.
9772         * dynobj.cc (Sized_dynobj::do_layout): Call
9773         handle_split_stack_section.
9774         * reloc.cc (Sized_relobj::relocate_sections): Call
9775         split_stack_adjust for executable sections in split_stack
9776         objects.  Pass reloc_map to relocate_section.
9777         (Sized_relobj::split_stack_adjust): New function.
9778         (Sized_relobj::split_stack_adjust_reltype): New function.
9779         (Sized_relobj::find_functions): New function.
9780         * target-reloc.h: Include "object.h".
9781         (relocate_section): Add reloc_symbol_changes parameter.  Change
9782         all callers.
9783         * target.h (class Target): Add calls_non_split method.  Declare
9784         do_calls_non_split virtual method.  Declare match_view and
9785         set_view_to_nop.
9786         * target.cc: Include "elfcpp.h".
9787         (Target::do_calls_non_split): New function.
9788         (Target::match_view): New function.
9789         (Target::set_view_to_nop): New function.
9790         * gold.cc (queue_middle_tasks): Give an error if mixing
9791         split-stack and non-split-stack objects with -r.
9792         * i386.cc (Target_i386::relocate_section): Add
9793         reloc_symbol_changes parameter.
9794         (Target_i386::do_calls_non_split): New function.
9795         * x86_64.cc (Target_x86_64::relocate_section): Add
9796         reloc_symbol_changes parameter.
9797         (Target_x86_64::do_calls_non_split): New function.
9798         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9799         parameter.
9800         * powerpc.cc (Target_powerpc::relocate_section): Add
9801         reloc_symbol_changes parameter.
9802         * sparc.cc (Target_sparc::relocate_section): Add
9803         reloc_symbol_changes parameter.
9804         * configure.ac: Call AM_CONDITIONAL for the default target.
9805         * configure: Rebuild.
9806         * testsuite/Makefile.am (TEST_AS): New variable.
9807         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9808         (check_DATA): Add split_i386 and split_x86_64 files.
9809         (SPLIT_DEFSYMS): Define.
9810         (split_i386_[1234n].o): New targets.
9811         (split_i386_[124]): New targets.
9812         (split_i386_[1234r].stdout): New targets.
9813         (split_x86_64_[1234n].o): New targets.
9814         (split_x86_64_[124]): New targets.
9815         (split_x86_64_[1234r].stdout): New targets.
9816         (MOSTLYCLEANFILES): Add new executables.
9817         * testsuite/split_i386.sh: New file.
9818         * testsuite/split_x86_64.sh: New file.
9819         * testsuite/split_i386_1.s: New file.
9820         * testsuite/split_i386_2.s: New file.
9821         * testsuite/split_i386_3.s: New file.
9822         * testsuite/split_i386_4.s: New file.
9823         * testsuite/split_i386_n.s: New file.
9824         * testsuite/split_x86_64_1.s: New file.
9825         * testsuite/split_x86_64_2.s: New file.
9826         * testsuite/split_x86_64_3.s: New file.
9827         * testsuite/split_x86_64_4.s: New file.
9828         * testsuite/split_x86_64_n.s: New file.
9829         * testsuite/testfile.cc (Target_test): Update relocation_section
9830         function.
9831         * testsuite/Makefile.in: Rebuild.
9832
9833 2009-10-06  Ian Lance Taylor  <iant@google.com>
9834
9835         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9836         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9837         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9838         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9839         the address on ldo_addrs_.
9840         (Target_i386::Relocate::fix_up_ldo): New function.
9841
9842 2009-10-06   Rafael Espindola  <espindola@google.com>
9843
9844         * plugin.cc (add_input_library): New.
9845         (Plugin::load): Add add_input_library to tv.
9846         (Plugin_manager::add_input_file): Add the is_lib argument.
9847         (add_input_file): Update call to Plugin_manager::add_input_file.
9848         (add_input_library): New.
9849         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9850
9851 2009-09-30  Doug Kwan  <dougkwan@google.com>
9852
9853         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9854         symbol and call Symbol::may_need_copy_reloc to determine if
9855         a copy reloc is needed.
9856         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9857         nocopyreloc is given in command line.
9858         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9859         given in command line.
9860         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9861         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9862         of the removed Target_i386::may_need_copy_reloc.
9863         * options.h (copyreloc): New option with default value false.
9864         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9865         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9866         instead of the removed Target_powerpc::may_need_copy_reloc.
9867         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9868         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9869         instead of the removed Target_sparc::may_need_copy_reloc.
9870         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9871         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9872         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9873         instead of the removed Target_x86_64::may_need_copy_reloc.
9874
9875 2009-09-30  Ian Lance Taylor  <iant@google.com>
9876
9877         * object.h (class Object): Remove target_ field, and target,
9878         sized_target, and set_target methods.
9879         (Object::sized_target): Remove.
9880         (class Sized_relobj): Update declarations.  Remove sized_target.
9881         * object.cc (Sized_relobj::setup): Remove target parameter.
9882         Change all callers.
9883         (Input_objects::add_object): Don't do anything with the target.
9884         (make_elf_sized_object): Add punconfigured parameter.  Change all
9885         callers.  Set or test parameter target.
9886         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9887         Change all callers.
9888         * parameters.cc (Parameters::set_target): Change parameter type to
9889         be non-const.
9890         (Parameters::default_target): Remove.
9891         (set_parameters_target): Change parameter type to be non-const.
9892         (parameters_force_valid_target): New function.
9893         (parameters_clear_target): New function.
9894         * parameters.h (class Parameters): Update declarations.  Remove
9895         default_target method.  Add sized_target and clear_target
9896         methods.  Change target_ to be non-const.
9897         (set_parameters_target): Update declaration.
9898         (parameters_force_valid_target): Declare.
9899         (parameters_clear_target): Declare.
9900         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9901         as NULL if we aren't searching.
9902         (Add_symbols::run): Don't check for compatible target.
9903         * fileread.cc (Input_file::open_binary): Call
9904         parameters_force_valid_target.
9905         * gold.cc (queue_middle_tasks): Likewise.
9906         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9907         set_target on object.
9908         * dynobj.h (class Sized_dynobj): Update declarations.
9909         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9910         make_elf_object returns NULL.
9911         (Archive::include_member): Don't check whether object target is
9912         compatible.
9913         * output.cc (Output_section::add_input_section): Get target from
9914         parameters.
9915         (Output_section::relax_input_section): Likewise.
9916         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9917         parameters.
9918         (Sized_relobj::do_scan_relocs): Likewise.
9919         (Sized_relobj::relocate_sections): Likewise.
9920         * resolve.cc (Symbol_table::resolve): Likewise.
9921         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9922         parameter.  Change all callers.
9923         (Symbol_table::add_from_object): Get target from parameters.
9924         (Symbol_table::add_from_relobj): Don't check object target.
9925         (Symbol_table::add_from_dynobj): Likewise.
9926         (Symbol_table::define_special_symbol): Get target from
9927         parameters.
9928         * symtab.h (class Symbol_table): Update declaration.
9929         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9930         parameter.  Change all callers.  Clear parameter target.
9931         (Binary_test): Test target here.
9932         * testsuite/object_unittest.cc (gold_testsuite): Remove
9933         target_test_pointer parameter.  Change all callers.
9934         (Object_test): Test target here.
9935
9936 2009-09-26  Ian Lance Taylor  <iant@google.com>
9937
9938         * testsuite/initpri1.c: Don't try to use constructor priorities if
9939         compiling with gcc before 4.3.
9940
9941 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9942
9943         * testsuite/retain_symbols_file_test.sh (check_present): Change
9944         output file name to retain_symbols_file_test.stdout.
9945         (check_absent): Likewise.
9946
9947 2009-09-18  Craig Silverstein  <csilvers@google.com>
9948
9949         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9950         * options.cc: Include <cerrno> and <fstream>.
9951         (General_options::finalize): Parse -retain-symbols-file tag.
9952         * options.h: New flag.
9953         (General_options): New method should_retain_symbol, new
9954         variable symbols_to_retain.
9955         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9956         should_retain_symbol map.
9957         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9958         * testsuite/Makefile.in: Regenerate.
9959         * testsuite/retain_symbols_file_test.sh: New file.
9960
9961 2009-09-18  Nick Clifton  <nickc@redhat.com>
9962
9963         * po/es.po: Updated Spanish translation.
9964
9965 2009-09-17  Doug Kwan  <dougkwan@google.com>
9966
9967         * debug.h (DEBUG_RELAXATION): New constant.
9968         (DEBUG_ALL): Add DEBUG_RELAXATION.
9969         (debug_string_to_enum): Add relaxation debug option.
9970         * layout.cc
9971         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9972         Layout::Relaxation_debug_check::read_sections,
9973         Layout::Relaxation_debug_check::read_sections): New method definitions.
9974         (Layout::Layout): Initialize data members
9975         record_output_section_data_from_scrips_,
9976         script_output_section_data_list_ and relaxation_debug_check_.
9977         (Layout::save_segments, Layout::restore_segments,
9978         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9979         Layout::relaxation_loop_body): New method definitions.
9980         (Layout::finalize): Support relaxation.  Move section layout code to
9981         Layout::relaxation_loop_body.
9982         (Layout::set_asection_address_from_script): Move code for orphan
9983         section placement out.
9984         (Layout::place_orphan_sections_in_script): New method definition.
9985         * layout.h (Output_segment_headers, Output_file_header):
9986         New forward class declarations.
9987         (Layout::~Layout): Define.
9988         (Layout::new_output_section_data_from_script): New method definition.
9989         (Layout::place_orphan_sections_in_script): New method declaration.
9990         (Layout::Segment_states): New type declaration.
9991         (Layout::save_segments, Layout::restore_segments,
9992         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9993         Layout::relaxation_loop_body): New method declarations.
9994         (Layout::Output_section_data_list): New type declaration.
9995         (Layout::Relaxation_debug_check): New class definition.
9996         (Layout::record_output_section_data_from_script_,
9997         Layout::script_output_section_data_list_, Layout::segment_states_,
9998         Layout::relaxation_debug_check_): New data members.
9999         * output.cc: (Output_section_headers::do_size): New method definition.
10000         (Output_section_headers::Output_section_headers): Move size
10001         computation to Output_section_headers::do_size.
10002         (Output_segment_headers::do_size): New method definition.
10003         (Output_file_header::Output_file_header): Move size computation to
10004         Output_file_header::do_size and call it.
10005         (Output_file_header::do_size): New method definition.
10006         (Output_data_group::Output_data_group): Adjust call to
10007         Output_section_data.
10008         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10009         (Output_symtab_xindex::do_write): Add array bound check.
10010         (Output_section::Input_section::print_to_mapfile): Handle
10011         RELAXED_INPUT_SECTION_CODE.
10012         (Output_section::Output_section): Initialize data member checkpoint_.
10013         (Output_section::~Output_section): Delete checkpoint object pointed
10014         by checkpoint_.
10015         (Output_section::add_input_section): Always add an Input_section if
10016         relaxing.
10017         (Output_section::add_merge_input_section): Add assert.
10018         (Output_section::relax_input_section): New method definition.
10019         (Output_section::set_final_data_size): Set load address to zero for
10020         an unallocated section.
10021         (Output_section::do_address_and_file_offset_have_reset_values):
10022         New method definition.
10023         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10024         Handle relaxed input section.
10025         (Output_section::sort_attached_input_sections): Checkpoint input
10026         section list lazily.
10027         (Output_section::get_input_sections): Change type of input_sections to
10028         list of Simple_input_section pointers.  Checkpoint input section list
10029         lazily.  Also handle relaxed input sections.
10030         (Output_section::add_input_section_for_script): Take a reference to
10031         a Simple_input_section object instead of Relobj pointer and section
10032         index as parameter.  Handle relaxed input sections.
10033         (Output_section::save_states, Output_section::restore_states): New
10034         method definitions.
10035         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10036         (Output_data::is_data_size_fixed): New method definition.
10037         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10038         if it is fixed.
10039         (Output_data::address_and_file_offset_have_reset_values): New method
10040         definition.
10041         (Output_data::do_address_and_file_offset_have_reset_values): New method
10042         definition.
10043         (Output_data::set_data_size): Check that data size is not fixed.
10044         (Output_data::fix_data_size): New method definition.
10045         (Output_data::is_data_size_fixed_): New data member.
10046         (Output_section_headers::set_final_data_size): New method definition.
10047         (Output_section_headers::do_size): New method declaration.
10048         (Output_segment_headers::set_final_data_size): New method definition.
10049         (Output_segment_headers::do_size): New method declaration.
10050         (Output_file_header::set_final_data_size)::New method definition.
10051         (Output_file_header::do_size)::New method declaration.
10052         (Output_section_data::Output_section_data): Add new parameter
10053         is_data_size_fixed and use it to fix data size.
10054         (Output_data_const::Output_data_const): Adjust call to base class
10055         constructor and fix data size.
10056         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10057         base class constructor and fix data size.
10058         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10059         base class constructor and fix data size.
10060         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10061         class constructor and fix data size.
10062         (Output_data_group::set_final_data_size): New method definition.
10063         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10064         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10065         class constructor and fix data size.
10066         (Output_relaxed_input_section): New class definition.
10067         (Output_section::Simple_input_section): New class definition.
10068         (Output_section::get_input_sections): Adjust parameter list.
10069         (Output_section::add_input_section_for_script): Same.
10070         (Output_section::save_states, Output_section::restore_states,
10071         Output_section::do_address_and_file_offset_have_reset_values,
10072         (Output_section::Input_section::Input_section): Handle
10073         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10074         Output_relaxed_input_section.
10075         (Output_section::Input_section::is_input_section,
10076         Output_section::Input_section::set_output_section): Handle relaxed
10077         input section.
10078         (Output_section::Input_section::is_relaxed_input_section,
10079         Output_section::Input_section::output_section_data,
10080         Output_section::Input_section::relaxed_input_section): New method
10081         definitions.
10082         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10083         value.
10084         (Output_section::Input_section::u1_): Update comments.
10085         (Output_section::Input_section::u2_): Add new union member poris.
10086         (Output_section::Checkpoint_output_section): New classs definition.
10087         (Output_section::relax_input_section): New method declaration.
10088         (Output_section::checkpoint_): New data member.
10089         (Output_segment): Update comments.
10090         (Output_segment::Output_segment): Un-privatize copy constructor.
10091         (Output_segment::operator=): Un-privatize.
10092         * script-sections.cc (Output_section_element::Input_section_list):
10093         Change element type to Output_section::Simple_input_section.
10094         (Output_section_element_dot_assignment::set_section_addresses):
10095         Register output section data for relaxation clean up.
10096         (Output_data_exression::Output_data_expression): Adjust call to base
10097         constructor to fix data size.
10098         (Output_section_element_data::set_section_addresses): Register
10099         Output_data_expression object for relaxation clean up.
10100         (struct Input_section_info): Replace Relobj pointer and section index
10101         pair with Output_section::Simple_input_section and Convert struct to a
10102         class.
10103         (Input_section_sorter::operator()): Adjust access to
10104         Input_section_info data member to use accessors.
10105         (Output_section_element_input::set_section_addresses): Use layout
10106         parameter.  Adjust code to use Output_section::Simple_input_section
10107         and Input_secction_info classes.  Register filler for relaxation
10108         clean up.
10109         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10110         and section index pair with Output_section::Simple_input_section
10111         class.  Adjust code accordingly.
10112         (Phdrs_element::release_segment): New method definition.
10113         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10114         segment list.
10115         (Script_sections::release_segments): New method definition.
10116         * gold/script-sections.h (Script_sections::release_segments): New
10117         method declaration.
10118         * gold/target.h (Target::may_relax, Target::relax,
10119         Target::do_may_relax, Target::do_relax): New method definitions.
10120
10121 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10122
10123         * arm.cc (has_signed_unsigned_overflow): New function.
10124         (Arm_relocate_functions::abs8): New function.
10125         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10126         (Target_arm::Scan::global): Likewise.
10127         (Target_arm::relocate::relocate): Likewise.
10128         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10129         Likewise.
10130
10131 2009-09-16  Cary Coutant  <ccoutant@google.com>
10132
10133         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10134         * testsuite/Makefile.in: Regenerate.
10135
10136 2009-09-11  Nick Clifton  <nickc@redhat.com>
10137
10138         * po/gold.pot: Updated by the Translation project.
10139
10140 2009-09-08  Cary Coutant  <ccoutant@google.com>
10141
10142         * output.cc (Output_file::open): Add execute permission to empty file.
10143         * testsuite/Makefile.am (permission_test): New test.
10144         * testsuite/Makefile.in: Regenerate.
10145
10146 2009-09-02  Ian Lance Taylor  <iant@google.com>
10147
10148         * output.cc (Output_file::resize): Call map_no_anonymous rather
10149         than map.
10150
10151 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10152
10153         * gold.cc: Include "incremental.h".
10154         (queue_initial_tasks): Call Incremental_checker methods.
10155         * incremental.cc: Include "output.h".
10156         (Incremental_checker::can_incrementally_link_output_file): New
10157         method.
10158         * incremental.h (Incremental_checker): New class.
10159
10160         * output.cc (Output_file::open_for_modification): New method.
10161         (Output_file::map_anonymous): Changed return type to bool.  Record
10162         map in base_ field.
10163         (Output_file::map_no_anonymous): New method, broken out of map.
10164         (Output_file::map): Use map_no_anonymous and map_anonymous.
10165         * output.h (class Output_file): Update declarations.
10166
10167 2009-08-24  Cary Coutant  <ccoutant@google.com>
10168
10169         * options.h (Command_line::Pre_options): New class.
10170         (Command_line::pre_options): New member.
10171         * options.cc (gold::options::ready_to_register): New variable.
10172         (One_option::register_option): Do nothing if not registering options.
10173         Assert if same short option registered twice.
10174         (General_options::General_options): Turn off option registration when
10175         done constructing.
10176         (Command_line::Pre_options::Pre_options): New constructor.
10177
10178 2009-08-24  Cary Coutant  <ccoutant@google.com>
10179
10180         * options.h (General_options::no_keep_memory): Remove incorrect
10181         short option.
10182
10183 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10184
10185         * Makefile.am (am__skiplex, am__skipyacc): New.
10186         * Makefile.in: Regenerate.
10187
10188 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10189
10190         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10191         (INCLUDES): ... this.
10192         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10193         (AM_CPPFLAGS): Renamed from ...
10194         (INCLUDE): ... this.
10195         * Makefile.in, testsuite/Makefile.in: Regenerate.
10196
10197         * Makefile.in: Regenerate.
10198         * aclocal.m4: Likewise.
10199         * config.in: Likewise.
10200         * configure: Likewise.
10201         * testsuite/Makefile.in: Likewise.
10202
10203         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10204         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10205         * Makefile.in: Regenerate.
10206         * testsuite/Makefile.in: Regenerate.
10207
10208 2009-08-19  Cary Coutant  <ccoutant@google.com>
10209
10210         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10211         symbols in shared libraries overridden by hidden or internal symbols
10212         in the main program.
10213
10214 2009-08-19  Chris Demetriou  <cgd@google.com>
10215
10216         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10217         checking source file names in error messages.
10218
10219 2009-08-18  Doug Kwan  <dougkwan@google.com>
10220
10221         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10222         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10223         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10224         an elfcpp::Ehdr as parameter.
10225         * object.cc (Object::set_target): Remove the version that looks up
10226         a target and sets it.
10227         (Sized_relobj::setup): Take a Target object instead of
10228         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10229         (make_elf_sized_object): Find target and ask target to
10230         make an ELF object.
10231         * object.h: (Object::set_target): Remove the version that looks up
10232         a target and sets it.
10233         (Sized_relobj::setup): Take a Target object instead of
10234         an elfcpp:Ehdr as parameter.
10235         * target.cc: Include dynobj.h.
10236         (Target::do_make_elf_object_implementation): New.
10237         (Target::do_make_elf_object): New.
10238         * target.h (Target::make_elf_object): New template declaration.
10239         (Target::do_make_elf_object): New method declarations.
10240         (Target::do_make_elf_object_implementation): New template declaration.
10241
10242 2009-08-14  Ian Lance Taylor  <iant@google.com>
10243
10244         * gold.h (FUNCTION_NAME): Define.
10245         (gold_unreachable): Use FUNCTION_NAME.
10246
10247 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10248
10249         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10250         symbol in the --keep-unique list is not found.
10251
10252 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10253
10254         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10255         been maked as --keep-unique.
10256         (Icf::unfold_section): New function.
10257         * icf.h (Icf::unfold_section): New function.
10258         * options.h (General_options::keep_unique): New option.
10259         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10260         * testsuite/Makefile.in: Regenerate.
10261         * testsuite/icf_keep_unique_test.sh: New file.
10262         * testsuite/icf_keep_unique_test.cc: New file.
10263
10264 2009-08-12  Cary Coutant  <ccoutant@google.com>
10265
10266         PR 10471
10267         * resolve.cc (Symbol_table::resolve): Check for references from
10268         dynamic objects to hidden and internal symbols.
10269         * testsuite/Makefile.am (hidden_test.sh): New test.
10270         * testsuite/Makefile.in: Regenerate.
10271         * testsuite/hidden_test.sh: New script.
10272         * testsuite/hidden_test_1.c: New test source.
10273         * testsuite/hidden_test_main.c: New test source.
10274
10275 2009-08-11  Doug Kwan  <dougkwan@google.com>
10276
10277         * arm.cc: Update comments.
10278         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10279         segment to locate the .ARM.exidx section if present.
10280
10281 2009-08-09  Doug Kwan  <dougkwan@google.com>
10282
10283         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10284         patch.
10285
10286 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10287         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10288         compiler warnings.
10289
10290 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10291
10292         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10293         valid tls_segment only for non-debug-section relocations.
10294         * testsuite/Makefile.am: Add gc_tls_test.
10295         * testsuite/Makefile.in: Regenerate.
10296         * testsuite/gc_tls_test.cc: New file.
10297         * testsuite/gc_tls_test.sh: New file.
10298
10299 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10300
10301         * icf.cc: New file.
10302         * icf.h: New file.
10303         * Makefile.am (CCFILES): Add icf.cc.
10304         (HFILES): Add icf.h
10305         * Makefile.in: Regenerate.
10306         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10307         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10308         section, symbol and addend information for the relocs.
10309         * gold.cc (queue_middle_tasks): Call identical code folding.
10310         * gold.h: Add defines for multimap.
10311         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10312         to the call of finalize_local_symbols.
10313         * main.cc (main): Create object of class Icf.
10314         * object.cc (Sized_relobj::do_layout): Allow this function to be
10315         called twice during icf.
10316         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10317         to sections marked as identical by icf.
10318         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10319         when available.
10320         (Sized_relobj::do_section_entsize): New function.
10321         * object.h (Object::section_entsize): New function.
10322         (Object::do_section_entsize): New pure virtual function.
10323         (Relobj::finalize_local_symbols): Add new parameter.
10324         (Relobj::do_section_entsize): New function.
10325         * options.h (General_options::icf): New option.
10326         (General_options::icf_iterations): New option.
10327         (General_options::print_icf_sections): New option.
10328         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10329         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10330         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10331         icf.
10332         * symtab.cc (Symbol_table::is_section_folded): New function.
10333         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10334         to sections marked as identical by icf.
10335         * symtab.h (Symbol_table::set_icf): New function.
10336         (Symbol_table::icf): New function.
10337         (Symbol_table::is_section_folded): New function.
10338         (Symbol_table::icf_): New data member.
10339         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10340         * testsuite/Makefile.am: Add commands to build icf_test.
10341         * testsuite/Makefile.in: Regenerate.
10342         * testsuite/icf_test.sh: New file.
10343         * testsuite/icf_test.cc: New file.
10344
10345 2009-07-24  Chris Demetriou  <cgd@google.com>
10346
10347         * layout.cc (is_compressible_debug_section): Fix incorrect
10348         comment about compressed section names.
10349
10350 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10351
10352         PR 10419
10353         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10354
10355 2009-07-16  Ian Lance Taylor  <iant@google.com>
10356
10357         PR 10400
10358         * layout.h: #include <map>.
10359         (class Kept_section): Change from struct to class.  Add accessors
10360         and setters.  Add section size to Comdat_group mapping.  Change
10361         Comdat_group to std::map.  Add is_comdat_ field.  Add
10362         linkonce_size field in union.
10363         (class Layout): Update declaration of find_or_add_kept_section.
10364         Don't declare find_kept_object.
10365         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10366         parameter.  Add object, shndx, is_comdat, and is_group_name
10367         parameters.  Change all callers.  Adjust for new Kept_section.
10368         (Layout::find_kept_object): Remove.
10369         * object.cc (Sized_relobj::include_section_group): Update use of
10370         Kept_section.  Rename secnum to shndx.  Only record
10371         Kept_comdat_section if sections are the same size.
10372         (Sized_relobj::include_linkonce_section): Update use of
10373         Kept_section.  Only record Kept_comdat_section if sections are the
10374         same size.  Set size of linkonce section.
10375         (Sized_relobj::map_to_kept_section): Update call to
10376         get_kept_comdat_section.
10377         * object.h (class Sized_relobj): Rename fields in
10378         Kept_comdat_section to drop trailing underscores; change object
10379         field to Relobj*.  Change Kept_comdat_section_table to store
10380         struct rather than pointer.
10381         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10382         Add kept_object and kept_shndx parameters.  Change all callers.
10383         (Sized_relobj::get_kept_comdat_section): Change return type to
10384         bool.  Add kept_object and kept_shndx parameters.  Change all
10385         callers.
10386         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10387         Layout::find_or_add_kept_section.
10388
10389 2009-07-09  Ian Lance Taylor  <iant@google.com>
10390
10391         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10392         Reserve space in the hash table.
10393
10394 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10395
10396         * fileread.cc (File_read::get_mtime): New method.
10397         * fileread.h (Timespec): New structure.
10398         (File_read::get_mtime): New method.
10399         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10400         Renamed from timestamp_nsec.
10401         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10402         Elf_Xword.
10403         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10404         timestamp_nsec.
10405         (Incremental_inputs::report_archive): Save mtime; style fix.
10406         (Incremental_inputs::report_obejct): Save mtime; style fix.
10407         (Incremental_inputs::report_script): Save mtime; style fix.
10408         (Incremental_inputs::finalize_inputs): Style fix.
10409         (Incremental_inputs::finalize): Style fix.
10410         (Incremental_inputs::create_input_section_data): Store inputs
10411         mtime.
10412         * incremental.h (Incremental_inputs::report_script): Add mtime
10413         argument.
10414         (Incremental_inputs::Input_info::Input_info): Intialize only one
10415         union member.
10416         (Incremental_inputs::Input_info::archive): Move to nameless
10417         union.
10418         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10419         (Incremental_inputs::Input_info::script): Move to nameless union.
10420         (Incremental_inputs::mtime): New field.
10421         * script.cc (read_input_script): Pass file mtime to
10422         Incremental_input.
10423         * script.h (Script_info::inputs): Style fix.
10424
10425 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10426
10427         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10428         instead of 32.
10429
10430 2009-06-24  Ian Lance Taylor  <iant@google.com>
10431
10432         PR 10156
10433         * layout.cc (Layout::choose_output_section): If we find an
10434         existing section, update the flags.
10435         (Layout::create_notes): New function, broken out of
10436         Layout::finalize.
10437         (Layout::finalize): Don't create note sections.
10438         (Layout::create_note): Don't crash if linker script discards
10439         section.
10440         (Layout::create_gold_note): Likewise.
10441         (Layout::create_build_id): Likewise.  Don't set
10442         after_input_sections on the section.
10443         (Layout::create_executable_stack_info): Remove target parameter.
10444         Change caller.
10445         * layout.h (class Layout): Declare create_notes.  Update
10446         declaration of create_executable_stack_info.
10447         * gold.cc (queue_middle_tasks): Call create_notes.
10448         * output.cc (Output_section::update_flags_for_input_section): Move
10449         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10450         invalid.
10451         * output.h (Output_data::mark_address_invalid): New function.
10452         (class Output_section): Only declare, not define,
10453         update_flags_for_input_section.  Remove set_flags.
10454
10455 2009-06-24  Ian Lance Taylor  <iant@google.com>
10456
10457         * script-sections.cc (Output_section_definition::
10458         set_section_addresses): Rename shadowing local load_address to
10459         laddr.
10460
10461 2009-06-24  Ian Lance Taylor  <iant@google.com>
10462
10463         PR 10244
10464         * reloc.cc (relocate_sections): Skip empty relocation sections.
10465
10466 2009-06-23  Ian Lance Taylor  <iant@google.com>
10467
10468         PR 10156
10469         * layout.cc (Layout::create_note): Use choose_output_section
10470         rather than make_output_section.
10471
10472 2009-06-23  Ian Lance Taylor  <iant@google.com>
10473
10474         PR 10237
10475         * options.cc (General_options::parse_V): Set printed_version_.
10476         (General_options::General_options): Initialize printed_version_.
10477         * options.h (class General_options): Add printed_version_ field.
10478         * gold.cc (queue_initial_tasks): If there are no input files,
10479         don't give a fatal error if we printed the version information.
10480         (queue_middle_tasks): If using -r with a shared object, give a
10481         fatal error rather than an ordinary error.
10482
10483 2009-06-23  Ian Lance Taylor  <iant@google.com>
10484
10485         PR 10219
10486         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10487         (Layout::make_output_section): Set have_stabstr_section_ if we see
10488         a .stab*str section.
10489         (Layout::finalize): Call link_stabs_sections.
10490         (Layout::link_stabs_sections): New file.
10491         * layout.h (class Layout): Add have_stabstr_section_ field.
10492         Declare link_stabs_sections.
10493
10494 2009-06-23  Doug Kwan  <dougkwan@google.com>
10495
10496         * Makefile.am (libgold_a_LIBADD): New.
10497         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10498         * Makefile.in: Regenerate.
10499         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10500         * configure: Regenerate.
10501         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10502         * fileread.cc: Include sys/state.h
10503         * gold.h: Declare memmem and strndup if found missing.
10504         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10505
10506 2009-06-23  Ian Lance Taylor  <iant@google.com>
10507
10508         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10509         * configure: Rebuild.
10510
10511 2009-06-23  Ian Lance Taylor  <iant@google.com>
10512
10513         PR 10147
10514         * object.cc (Object::section_contents): Don't try to get a view if
10515         the section has length zero.
10516         (Object::handle_gnu_warning_section): If the section is empty, use
10517         the name of the section as the warning.
10518
10519 2009-06-23  Ian Lance Taylor  <iant@google.com>
10520
10521         PR 10133
10522         * stringpool.h (class Stringpool_template): Add optimize_ field.
10523         (Stringpool_template::set_optimize): New function.
10524         * stringpool.cc (Stringpool_template::Stringpool_template):
10525         Initialize optimize_ field.
10526         (Stringpool_template::set_string_offsets): Test local optimize
10527         fild rather than parameter.
10528         * layout.cc (Layout::Layout): Call set_optimize on the section
10529         name stringpool.
10530
10531 2009-06-22  Ian Lance Taylor  <iant@google.com>
10532
10533         PR 10030
10534         * yyscript.y: Parse TARGET.
10535         * script.cc (script_set_target): New function.
10536         * script-c.h (script_set_target): Declare.
10537         * options.cc (General_options::string_to_object_format): Rename
10538         from string_to_object_format in anonymous namespace.  Change
10539         callers.
10540         * options.h (class General_options): Declare
10541         string_to_object_format.
10542
10543 2009-06-22  Ian Lance Taylor  <iant@google.com>
10544
10545         * script-sections.cc (Script_sections::create_segments): Don't put
10546         program headers in a PT_LOAD segment if -n or -N.
10547
10548 2009-06-22  Ian Lance Taylor  <iant@google.com>
10549
10550         PR 10141
10551         * options.h (class General_options): Add -z lazy and -z now.  Sort
10552         -z options into alphabetical order.
10553         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10554
10555 2009-06-21  Ian Lance Taylor  <iant@google.com>
10556
10557         * layout.cc (Layout::make_output_section): Call
10558         Target::new_output_section.
10559         (Layout::attach_allocated_section_to_segment): Put large section
10560         sections in a separate load segment with the large segment flag
10561         set.
10562         (Layout::segment_precedes): Sort large data segments after other
10563         load segments.
10564         (align_file_offset): New static function.
10565         (Layout::set_segment_offsets): Use align_file_offset.
10566         * output.h (class Output_section): Add is_small_section_ and
10567         is_large_section_ fields.
10568         (Output_section::is_small_section): New function.
10569         (Output_section::set_is_small_section):  New function.
10570         (Output_section::is_large_section): New function.
10571         (Output_section::set_is_large_section): New function.
10572         (Output_section::is_large_data_section): New function.
10573         (class Output_segment): Add is_large_data_segment_ field.
10574         (Output_segment::is_large_data_segment): New function.
10575         (Output_segment::set_is_large_data_segment): New function.
10576         * output.cc (Output_section::Output_section): Initialize new
10577         fields.
10578         (Output_segment::Output_segment): Likewise.
10579         (Output_segment::add_output_section): Add assertion that large
10580         data sections always go in large data segments.  Force small data
10581         sections to the end of the list of data sections.  Force small BSS
10582         sections to the start of the list of BSS sections.  For large BSS
10583         sections to the end of the list of BSS sections.
10584         * symtab.h (class Symbol): Declare is_common_shndx.
10585         (Symbol::is_defined): Check Symbol::is_common_shndx.
10586         (Symbol::is_common): Likewise.
10587         (class Symbol_table): Define enum Commons_section_type.  Update
10588         declarations.  Add small_commons_ and large_commons_ fields.
10589         * symtab.cc (Symbol::is_common_shndx): New function.
10590         (Symbol_table::Symbol_table): Initialize new fields.
10591         (Symbol_table::add_from_object): Put small and large common
10592         symbols in the right list.
10593         (Symbol_table::sized_finalized_symbol): Check
10594         Symbol::is_common_shndx.
10595         (Symbol_table::sized_write_globals): Likewise.
10596         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10597         common symbol lists.  Don't call do_allocate_commons_list if the
10598         list is empty.
10599         (Symbol_table::do_allocate_commons_list): Remove is_tls
10600         parameter.  Add comons_section_type parameter.  Change all
10601         callers.  Handle small and large common symbols.
10602         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10603         Symbol::is_common_shndx.
10604         * resolve.cc (symbol_to_bits): Likewise.
10605         * target.h (Target::small_common_shndx): New function.
10606         (Target::small_common_section_flags): New function.
10607         (Target::large_common_shndx): New function.
10608         (Target::large_common_section_flags): New function.
10609         (Target::new_output_section): New function.
10610         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10611         small_common_section_flags, and large_common_section_flags
10612         fields.
10613         (Target::do_new_output_section): New virtual function.
10614         * arm.cc (Target_arm::arm_info): Initialize new fields.
10615         * i386.cc (Target_i386::i386_info): Likewise.
10616         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10617         Likewise.
10618         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10619         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10620         (Target_x86_64::do_new_output_section): New function.
10621         * configure.ac: Define conditional MCMODEL_MEDIUM.
10622         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10623         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10624         (large_LDFLAGS): Define.
10625         * testsuite/large.c: New file.
10626         * testsuite/testfile.cc (Target_test::test_target_info):
10627         Initialize new fields.
10628         * configure, testsuite/Makefile.in: Rebuild.
10629
10630 2009-06-05  Doug Kwan  <dougkwan@google.com>
10631
10632         * Makefile.am (CCFILES): Add target.cc.
10633         * Makefile.in: Regenerate.
10634         * i386.cc (class Target_i386): Define new virtual method to
10635         override do_is_local_label_name in parent.
10636         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10637         local symbols if --discard-locals or -X is given.
10638         * options.h (class General_options): Declare new options
10639         '--discard-locals' and '-X' for discarding locals.
10640         * target.h (class Target): Define new methods is_local_label_name.
10641         Declare new virtual method do_is_local_label_name.
10642         * target.cc: New file.
10643         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10644         (check_SCRIPTS): Add discard_locals_test.sh.
10645         (check_DATA): Add discard_local_tests.syms.
10646         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10647         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10648         * testsuite/Makefile.in: Regenerate.
10649         * testsuite/discard_locals_test.c: New file.
10650         * testsuite/discard_locals_test.sh: Same.
10651
10652 2009-06-05  Doug Kwan  <dougkwan@google.com>
10653
10654         * object.cc (Sized_relobj::Sized_relobj): Initialize
10655         discarded_eh_frame_shndx_ to -1U.
10656         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10657         section.
10658         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10659         a discarded .eh_frame section.
10660         (Sized_relobj::do_finalize_local_symbols): Ditto.
10661         * object.h (class Sized_relobj): Declare new member
10662         discarded_eh_frame_shndx_.
10663         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10664         (local_labels_test.o, local_labels_test): New rules.
10665         * testsuite/Makefile.in: Regenerate.
10666
10667 2009-06-04  Doug Kwan  <dougkwan@google.com>
10668
10669         * layout.cc (Layout::section_name_mapping): Add mapping for
10670         special ARM sections.
10671
10672 2009-06-03  Doug Kwan  <dougkwan@google.com>
10673
10674         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10675         (utils::has_overflow): Same.
10676
10677 2009-06-03  Ian Lance Taylor  <iant@google.com>
10678
10679         * layout.cc (Layout::section_name_mapping): New array, replacing
10680         Layout::linkonce_mapping.
10681         (Layout::section_name_mapping_count): New variable, replacing
10682         Layout::linkonce_mapping_count.
10683         (Layout::linkonce_output_name): Remove.
10684         (Layout::output_section_name): Rewrite.
10685         * layout.h (class Layout): Rename Linkonce_mapping to
10686         Section_name_mapping, linkonce_mapping to section_name_mapping,
10687         linkonce_mapping_count to section_name_mapping_count.  Don't
10688         declare linkonce_output_name.
10689
10690 2009-06-03  Doug Kwan  <dougkwan@google.com>
10691
10692         * gold/arm.cc (namespace utils): New.
10693         (Target_arm::reloc_is_non_pic): Define new method.
10694         (class Arm_relocate_functions): New.
10695         (Target_arm::Relocate::relocate): Handle relocation types used by
10696         Android.
10697
10698 2009-06-03  Ian Lance Taylor  <iant@google.com>
10699
10700         * arm.cc (Target_arm::scan::global): Use || instead of |.
10701
10702 2009-06-02  Doug Kwan  <dougkwan@google.com>
10703
10704         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10705         issued_non_pic_error_.
10706         (class Target_arm::Scan): Declare new method check_non_pic.
10707         Define new method symbol_needs_plt_entry.
10708         Declare new data member issued_non_pic_error_.
10709         (class Target_arm::Relocate): Declare new method
10710         should_apply_static_reloc.
10711         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10712         (Target_arm::Scan::check_non_pic): Define new method.
10713         (Target_arm::Scan::local): Handle a small subset of reloc types used
10714         by Android.
10715         (Target_arm::Scan::local): Same.
10716         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10717
10718 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10719
10720         * incremental.cc (Incremental_inputs::report_command_line): Filter
10721         out --incremental-* options.
10722
10723 2009-05-29  Doug Kwan  <dougkwan@google.com>
10724
10725         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10726         template class.
10727         (class Target_arm): Update comment.
10728         (Target_arm::Target_arm): Initialize new data members GOT_,
10729         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10730         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10731         and Target_arm::rel_dyn_section.
10732         Declare new_enum Target_arm::Got_type.
10733         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10734         and DYNBSS_.
10735         Update commments for member do_dynsym_value.
10736         (Target_arm::got_size, Target_arm::plt_section,
10737         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10738         new methods inside class defintion.
10739         (Target_arm::got_section): Define new method.
10740         (Target_arm::rel_dyn_section): Same.
10741         (Output_data_plt_arm): New template class.
10742         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10743         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10744         (Output_data_plt_arm::add_entry): Same.
10745         (Output_data_plt_arm::first_plt_entry): Define new
10746         static data member for PLT instruction template.
10747         (Output_data_plt_arm::plt_entry): Same.
10748         (Output_data_plt_arm::do_write): Define new method.
10749         (Target_arm::make_plt_entry): Same.
10750         (Target_arm::do_finalize_sections): Same.
10751         (Target_arm::do_dynsym_value): Same.
10752
10753 2009-05-28  Doug Kwan  <dougkwan@google.com>
10754
10755         * Makefile.am (TARGETSOURCES): Add arm.cc.
10756         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10757         * Makefile.in: Regenerate.
10758         * arm.cc: New file.
10759         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10760
10761 2009-05-26  Doug Kwan  <dougkwan@google.com>
10762
10763         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10764         (General_options::check_excluded_libs): Strip off directories in
10765         archive name before matching like GNU ld does.
10766         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10767         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10768         (exclude_libs_test_LDFLAGS): Add linker option
10769         -Wl,--exclude-libs,libexclude_libs_test_3
10770         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10771         an explicit archive without using -l.
10772         (alt/libexclude_libs_test_3.a): New make rule.
10773         * testsuite/Makefile.in: Regenerate.
10774         * testsuite/exclude_libs_test.c : Declare lib3_default().
10775         (main): Call it.
10776         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10777         * exclude_libs_test_3.c: New file.
10778
10779 2009-05-26  Nick Clifton  <nickc@redhat.com>
10780
10781         * po/id.po: New Indonesian translation.
10782         * po/gold.pot: Updated template file.
10783
10784 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10785
10786         * testsuite/Makefile.am: Add -ffunction-sections to compile
10787         gc_comdat_test files.  Add -Wl,--gc-sections to build
10788         gc_comdat_test.
10789         * testsuite/Makefile.in: Regenerate.
10790         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10791
10792 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10793
10794         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10795         kept comdat section was garbage collected.
10796         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10797         * testsuite/Makefile.in: Regenerate.
10798         * testsuite/gc_comdat_test.sh: New file.
10799         * testsuite/gc_comdat_test_1.cc: New file.
10800         * testsuite/gc_comdat_test_2.cc: New file.
10801
10802 2009-05-19  Doug Kwan  <dougkwan@google.com>
10803
10804         * archive.cc (Archive::Archive): Move constructor from archive.h
10805         to here.  Initialize no_export_.
10806         (Archive::get_elf_object_for_member): Set no_export flag of object.
10807         * archive.h (Archive::Archive): Move constructor body to
10808         archive.cc.
10809         (Archive::no_export): New method.
10810         (Archive::no_export_): New field.
10811         * object.h (Object::Object): Initialize no_export_ to false.
10812         (Object::no_export, Object::set_no_export): New methods.
10813         (Object::no_export_): New field.
10814         * options.cc (General_options::parse_exclude_libs): New method.
10815         (General_options::check_excluded_libs) Same.
10816         * options.h (exclude_libs): New option.
10817         (General_options::check_excluded_libs): New method declaration.
10818         (General_options::excluded_libs_): New field.
10819         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10820         default or protected visibility if an object has no-export flag set.
10821         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10822         (check_SCRIPTS): Add exclude_libs_test.sh.
10823         (check_DATA): Add exclude_libs_test.syms.
10824         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10825         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10826         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10827         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10828         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10829         libexclude_libs_test_2.a): New rules.
10830         * testsuite/Makefile.in: Regenerate.
10831         * testsuite/exclude_libs_test.c: New file.
10832         * testsuite/exclude_libs_test.sh: Ditto.
10833         * testsuite/exclude_libs_test_1.c: Ditto.
10834         * testsuite/exclude_libs_test_2.c: Ditto.
10835
10836 2009-05-15  Ian Lance Taylor  <iant@google.com>
10837
10838         * configure.ac: Check for declarations for cases where libiberty.h
10839         checks HAVE_DECL_xxx.
10840         * configure, config.in: Rebuild.
10841
10842 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10843
10844         * gold.h (Incremental_argument_list): Remove (invalid) forward
10845         declaration.
10846         * incremental.cc (Incremental_inputs::report_achive): New method.
10847         (Incremental_inputs::report_object): New method.
10848         (Incremental_inputs::report_script): New method.
10849         (Incremental_inputs::finalize_inputs): New method.
10850         (Incremental_inputs::finalize): Call finalize_inputs().
10851         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10852         Create inputs entries.
10853         * incremental.h (Incremental_input_type): New enum.
10854         (Incremental_inputs::Incremental_input): Initialize new fields.
10855         (Incremental_inputs::report_inputs): New method.
10856         (Incremental_inputs::report_achive): New method.
10857         (Incremental_inputs::report_object): New method.
10858         (Incremental_inputs::report_script): New method.
10859         (Incremental_inputs::finalize_inputs): New method.
10860         (Incremental_inputs::Input_info): New struct.
10861         (Incremental_inputs::Input_info_map): New typedef.
10862         (Incremental_inputs::lock_): New field.
10863         (Incremental_inputs::Inputs_): New field.
10864         (Incremental_inputs::Inputs_map): New field.
10865         * main.cc (main): Call Incremental_input::report_inputs.
10866         * options.h (Input_argument_list): Typedef moved from
10867         Input_arguments.
10868         (Input_file_group::Files): Remove, use ::Input_argument_list.
10869         (Input_file_group::Input_argument_list): Remove, use
10870         ::Input_argument_list.
10871         * plugin.cc (Plugin_manager::add_input_file): Add error in
10872         incremental build.
10873         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10874         functions.
10875         * script.cc (read_input_script): Call
10876         Incremental_input::report_script.
10877         * script.h (Script_info): New class.
10878
10879 2009-04-27  Ian Lance Taylor  <iant@google.com>
10880
10881         * x86_64.cc (do_adjust_output_section): Set entsize to
10882         plt_entry_size.
10883
10884 2009-04-23  Elliott Hughes  <enh@google.com>
10885
10886         * output.cc (Output_file::close): After short writes, continue
10887         writing from the correct offset in the buffer being written.
10888
10889 2009-04-23  Chris Demetriou  <cgd@google.com>
10890
10891         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10892         * configure: Regenerate.
10893         * config.in: Regenerate.
10894         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10895         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10896
10897 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10898
10899         * incremental.cc (Incremental_inputs_header_data): Renamed from
10900         Incremental_input_header_data.
10901         (Incremental_inputs_header_data::data_size): New field.
10902         (Incremental_inputs_header_data::put_input_file_count): Renamed
10903         from input_file_count.
10904         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10905         from command_line_offset.
10906         (Incremental_inputs_header_data::put_reserved): Renamed from
10907         put_reserved.
10908         (Incremental_inputs_entry_data): Renamed from
10909         Incremental_input_entry_data.
10910         (Incremental_inputs_entry_data::data_size): New field.
10911         (Incremental_inputs::report_command_line): New method.
10912         (Incremental_inputs::finalize): New method.
10913         (Incremental_inputs::create_incremental_inputs_data): New method.
10914         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10915         * incremental.h: New file.
10916         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10917         (Layout::finalize): Create incremental inputs section in
10918         incremental builds.
10919         (Layout::create_incremental_info_sections): New method.
10920         * layout.h (Layout::incremental_inputs): New method.
10921         (Layout::create_incremental_info_sections): New method.
10922         (Layout::incremental_inputs_): New field.
10923         * main.cc (main): Notify Incremental_input of the command line.
10924
10925 2009-04-01  Ian Lance Taylor  <iant@google.com>
10926             Mikolaj Zalewski  <mikolajz@google.com>
10927
10928         * gold.h (reserve_unordered_map): Define, three versions, one for
10929         each version of Unordered_map.
10930         * layout.cc (Layout::Layout): Remove options parameter.  Add
10931         number_of_input_files parameter.  Don't initialize options_.
10932         Initialize number_of_input_files_ and resized_signatures_.  Move
10933         sections_are_attached_.
10934         (Layout::layout_group): Reserve space for group_signatures_.
10935         (Layout::find_or_add_kept_section): Change name parameter to be a
10936         reference.  Resize signatures_ map when it gets large enough.
10937         (Layout::layout_eh_frame): Use parameters->options() instead of
10938         this->options_.
10939         (Layout::make_output_section): Likewise.
10940         (Layout::attach_allocated_section_to_segment): Likewise.
10941         (Layout::finalize, Layout::create_executable_stack): Likewise.
10942         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10943         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10944         * layout.h (class Layout): Update declarations.  Remove options_
10945         field.  Add number_of_input_files_ and resized_signatures_
10946         fields.  Move sections_are_attached_ field.
10947         * main.cc (main): Pass number of input files to Layout
10948         constructor.  Don't pass options.
10949
10950 2009-03-30  Ian Lance Taylor  <iant@google.com>
10951
10952         * ffsll.c (ffsll): Correct implementation.
10953
10954 2009-03-27  Ian Lance Taylor  <iant@google.com>
10955
10956         * ffsll.c: New file.
10957         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10958         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10959         * ftruncate.c (ftruncate): Declare before definition.
10960         * mremap.c (mremap): Likewise.
10961         * pread.c (pread): Likewise.
10962         * configure, Makefile.in, config.in: Rebuild.
10963
10964         * mremap.c: New file.
10965         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10966         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10967         (mremap): Declare if HAVE_MREMAP is not defined.
10968         * configure, Makefile.in, config.in: Rebuild.
10969
10970 2009-03-27  Cary Coutant  <ccoutant@google.com>
10971
10972         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10973         position independent.
10974         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10975         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10976
10977 2009-03-24  Cary Coutant  <ccoutant@google.com>
10978
10979         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10980         an executable.
10981         (needs_dynamic_reloc): Likewise.
10982
10983 2009-03-24  Ian Lance Taylor  <iant@google.com>
10984
10985         * yyscript.y (file_cmd): Recognize EXTERN.
10986         (extern_name_list, extern_name_list_body): New nonterminals.
10987         * script.cc (script_add_extern): Define.
10988         * script-c.h (script_add_extern): Declare.
10989
10990 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10991
10992         * object.cc (is_elf_object): Define.
10993         * object.h (is_elf_object): Declare.
10994         * archive.cc (Archive::get_elf_object_for_member): Call
10995         is_elf_object.
10996         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10997
10998 2009-03-24  Elliott Hughes  <enh@google.com>
10999
11000         * output.cc (Output_file::map_anonymous): Define.
11001         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11002         try an anonymous one.  Report the size if the mmap fails.
11003         * output.h (class Output_file): Declare map_anonymous.
11004
11005 2009-03-24  Ian Lance Taylor  <iant@google.com>
11006
11007         * target-select.cc (instantiate_target): Don't acquire the lock if
11008         the instantiated_target_ field has already been set.
11009
11010 2009-03-23  Ian Lance Taylor  <iant@google.com>
11011
11012         * gold-threads.h (class Initialize_lock): Define.
11013         * gold-threads.cc (class Initialize_lock_once): Define.
11014         (initialize_lock_control): New static variable.
11015         (initialize_lock_pointer): New static variable.
11016         (initialize_lock_once): New static function.
11017         (Initialize_lock::Initialize_lock): Define.
11018         (Initialize_lock::initialize): Define.
11019         * target-select.h: Include "gold-threads.h".
11020         (class Target_selector): Add lock_ and initialize_lock_ fields.
11021         Don't define instantiate_target, just declare it.
11022         * target-select.cc (Target_selector::Target_selector): Initialize
11023         new fields.
11024         (Target_selector::instantiate_target): Define.
11025         * descriptors.h: Include "gold-threads.h".
11026         (class Descriptors): Add initialize_lock_ field.
11027         * descriptors.cc (Descriptors::Descriptors): Initialize new
11028         field.
11029         (Descriptors::open): Use initialize_lock_ field
11030         * errors.h (class Errors): Add initialize_lock_ field.
11031         * errors.cc (Errors::Errors): Initialize new field.
11032         (Errors::initialize_lock): Use initialize_lock_ field.
11033         * powerpc.cc (class Target_selector_powerpc): Remove
11034         instantiated_target_ field.  In do_recognize call
11035         instantiate_target rather than do_instantiate_target.  In
11036         do_instantiate_target just allocate a new target.
11037         * sparc.cc (class Target_selector_sparc): Likewise.
11038
11039         * freebsd.h: New file.
11040         * i386.cc: Include "freebsd.h".
11041         (Target_i386): Derive from Target_freebsd rather than
11042         Sized_target.
11043         (Target_selector_i386): Derive from Target_selector_freebsd rather
11044         than Target_selector.
11045         * x86_64.cc: Include "freebsd.h".
11046         (Target_x86_64): Derive from Target_freebsd rather than
11047         Sized_target.
11048         (Target_selector_x86_64): Derive from Target_selector_freebsd
11049         rather than Target_selector.
11050         * target.h (class Target): Add adjust_elf_header and
11051         do_adjust_elf_header.
11052         * output.cc (Output_file_header:: do_sized_write): Call target
11053         adjust_elf_header routine.
11054         * configure.tgt: Set targ_osabi.
11055         * configure.ac: Define GOLD_DEFAULT_OSABI.
11056         * parameters.cc (Parameters::default_target): Pass
11057         GOLD_DEFAULT_OSABI to select_target.
11058         * target-select.h (class Target_selector): Make instantiate_target
11059         protected rather than private.
11060         * Makefile.am (HFILES): Add freebsd.h.
11061         * configure, Makefile.in, config.in: Rebuild.
11062
11063         * merge.cc (do_add_input_section): Correct pend value.  Change
11064         message about last entry not being null terminated from error to
11065         warning.
11066
11067 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11068
11069         * incremental.cc: New file.
11070         * Makefile.am (CCFILES): Add incremental.cc.
11071         * Makefile.in: Rebuild.
11072
11073 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11074
11075         * layout.cc (Layout::output_section_name): Preserve names
11076         of '.note.' sections.
11077
11078 2009-03-19  Ian Lance Taylor  <iant@google.com>
11079
11080         * descriptors.cc (Descriptors::open): Check that the options are
11081         valid before using them.
11082
11083 2009-03-18  Ian Lance Taylor  <iant@google.com>
11084
11085         * script-sections.h: Include <list>.
11086         (class Script_sections): Change Sections_elements from std::vector
11087         to std::list.  Typedef public Elements_iterator.  Add
11088         orphan_section_placement_, data_segment_align_start_, and
11089         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11090         field.
11091         * script-sections.cc (class Orphan_section_placement): New class.
11092         (class Sections_element): Add virtual functions is_relro and
11093         orphan_section_init.  Remove virtual function place_orphan_here.
11094         (class Output_section_definition): Add is_relro and
11095         orphan_section_init.  Remove place_orphan_here.
11096         (class Orphan_output_section): Likewise.
11097         (Script_sections::Script_sections): Update for field changes.
11098         (Script_sections::data_segment_align): Set saw_data_segment_align_
11099         and data_segment_align_start_, not data_segment_align_index.
11100         (Script_sections::data_segment_relro_end): Check
11101         saw_data_segment_align_.  Use data_segment_align_start_ rather
11102         than data_segment_align_index_.
11103         (Script_sections::place_orphan): Rewrite to use
11104         Orphan_section_placement.
11105
11106 2009-03-17  Ian Lance Taylor  <iant@google.com>
11107
11108         * archive.cc (Archive::add_symbols): Check for a version attached
11109         to the symbol name in the archive map.
11110         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11111         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11112         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11113         (ver_test_11.a): New target.
11114         * testsuite/Makefile.in: Rebuild.
11115
11116         * configure.ac: Check for chsize and posix_fallocate.  Replace
11117         ftruncate.
11118         * ftruncate.c: New file, from gnulib.
11119         * output.cc (posix_fallocate): Define dummy version if not
11120         HAVE_POSIX_FALLOCATE.
11121         (Output_file::map): Call posix_fallocate rather than lseek and
11122         write.
11123         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11124         * configure, Makefile.in, config.in: Rebuild.
11125
11126 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11127
11128         * layout.h (Layout::create_note): Add section_name parameter.
11129         * layout.cc (Layout::create_note): Likewise.
11130         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11131
11132 2009-03-17  Ian Lance Taylor  <iant@google.com>
11133
11134         * descriptors.cc: Include "options.h".
11135         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11136         (Descriptors::open): Always use O_CLOEXEC when opening a new
11137         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11138         then set FD_CLOEXEC.
11139
11140         * sparc.cc (class Target_sparc): Add has_got_section.
11141         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11142         make sure we have a GOT section.
11143
11144         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11145         (Target_sparc::Scan::local): Likewise.
11146         (Target_sparc::Scan::global): Likewise.
11147         (Target_sparc::Relocate::relocate): Likewise.
11148         (Target_sparc::Relocate::relocate_tls): Likewise.
11149
11150         * symtab.cc (Symbol_table::define_default_version): New function,
11151         broken out of add_from_object.
11152         (Symbol_table::add_from_object): Call define_default_version.
11153         (Symbol_table::define_special_symbol): Add resolve_oldsym
11154         parameter.  Change all callers.  If the version for a symbol comes
11155         from a version script, resolve it with the symbol with the same
11156         name with no version.  Also add the symbol without a version if
11157         appropriate.
11158         (do_define_in_output_data): If resolving with oldsym, don't delete
11159         sym.
11160         (do_define_in_output_segment): Likewise.
11161         (do_define_as_constant): Likewise.
11162         * symtab.h (class Symbol_table): Update declarations.
11163
11164 2009-03-13  Ian Lance Taylor  <iant@google.com>
11165
11166         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11167         (Read_symbols::requeue): New function.
11168         (Read_symbols::do_read_symbols): If make_elf_object fails because
11169         the target type is not configured, and the file was searched for,
11170         issue a warning and retry with the next directory.
11171         (Add_symbols::run): If the file has an incompatible format, and
11172         it was searched for, requeue the Read_symbols task.  On error,
11173         release the object.
11174         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11175         dirindex parameter to constructor.  Change all callers.  Declare
11176         incompatible_warning and requeue.
11177         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11178         input_argument_ and input_group_ fields.  Add them to
11179         constructor.  Change all callers.
11180         (class Read_script): Add dirindex_ field.  Add it to constructor.
11181         Change all callers.
11182         * archive.cc (Archive::setup): Remove input_objects parameter.
11183         Change all callers.
11184         (Archive::get_file_and_offset): Likewise.
11185         (Archive::read_all_symbols): Likewise.
11186         (Archive::read_symbols): Likewise.
11187         (Archive::get_elf_object_for_member): Remove input_objects
11188         parameter.  Add punconfigured parameter.  Change all callers.
11189         (Archive::add_symbols): Change return type to bool.  Check return
11190         value of include_member.
11191         (Archive::include_all_members): Likewise.
11192         (Archive::include_member): Change return type to bool.  Return
11193         false if first included object has incompatible target.  Set
11194         included_member_ field.
11195         (Add_archive_symbols::run): If add_symbols returns false, requeue
11196         Read_symbols task.
11197         * archive.h (class Archive): Add included_member_ field.
11198         Initialize it in constructor.  Add input_file and searched_for
11199         methods.  Update declarations.
11200         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11201         input_argument_ fields.  Add them to constructor.  Change all
11202         callers.
11203         * script.cc: Include "target-select.h".
11204         (class Parser_closure): Add skip_on_incompatible_target_ and
11205         found_incompatible_target_ fields.  Add
11206         skip_on_incompatible_target parameter to constructor.  Change all
11207         callers.  Add methods skip_on_incompatible_target,
11208         clear_skip_on_incompatible_target, found_incompatible_target, and
11209         set_found_incompatible_target.
11210         (read_input_script): Add dirindex parameter.  Change all callers.
11211         If parser finds an incompatible target, requeue Read_symbols
11212         task.
11213         (script_set_symbol): Clear skip_on_incompatible_target in
11214         closure.
11215         (script_add_assertion, script_parse_option): Likewise.
11216         (script_start_sections, script_add_phdr): Likewise.
11217         (script_check_output_format): New function.
11218         * script.h (read_input_script): Update declaration.
11219         * script-c.h (script_check_output_format): Declare.
11220         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11221         (ignore_cmd): Remove OUTPUT_FORMAT.
11222         * fileread.cc (Input_file::Input_file): Add explicit this.
11223         (Input_file::will_search_for): New function.
11224         (Input_file::open): Add pindex parameter.  Change all callers.
11225         * fileread.h (class Input_file): Add input_file_argument method.
11226         Declare will_search_for.  Update declarations.
11227         * object.cc (make_elf_object): Add punconfigured parameter.
11228         Change all callers.
11229         * object.h (class Object): Make input_file public.  Add
11230         searched_for method.
11231         (make_elf_object): Update declaration.
11232         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11233         restart search.
11234         * dirsearch.h (class Dirsearch): Update declaration.
11235         * options.h (class General_options): Add --warn-search-mismatch.
11236         * parameters.cc (Parameters::is_compatible_target): New function.
11237         * parameters.h (class Parameters): Declare is_compatible_target.
11238         * workqueue.cc (Workqueue::add_blocker): New function.
11239         * workqueue.h (class Workqueue): Declare add_blocker.
11240
11241         * fileread.cc (Input_file::open): Remove options parameter.
11242         Change all callers.
11243         (Input_file::open_binary): Likewise.
11244         * script.cc (read_input_script): Likewise.
11245         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11246         options parameter from constructor.  Change all callers.
11247         (class Read_script): Likewise.
11248         * fileread.h (class Input_file): Update declarations.
11249         * script.h (read_input_script): Update declaration.
11250
11251 2009-03-10  Nick Clifton  <nickc@redhat.com>
11252
11253         * po/es.po: New Spanish translation.
11254
11255 2009-03-06  Cary Coutant  <ccoutant@google.com>
11256
11257         * options.cc (parse_short_option): Keep dash_z from registering itself.
11258
11259 2009-03-03  Ian Lance Taylor  <iant@google.com>
11260
11261         PR 9918
11262         * target-reloc.h (relocate_section): Pass output_section to
11263         relocate.
11264         * i386.cc (Target_i386::should_apply_static_reloc): Add
11265         output_section parameter.  Change all callers.
11266         (Target_i386::Relocate::relocate): Add output_section parameter.
11267         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11268         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11269         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11270         * testsuite/two_file_shared.sh: New script.
11271         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11272         (check_DATA): Add two_file_shared.dbg.
11273         (two_file_shared.dbg): New target.
11274         * testsuite/Makefile.in: Rebuild.
11275
11276 2009-03-01  Ian Lance Taylor  <iant@google.com>
11277
11278         * configure.ac: Check for byteswap.h.
11279         * configure: Rebuild.
11280         * config.in: Rebuild.
11281
11282 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11283
11284         * layout.cc (Layout::find_or_add_kept_section): New function.
11285         (Layout::add_comdat): Removed.
11286         * layout.h (struct Kept_section): Move out of class Layout.
11287         Remove trailing underscores from field names.  Add group_sections
11288         field.  Rename group_ field to is_group.  Change all uses.
11289         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11290         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11291         comdat_groups_ field.
11292         (Sized_relobj::include_section_group): Use
11293         find_or_add_kept_section and Kept_section::group_sections.
11294         (Sized_relobj::include_linkonce_section): Likewise.
11295         * object.cc (class Sized_relobj): Don't define Comdat_group or
11296         Comdat_group_table.  Remove find_comdat_group and
11297         add_comdat_group.  Remove comdat_groups_ field.
11298         * plugin.cc (include_comdat_group): Use
11299         Layout::find_or_add_kept_section.
11300
11301 2009-02-28  Ian Lance Taylor  <iant@google.com>
11302
11303         * README: --gc-sections and map files are now supported.  Document
11304         some build requirements.
11305
11306         PR 6992
11307         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11308         relocatable link set the value of the section symbol to zero.
11309         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11310         relocatable link don't include the section address in the local
11311         symbol value.
11312
11313 2009-02-27  Ian Lance Taylor  <iant@google.com>
11314
11315         PR 6811
11316         * options.h (class Search_directory): Add is_system_directory.
11317         (class General_options): Declare is_in_system_directory.
11318         * options.cc (get_relative_sysroot): Make static.
11319         (get_default_sysroot): Make static.
11320         (General_optoins::is_in_system_directory): New function.
11321         * fileread.cc (Input_file::is_in_system_directory): New function.
11322         * fileread.h (class Input_file): Declare is_in_system_directory.
11323         * object.h (class Object): Add is_in_system_directory.
11324         (class Input_objects): Remove system_library_directory_ field.
11325         * object.cc (Input_objects::add_object): Don't set
11326         system_library_directory_.
11327         (input_objects::found_in_system_library_directory): Remove.
11328         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11329         parameter.  Change all callers.
11330         (Symbol_table::sized_write_globals): Likewise.
11331         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11332         Call Object::is_in_system_directory.
11333         * symtab.h (class Symbol_table): Update declarations.
11334
11335         PR 5990
11336         * descriptors.h (Open_descriptor): Add is_on_stack field.
11337         * descriptors.cc (Descriptors::open): If the descriptor is on the
11338         top of the stack, remove it.  Initialize is_on_stack field.
11339         (Descriptors::release): Only add pod to stack if it is not on the
11340         stack already.
11341         (Descriptors::close_some_descriptor): Clear stack_next and
11342         is_on_stack fields.
11343
11344         PR 7091
11345         * output.cc (Output_section::find_starting_output_address): Rename
11346         from starting_output_address; add PADDR parameter; change return
11347         type.
11348         * output.h (class Output_section): Declare
11349         find_starting_output_address instead of starting_output_address.
11350         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11351         section symbol for which we can't find a merge section.
11352
11353         PR 9836
11354         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11355         hidden or internal, force the symbol to be local.
11356         * resolve.cc (Symbol::override_visibility): Define.
11357         (Symbol::override_base): Use override_visibility.
11358         (Symbol_table::resolve): Likewise.
11359         (Symbol::override_base_with_special): Likewise.
11360         (Symbol_table::override_with_special): If the visibility is hidden
11361         or internal, force the symbol to be local.
11362         * symtab.h (class Symbol): Add set_visibility and
11363         override_visibility.
11364         * testsuite/ver_test_1.sh: New file.
11365         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11366         (check_DATA): Add ver_test_1.syms.
11367         (ver_test_1.syms): New target.
11368         * testsuite/Makefile.in: Rebuild.
11369
11370 2009-02-25  Cary Coutant  <ccoutant@google.com>
11371
11372         * layout.cc (Layout::choose_output_section): Don't rename sections
11373         when using a linker script that has a SECTIONS clause.
11374         * Makefile.in: Regenerate.
11375
11376         * testsuite/Makefile.am (script_test_5.sh): New test case.
11377         * testsuite/Makefile.in: Regenerate.
11378         * testsuite/script_test_5.cc: New file.
11379         * testsuite/script_test_5.sh: New file.
11380         * testsuite/script_test_5.t: New file.
11381
11382 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11383
11384         * archive.cc (Archive::include_member): Update calls to add_symbols.
11385         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11386         the Layout argument.
11387         * dynobj.h (do_add_symbols): Add the Layout argument.
11388         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11389         Layout argument.
11390         * object.h (Object::add_symbols): Add the Layout argument.
11391         (Object::do_add_symbols): Add the Layout argument.
11392         (Sized_relobj::do_add_symbols): Add the Layout argument.
11393         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11394         Unify the two versions.
11395         (Add_plugin_symbols): Remove.
11396         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11397         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11398         (Add_plugin_symbols): Remove.
11399         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11400         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11401         (Add_symbols::run): Make it work with Pulginobj.
11402
11403 2009-02-06  Ian Lance Taylor  <iant@google.com>
11404
11405         * object.cc (Sized_relobj::do_layout): Make info message start
11406         with lower case letter.
11407
11408 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11409
11410         * binary.cc: Fix file comment.
11411
11412         * options.h (enum Incremental_disposition): Define.
11413         (class General_options): Add new options: --incremental,
11414         --incremental_changed, --incremental_unchanged,
11415         --incremental_unknown.  Add incremental_disposition_ and
11416         implicit_incremental_ fields.
11417         (General_options::incremental_disposition): New function.
11418         (class Position_dependent_options): Add incremental_disposition
11419         option.
11420         (Position_dependent_options::copy_from_options): Set incremental
11421         dispositions.
11422         * options.cc (General_options::parse_incremental_changed): New
11423         function.
11424         (General_options::parse_incremental_unchanged): New function.
11425         (General_options::parse_incremental_unknown): New function.
11426         (General_options::General_options): Initialize new fields
11427         incremental_disposition_ and implicit_incremental_.
11428         (General_options::finalize): Check for uasge of --incremental-*
11429         without --incremental.
11430
11431 2009-02-06  Chris Demetriou  <cgd@google.com>
11432
11433         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11434         pointer and to report location as the file name associated with
11435         the symbol.
11436         (gold_undefined_symbol_at_location): New function to replace the
11437         old gold_undefined_symbol functionality.
11438         * target-reloc.h (relocate_section): Update to use
11439         gold_undefined_symbol_at_location.
11440         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11441         Call gold_undefined_symbol function rather than gold_error.
11442         * errors.h (Errors::undefined_symbol): Take location as a
11443         string, rather than calculating it from a relocation.
11444         * errors.cc (Errors::fatal): Print "fatal error:" before the
11445         formatted message.
11446         (Errors::error, Errors::error_at_location): Print "error: "
11447         before the formatted message.
11448         (Errors::undefined_symbol): Take location as a string, rather
11449         than calculating it from a relocation.
11450         (gold_undefined_symbol_at_location): New function akin to
11451         old gold_undefined_symbol, calculates location from relocation.
11452         (gold_undefined_symbol): Change to take only a Symbol pointer
11453         and to report location as the file name associated with the symbol.
11454         * testsuite/debug_msg.sh: Update for changed error messages.
11455         * testsuite/undef_symbol.sh: Likewise.
11456
11457 2009-02-04  Duncan Sands  <baldrick@free.fr>
11458
11459         PR 9812
11460         * reduced_debug_output.h
11461         (Output_reduced_debug_abbrev_section::failed): Use format for
11462         gold_warning.
11463         (Output_reduced_debug_info_section::faild): Likewise.
11464
11465 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11466
11467         * script.cc (Lazy_demangler): New class.
11468         (Version_script_info::get_symbol_version_helper): Demangle a
11469         symbol only once.
11470
11471 2009-01-29  Cary Coutant  <ccoutant@google.com>
11472
11473         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11474         to __tls_get_addr.
11475         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11476
11477 2009-01-28  Ian Lance Taylor  <iant@google.com>
11478
11479         * version.cc (version_string): Bump to 1.9.
11480
11481         * gold.h: Include <cstring> and <stdint.h>.
11482         * version.cc: Include <cstdio>.
11483         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11484         warning.
11485         * reduced_debug_output.cc (insert_into_vector): Rename from
11486         Insert_into_vector; change all callers.  Use Swap_unaligned to
11487         avoid aliasing issue; remove union since it is unnecessary.
11488
11489 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11490
11491         * Makefile.am (CCFILES): Add gc.cc.
11492         (HFILES): Add gc.h.
11493         * Makefile.in: Regenerate.
11494         * gold.cc (Gc_runner): New class.
11495         (queue_initial_tasks): Call garbage collection related tasks
11496         when corresponding options are invoked.
11497         (queue_middle_gc_tasks): New function.
11498         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11499         processed early before laying out sections during garbage collection.
11500         * gold.h (queue_middle_gc_tasks): New function.
11501         (is_prefix_of): Move from "layout.cc".
11502         * i386.cc (Target_i386::gc_process_relocs): New function.
11503         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11504         * main.cc (main): Create object of class "Garbage_collection".
11505         * object.cc (Relobj::copy_symbols_data): New function.
11506         (Relobj::is_section_name_included): New function.
11507         (Sized_relobj::do_layout): Allow this function to be called twice
11508         during garbage collection and defer layout of section during the
11509         first call.
11510         * object.h (Relobj::get_symbols_data): New function.
11511         (Relobj::is_section_name_included): New function.
11512         (Relobj::copy_symbols_data): New function.
11513         (Relobj::set_symbols_data): New function.
11514         (Relobj::get_relocs_data): New function.
11515         (Relobj::set_relocs_data): New function.
11516         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11517         (Relobj::gc_process_relocs): New function.
11518         (Relobj::do_gc_process_relocs): New pure virtual function.
11519         (Relobj::sd_): New data member.
11520         (Sized_relobj::is_output_section_offset_invalid): New function.
11521         (Sized_relobj::do_gc_process_relocs): New function.
11522         * options.h (General_options::gc_sections): Modify to not be a no-op.
11523         (General_options::print_gc_sections): New option.
11524         * plugin.cc (Plugin_finish::run): Remove function call to
11525         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11526         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11527         * reloc.cc (Read_relocs::run): Add task to process relocs and
11528         determine unreferenced sections when doing garbage collection.
11529         (Gc_process_relocs): New class.
11530         (Sized_relobj::do_gc_process_relocs): New function.
11531         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11532         sections that are garbage collected.
11533         * reloc.h (Gc_process_relocs): New class.
11534         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11535         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11536         symbols whose corresponding sections are garbage collected.
11537         (Symbol_table::Symbol_table): Add new parameter for the garbage
11538         collection object.
11539         (Symbol_table::gc_mark_undef_symbols): New function.
11540         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11541         (Symbol_table::gc_mark_dyn_syms): New function.
11542         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11543         as garbage.
11544         (Symbol_table::add_from_object): Likewise.
11545         (Symbol_table::add_from_relobj): When building shared objects, do not
11546         treat externally visible symbols as garbage.
11547         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11548         table information for static and relocatable links.
11549         * symtab.h (Symbol_table::set_gc): New function.
11550         (Symbol_table::gc): New function.
11551         (Symbol_table::gc_mark_undef_symbols): New function.
11552         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11553         (Symbol_table::gc_mark_dyn_syms): New function.
11554         (Symbol_table::gc_): New data member.
11555         * target.h (Sized_target::gc_process_relocs): New pure virtual
11556         function.
11557         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11558         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11559
11560 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11561
11562         * options.h (General_options::gc_sections): Define as a no-op for now.
11563         (General_options::no_keep_memory): Ditto.
11564         (General_options::Bshareable): Define.
11565         * options.cc (General_options::finalize): Honor -Bshareable.
11566
11567 2009-01-20  Andreas Schwab  <schwab@suse.de>
11568
11569         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11570         read the value in the contents, since we don't use it.  Use the
11571         template endianness when writing.
11572         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11573
11574 2009-01-19  Andreas Schwab  <schwab@suse.de>
11575
11576         * configure.tgt (powerpc64-*): Fix targ_obj.
11577
11578 2009-01-15  Ian Lance Taylor  <iant@google.com>
11579
11580         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11581         local symbols when stripping all symbols.
11582
11583 2009-01-14  Cary Coutant  <ccoutant@google.com>
11584
11585         * output.cc (Output_reloc): Add explicit instantiations.
11586
11587 2009-01-14  Cary Coutant  <ccoutant@google.com>
11588
11589         * archive.cc (Archive::get_elf_object_for_member): Remove call
11590         to File_read::claim_for_plugin.
11591         * descriptors.cc (Descriptors::open): Remove reference to
11592         is_claimed.
11593         (Descriptors::claim_for_plugin): Remove.
11594         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11595         (Descriptors::is_claimed): Remove.
11596         (claim_descriptor_for_plugin): Remove.
11597         * fileread.cc (File_read::claim_for_plugin): Remove.
11598         * fileread.h (File_read::claim_for_plugin): Remove.
11599         (File_read::descriptor): Reopen descriptor if necessary.
11600         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11601         (Plugin_manager::all_symbols_read): Add task parameter. Change
11602         all callers.
11603         (Plugin_manager::get_input_file): New function.
11604         (Plugin_manager::release_input_file): New function.
11605         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11606         corresponding data member.
11607         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11608         and pass to base constructor. Change all callers.
11609         (get_input_file, release_input_file): New functions.
11610         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11611         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11612         (Plugin_manager::all_symbols_read): Add task parameter.
11613         (Plugin_manager::get_input_file): New function.
11614         (Plugin_manager::release_input_file): New function.
11615         (Plugin_manager::task_): New data member.
11616         (Pluginobj::Pluginobj): Add filesize parameter.
11617         (Pluginobj::filename): New function.
11618         (Pluginobj::descriptor): New function.
11619         (Pluginobj::filesize): New function.
11620         (Pluginobj::filesize_): New data member.
11621         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11622         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11623         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11624
11625         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11626         with archive libraries.
11627         * testsuite/Makefile.in: Regenerate.
11628         * testsuite/plugin_test.c (struct sym_info): New type.
11629         (get_input_file, release_input_file): New static variables.
11630         (onload): Capture new transfer vector entries.
11631         (claim_file_hook): Stop reading at end of file according to filesize.
11632         Factor out parsing of readelf output into separate function.
11633         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11634         APIs and get the source file name from the symbol table.  Convert
11635         source file name to corresponding object file name.  Print info
11636         message when adding new input files.
11637         (parse_readelf_line): New function.
11638         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11639         * testsuite/plugin_test_2.sh: Likewise.
11640         * testsuite/plugin_test_3.sh: Likewise.
11641         * testsuite/plugin_test_4.sh: New test case.
11642
11643 2009-01-07  Ian Lance Taylor  <iant@google.com>
11644
11645         * version.cc (version_string): Bump to 1.8.
11646
11647 2008-12-23  Cary Coutant  <ccoutant@google.com>
11648
11649         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11650         * plugin.cc (Plugin_manager::finish): Rename as
11651         layout_deferred_objects.  Move cleanup to separate function.
11652         (Plugin_manager::cleanup): New function.
11653         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11654         separately.
11655         * plugin.h (Plugin_manager::finish): Rename as
11656         layout_deferred_objects.
11657         (Plugin_manager::cleanup): New function.
11658         (Plugin_manager::cleanup_done): New field.
11659
11660 2008-12-23  Cary Coutant  <ccoutant@google.com>
11661
11662         * plugin.cc (is_visible_from_outside): New function.
11663         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11664         so we don't return "IR only" status for exported symbols or -r links.
11665
11666         * testsuite/Makefile.am (plugin_test_3): New test case.
11667         * testsuite/Makefile.in: Regenerate.
11668         * testsuite/plugin_test_3.sh: New file.
11669
11670 2008-12-22  Cary Coutant  <ccoutant@google.com>
11671
11672         * object.cc (Sized_relobj::layout_section): New function.
11673         (Sized_relobj::do_layout): Defer layout of input sections until after
11674         plugin has provided replacement files.
11675         (Sized_relobj::do_layout_deferred_sections): New function.
11676         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11677         (Relobj::layout_deferred_sections): New function.
11678         (Relobj::do_layout_deferred_sections): New function.
11679         (Sized_relobj::do_layout_deferred_sections): New function.
11680         (Sized_relobj::layout_section): New function.
11681         (Sized_relobj::Deferred_layout): New structure.
11682         (Sized_relobj::deferred_layout_): New field.
11683         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11684         Change all callers.  Layout deferred sections.
11685         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11686         references.
11687         (Plugin_hook::run): Move code from do_plugin_hook inline.
11688         (Plugin_hook::do_plugin_hook): Remove.
11689         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11690         (Plugin_manager::finish): Renamed, was cleanup.
11691         (Plugin_manager::should_defer_layout): New function.
11692         (Plugin_manager::add_deferred_layout_object): New function.
11693         (Plugin_manager::Deferred_layout_list): New type.
11694         (Plugin_manager::deferred_layout_objects_): New field.
11695         (Plugin_hook::do_plugin_hook): Remove.
11696
11697 2008-12-17  Ian Lance Taylor  <iant@google.com>
11698
11699         * options.h (class General_options): Add --no case for
11700         --export-dynamic.
11701
11702 2008-12-16  Cary Coutant  <ccoutant@google.com>
11703
11704         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11705         vector.
11706         (Plugin_manager::claim_file): Create plugin object even if
11707         plugin did not call the add_symbols callback.
11708         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11709         asking for more symbols than were added.
11710         * testsuite/Makefile.am (plugin_test_1): Add test case with
11711         no global symbols.
11712         (empty.syms): New target.
11713         * testsuite/Makefile.in: Regenerate.
11714         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11715         message. Don't call add_symbols if no globals.
11716         (all_symbols_read_hook): Don't provide replacement for empty
11717         claimed file.
11718
11719 2008-12-12  Ian Lance Taylor  <iant@google.com>
11720
11721         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11722         r_type == 0 for a local symbol with r_sym == 0.
11723         (scan_relocatable_relocs): Pass r_sym to
11724         local_non_section_strategy.
11725         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11726         r_sym parameter.
11727
11728         * configure.ac: Update test for TLS descriptors: they are
11729         supported as of glibc 2.9.
11730         * configure: Rebuild.
11731
11732 2008-12-11  Ian Lance Taylor  <iant@google.com>
11733
11734         PR 7091
11735         * target-reloc.h (Default_scan_relocatable_relocs): For each
11736         function, map r_type == 0 to RELOC_DISCARD.
11737
11738 2008-12-10  Cary Coutant  <ccoutant@google.com>
11739
11740         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11741         object to override a kept COMDAT group from a plugin object.
11742
11743 2008-12-09  Ian Lance Taylor  <iant@google.com>
11744
11745         PR 7088
11746         * yyscript.y (file_cmd): Handle INPUT.
11747
11748         * testsuite/initpri1.c: Change all declarations to be full
11749         prototypes by adding void, to avoid compiler warnings.
11750
11751 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11752
11753         * options.cc (General_options::parse_plugin_opt): New.
11754         (General_options::add_plugin): The argument now is just the filename.
11755         (General_options::add_plugin_option): New.
11756         * options.h (plugin_opt): New.
11757         (add_plugin): Change argument name.
11758         (add_plugin_option): New.
11759         * plugin.cc (Plugin::load): Don't parse the plugin option.
11760         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11761         (Plugin::add_option): New.
11762         (Plugin::args_): Change type.
11763         (Plugin::filename_): New.
11764         (Plugin_manager::add_plugin_option): New.
11765         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11766         * testsuite/Makefile.in: Regenerate.
11767
11768 2008-12-05  Cary Coutant  <ccoutant@google.com>
11769
11770         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11771         Handle --strip-lto-sections option.
11772         * options.h (strip_lto_sections): New option.
11773
11774 2008-12-01  Cary Coutant  <ccoutant@google.com>
11775
11776         * plugin.cc (ld_plugin_message): Change format parameter to const.
11777         Fix mismatch between new[] and delete.
11778
11779 2008-11-14  Cary Coutant  <ccoutant@google.com>
11780
11781         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11782         instead of -1U.
11783
11784 2008-11-05  Craig Silverstein  <csilvers@google.com>
11785
11786         * options.cc (General_options::parse_dynamic_list): New function.
11787         * options.h (General_options): New flags dynamic_list,
11788         dynamic_list_data, dynamic_list_cpp_new, and
11789         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11790         (General_options::in_dynamic_list): New function.
11791         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11792         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11793         (Lex::can_continue_name): Likewise.
11794         (yylex): Likewise.
11795         (read_script_file): New parameter script_options.
11796         (read_dynamic_list): New function.
11797         (Script_options::define_dynamic_list): New function.
11798         (dynamic_list_keyword_parsecodes): New variable.
11799         (dynamic_list_keywords): New variable.
11800         * script.h (Script_options::define_dynamic_list): New function
11801         prototype.
11802         (read_dynamic_list): New function prototype.
11803         * symtab.cc (strprefix): New macro.
11804         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11805         dynamic_list_data, dynamic_list_cpp_new, and
11806         dynamic_list_cpp_typeinfo.
11807         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11808         (dynamic_list_expr): New rule.
11809         (dynamic_list_nodes): Likewise.
11810         (dynamic_list_node): Likewise.
11811         * testsuite/Makefile.am (dynamic_list): New test.
11812         * testsuite/Makefile.in: Regenerated.
11813         * testsuite/dynamic_list.t: New file.
11814         * testsuite/dynamic_list.sh: New file.
11815
11816 2008-11-05  Craig Silverstein  <csilvers@google.com>
11817
11818         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11819         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11820         (t11_last): Likewise.
11821         * testsuite/ver_test_6.c (main): Likewise.
11822
11823 2008-10-07  Cary Coutant  <ccoutant@google.com>
11824
11825         * options.c (General_options::finalize): Add check for -static and
11826         -shared.
11827         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11828         is not empty.
11829
11830 2008-10-02  Cary Coutant  <ccoutant@google.com>
11831
11832         * plugin.cc (make_sized_plugin_object): Fix conditional
11833         compilation to work when not all targets are enabled.
11834
11835 2008-09-29  Cary Coutant  <ccoutant@google.com>
11836
11837         * archive.cc (Archive::get_file_and_offset): Use filename instead
11838         of name to get library path.
11839         (Archive::include_member): Unlock external member of a thin archive.
11840
11841         * testsuite/Makefile.am (TEST_AR): New variable.
11842         (thin_archive_test_1): New test.
11843         (thin_archive_test_2): New test.
11844         * testsuite/Makefile.in: Regenerate.
11845         * testsuite/thin_archive_main.cc: New file.
11846         * testsuite/thin_archive_test_1.cc: New file.
11847         * testsuite/thin_archive_test_2.cc: New file.
11848         * testsuite/thin_archive_test_3.cc: New file.
11849         * testsuite/thin_archive_test_4.cc: New file.
11850
11851 2008-09-29  Cary Coutant  <ccoutant@google.com>
11852
11853         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11854         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11855         instead of -1U.
11856         (Sized_relobj::do_finalize_local_symbols): Likewise.
11857         (Sized_relobj::map_to_kept_section): Likewise.
11858         * object.h (Sized_relobj::invalid_address): New constant.
11859         (Sized_relobj::do_output_section_offset): Check for invalid_address
11860         and return -1ULL.
11861         * output.cc (Output_reloc::local_section_offset): Use constant
11862         invalid_address instead of -1U.
11863         (Output_reloc::get_address): Likewise.
11864         (Output_section::output_address): Change -1U to -1ULL.
11865         * output.h (Output_reloc::invalid_address): New constant.
11866         * reloc.cc (Sized_relobj::write_sections): Use constant
11867         invalid_address instead of -1U.
11868         (Sized_relobj::relocate_sections): Likewise.
11869         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11870         values for merge sections.
11871         * target-reloc.h (relocate_for_relocatable): Use constant
11872         invalid_address instead of -1U.
11873
11874 2008-09-19  Cary Coutant  <ccoutant@google.com>
11875
11876         Add plugin functionality for link-time optimization (LTO).
11877         * configure.ac (plugins): Add --enable-plugins option.
11878         * configure: Regenerate.
11879         * config.in: Regenerate.
11880         * Makefile.am (LIBDL): New variable.
11881         (CCFILES): Add plugin.cc.
11882         (HFILES): Add plugin.h.
11883         (ldadd_var): Add LIBDL.
11884         * Makefile.in: Regenerate.
11885
11886         * archive.cc: Include "plugin.h".
11887         (Archive::setup): Don't preread archive symbols when using a plugin.
11888         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11889         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11890         files.
11891         (Archive::include_member): Add symbols from plugin objects.
11892         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11893         * descriptors.cc (Descriptors::open): Check for file descriptors
11894         abandoned by plugins.
11895         (Descriptors::claim_for_plugin): New function.
11896         * descriptors.h (Descriptors::claim_for_plugin): New function.
11897         (Open_descriptor::is_claimed): New field.
11898         (claim_descriptor_for_plugin): New function.
11899         * fileread.cc (File_read::claim_for_plugin): New function.
11900         * fileread.h (File_read::claim_for_plugin): New function.
11901         (File_read::descriptor): New function.
11902         * gold.cc: Include "plugin.h".
11903         (queue_initial_tasks): Add task to call plugin hooks for generating
11904         new object files.
11905         * main.cc: Include "plugin.h".
11906         (main): Load plugin libraries.
11907         * object.h (Pluginobj): Declare.
11908         (Object::pluginobj): New function.
11909         (Object::do_pluginobj): New function.
11910         (Object::set_target): New function.
11911         * options.cc: Include "plugin.h".
11912         (General_options::parse_plugin): New function.
11913         (General_options::General_options): Initialize plugins_ field.
11914         (General_options::add_plugin): New function.
11915         * options.h (Plugin_manager): Declare.
11916         (General_options): Add --plugin option.
11917         (General_options::has_plugins): New function.
11918         (General_options::plugins): New function.
11919         (General_options::add_plugin): New function.
11920         (General_options::plugins_): New field.
11921         * plugin.cc: New file.
11922         * plugin.h: New file.
11923         * readsyms.cc: Include "plugin.h".
11924         (Read_symbols::do_read_symbols): Check for archive before checking
11925         for ELF file.  Call plugin hooks to claim files.
11926         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11927         from a real object file; force override when processing replacement
11928         files.
11929         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11930         (Symbol::init_base_object): Likewise.
11931         (Symbol::init_base_output_data): Likewise.
11932         (Symbol::init_base_output_segment): Likewise.
11933         (Symbol::init_base_constant): Likewise.
11934         (Symbol::init_base_undefined): Likewise.
11935         (Symbol::output_section): Assert that object is not a plugin.
11936         (Symbol_table::add_from_pluginobj): New function.
11937         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11938         undefined.
11939         (Symbol_table::sized_write_globals): Likewise.
11940         (Symbol_table::add_from_pluginobj): Instantiate template.
11941         * symtab.h (Sized_pluginobj): Declare.
11942         (Symbol::in_real_elf): New function.
11943         (Symbol::set_in_real_elf): New function.
11944         (Symbol::in_real_elf_): New field.
11945         (Symbol_table::add_from_pluginobj): New function.
11946
11947         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11948         (LIBDL): New variable.
11949         (LDADD): Add LIBDL.
11950         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11951         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11952         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11953         (MOSTLYCLEANFILES): Likewise.
11954         * testsuite/Makefile.in: Regenerate.
11955         * testsuite/plugin_test.c: New file.
11956         * testsuite/plugin_test_1.sh: New file.
11957         * testsuite/plugin_test_2.sh: New file.
11958
11959 2008-09-16  Ian Lance Taylor  <iant@google.com>
11960
11961         * target-reloc.h (relocate_section): Check whether a symbol is
11962         defined by the ABI before reporting an undefined symbol error.
11963         * target.h (Target::is_defined_by_abi): Make parameter const.
11964         (Target::do_is_defined_by_abi): Likewise.
11965         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11966         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11967         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11968         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11969         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11970         * testsuite/Makefile.in: Rebuild.
11971
11972         * fileread.cc (make_view): Add casts to avoid warning.
11973
11974 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11975
11976         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11977         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11978
11979 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11980
11981         * options.h (General_options::output_is_executable): New.
11982         (General_options::output_is_pie): New.
11983         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11984         for shared libraries.
11985         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11986
11987 2008-09-11  Chris Demetriou  <cgd@google.com>
11988
11989         * options.h (origin): New -z option.
11990         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11991         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11992         in DT_FLAGS_1.
11993
11994 2008-09-05  Cary Coutant  <ccoutant@google.com>
11995
11996         * fileread.cc (File_read::make_view): Add check for attempt to map
11997         beyond end of file.
11998
11999 2008-09-05  Cary Coutant  <ccoutant@google.com>
12000
12001         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12002         explicit instantiations.
12003
12004 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12005
12006         PR gold/6858
12007         * options.cc (General_options::finalize): Allow undefined symbols
12008         in shlibs if linking -shared.
12009
12010         PR gold/6859
12011         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12012         symbols as not needing a dynsym entry.
12013
12014 2008-08-20  Craig Silverstein  <csilvers@google.com>
12015
12016         * fileread.cc (File_read::open): Do not lock the file unless it
12017         was successfully opened.
12018
12019 2008-08-14  Cary Coutant  <ccoutant@google.com>
12020
12021         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12022         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12023         * testsuite/tls_test.cc (struct int128): 128-bit struct
12024         for testing TLS relocs with non-zero addend.
12025         (v12): New TLS variable.
12026         (t12): New test.
12027         (t_last): Add check for v12.
12028         * testsuite/tls_test.h (t12): New function.
12029         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12030
12031 2008-08-13  Ian Lance Taylor  <iant@google.com>
12032
12033         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12034         set tls_segment_ or relro_segment_.
12035         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12036         when appropriate.
12037         * output.h (Output_section::clear_is_relro): New function.
12038         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12039         sections specially even when output_data_ is empty.
12040         (Output_segment::maximum_alignment): When first section is relro,
12041         only force alignment for PT_LOAD segments.
12042         * script.cc (script_data_segment_align): New function.
12043         (script_data_segment_relro_end): New function.
12044         * script-c.h (script_data_segment_align): Declare.
12045         (script_data_segment_relro_end): Declare.
12046         * script-sections.h (class Script_sections): Declare
12047         data_segment_align and data_segment_relro_end.  Add fields
12048         segment_align_index_ and saw_relro_end_.
12049         * script-sections.cc (class Sections_element): Add set_is_relro
12050         virtual function.  Add new bool* parameter to place_orphan_here.
12051         Add get_output_section virtual function.
12052         (class Output_section_definition): Add set_is_relro.  Add new
12053         bool* parameter to place_orphan_here.  Add get_output_section.
12054         Add is_relro_ field.
12055         (Output_section_definition::Output_section_definition): Initialize
12056         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12057         and is_relro_ fields.
12058         (Output_section_definition::place_orphan_here): Add is_relro
12059         parameter.
12060         (Output_section_definition::set_section_addresses): Set relro for
12061         output section.
12062         (Output_section_definition::alternate_constraint): Likewise.
12063         (class Orphan_output_section): Add new bool* parameter to
12064         place_orphan_here.  Add get_output_section.
12065         (Orphan_output_section::place_orphan_here): Add is_relro
12066         parameter.
12067         (Script_sections::Script_sections): Initialize
12068         data_segment_align_index_ and saw_relro_end_.
12069         (Script_sections::data_segment_align): New function.
12070         (Script_sections::data_segment_relro_end): New function.
12071         (Script_sections::place_orphan): Set or clear is_relro.
12072         (Script_sections::set_section_addresses): Force alignment of first
12073         TLS section.
12074         * yyscript.y (exp): Call script_data_segment_align and
12075         script_data_segment_relro_end.
12076         * testsuite/relro_script_test.t: New file.
12077         * testsuite/relro_test.cc (using_script): Declare.
12078         (t1, t2): Test using_script.
12079         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12080         (relro_script_test_SOURCES): Define.
12081         (relro_script_test_DEPENDENCIES): Define.
12082         (relro_script_test_LDFLAGS): Define.
12083         (relro_script_test_LDADD): Define.
12084         (relro_script_test.so): New target.
12085         * testsuite/Makefile.in: Rebuild.
12086
12087 2008-08-06  Cary Coutant <ccoutant@google.com>
12088
12089         * archive.cc (Archive::total_archives, Archive::total_members)
12090         (Archive::total_members_loaded): New variables.
12091         (Archive::setup): Add parameter.  Add option to preread
12092         archive symbols.
12093         (Archive::read_armap): Add counter.
12094         (Archive::get_file_and_offset): New function.
12095         (Archive::get_elf_object_for_member): New function.
12096         (Archive::read_all_symbols): New function.
12097         (Archive::read_symbols): New function.
12098         (Archive::add_symbols): Add counters.
12099         (Archive::include_all_members): Use armap to find members if it's
12100         already built.
12101         (Archive::include_member): Skip reading symbols if already read.
12102         Factored code into Archive::get_file_and_offset and
12103         Archive::get_elf_object_for_member.  Changed call to
12104         Mapfile::report_include_archive_member.
12105         (Archive::print_stats): New function.
12106         * archive.h: Declare Object and Read_symbols_data classes.
12107         (Archive::Archive): Add initializers for new members.
12108         (Archive::setup): Add parameter.
12109         (Archive::print_stats): New function.
12110         (Archive::total_archives, Archive::total_members)
12111         (Archive::total_members_loaded): New variables.
12112         (Archive::get_file_and_offset): New function.
12113         (Archive::get_elf_object_for_member): New function.
12114         (Archive::read_all_symbols): New function.
12115         (Archive::read_symbols): New function.
12116         (Archive::Archive_member): New class.
12117         (Archive::members_): New member.
12118         (Archive::num_members_): New member.
12119         * main.cc: Include archive.h.
12120         (main): Call Archive::print_stats.
12121         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12122         archive parameter; member_name is now the fully-decorated name.
12123         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12124         * options.h: (General_options): Add --preread-archive-symbols option.
12125         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12126         Archive::setup.
12127
12128 2008-08-04  Ian Lance Taylor  <iant@google.com>
12129
12130         * symtab.h (Symbol::use_plt_offset): New function.
12131         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12132         * powerpc.cc (Relocate::relocate): Likewise.
12133         * sparc.cc (Relocate::relocate): Likewise.
12134         * x86_64.cc (Relocate::relocate): Likewise.
12135         * testsuite/weak_plt.sh: New test.
12136         * testsuite/weak_plt_main.cc: New test.
12137         * testsuite/weak_plt_shared.cc: New test.
12138         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12139         (check_PROGRAMS): Add weak_plt.
12140         (check_DATA): Add weak_plt_shared.so.
12141         (weak_plt_main_pic.o, weak_plt): New targets.
12142         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12143         * testsuite/Makefile.in: Rebuild.
12144
12145         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12146         gcctestdir/ld.
12147         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12148         * testsuite/Makefile.in: Rebuild.
12149
12150 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12151
12152         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12153         * Makefile.in: Regenerate.
12154         * po/POTFILES.in: Regenerate.
12155
12156 2008-07-29  Ian Lance Taylor  <iant@google.com>
12157
12158         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12159         symbols before other symbols.
12160         * testsuite/script_test_2.cc (test_addr): Declare.
12161         (test_addr_alias): Declare.
12162         (main): Check that test_addr and test_addr_alias have the right
12163         values.
12164         * testsuite/script_test_2.t: Define test_addr_alias and
12165         test_addr.
12166
12167 2008-07-24  Ian Lance Taylor  <iant@google.com>
12168
12169         PR 5990
12170         * descriptors.cc: New file.
12171         * descriptors.h: New file.
12172         * gold-threads.h (class Hold_optional_lock): New class.
12173         * fileread.cc: Include "descriptors.h".
12174         (File_read::~File_read): Release descriptor rather than closing
12175         it.
12176         (File_read::open) [file]: Call open_descriptor rather than open.
12177         Set is_descriptor_opened_.
12178         (File_read::open) [memory]: Assert that descriptor is not open.
12179         (File_read::reopen_descriptor): New function.
12180         (File_read::release): Release descriptor.
12181         (File_read::do_read): Make non-const.  Reopen descriptor.
12182         (File_read::read): Make non-const.
12183         (File_read::make_view): Reopen descriptor.
12184         (File_read::do_readv): Likewise.
12185         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12186         Update declarations.
12187         * layout.cc: Include "descriptors.h".
12188         (Layout::create_build_id): Use open_descriptor rather than open.
12189         * output.cc: Include "descriptors.h".
12190         (Output_file::open): Use open_descriptor rather than open.
12191         * archive.cc (Archive::const_iterator): Change Archive to be
12192         non-const.
12193         (Archive::begin, Archive::end): Make non-const.
12194         (Archive::count_members): Likewise.
12195         * archive.h (class Archive): Update declarations.
12196         * object.h (Object::read): Make non-const.
12197         * Makefile.am (CCFILES): Add descriptors.cc.
12198         (HFILES): Add descriptors.h.
12199         * Makefile.in: Rebuild.
12200
12201         PR 6716
12202         * gold.h: Always include <clocale>.  Add Solaris workarounds
12203         following code in binutils/sysdep.h.
12204
12205         PR 6048
12206         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12207         this->eh_frame_hdr_ is NULL before using it.
12208
12209         * dynobj.cc (Versions::Versions): Update comment.
12210
12211         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12212         the base version name.
12213
12214         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12215         array size plus one.
12216         (Stringpool_template::set_string_offsets): Subtract one from key
12217         before using it as an array index.
12218         (Stringpool_template::get_offset_with_length): Likewise.
12219         (Stringpool_template::write_to_buffer): Likewise.
12220         * stringpool.h (Stringpool_template::get_offset_from_key):
12221         Likewise.
12222
12223 2008-07-23  Ian Lance Taylor  <iant@google.com>
12224
12225         PR 6658
12226         * object.h (Merged_symbol_value::value): Do our best to handle a
12227         negative addend.
12228
12229         PR 6647
12230         * script.cc (Version_script_info::get_versions): Don't add empty
12231         version tag to return value.
12232         (Version_script_info::get_symbol_version_helper): Change return
12233         type to bool.  Add pversion parameter.  Change all callers.
12234         (script_register_vers_node): Don't require a non-NULL tag.
12235         * script.h (class Version_script_info): Update declarations.
12236         (Version_script_info::get_symbol_version): Change return type to
12237         bool.  Add version parameter.  Change all callers.
12238         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12239         handling.  Handle an empty version from a version script.
12240         (Symbol_table::define_special_symbol): Likewise.
12241         * testsuite/ver_test_10.script: New file.
12242         * testsuite/ver_test_10.sh: New file.
12243         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12244         (check_DATA): Add ver_test_10.syms.
12245         (ver_test_10.syms, ver_test_10.so): New target.
12246         * testsuite/Makefile.in: Rebuild.
12247
12248 2008-07-23  Simon Baldwin  <simonb@google.com>
12249
12250         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12251         to zero for undefined symbols from dynamic libraries.
12252
12253 2008-07-23  Ian Lance Taylor  <iant@google.com>
12254
12255         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12256         Change all callers.
12257         * symtab.h (class Symbol_table): Update declaration.
12258         * testsuite/ver_test_9.cc: New file.
12259         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12260         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12261         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12262         (ver_test_9.so, ver_test_9.o): New targets.
12263         * testsuite/Makefile.in: Rebuild.
12264
12265 2008-07-22  Ian Lance Taylor  <iant@google.com>
12266
12267         * options.h (class General_options): Define --check-sections.
12268         * layout.cc (Layout::set_segment_offsets): Handle
12269         --check-sections.
12270
12271         * options.h (class General_options): Define -n/--nmagic and
12272         -N/--omagic.
12273         * options.cc (General_options::finalize): For -n/--nmagic or
12274         -N/--omagic, set -static.
12275         * layout.cc (Layout::attach_allocated_section_to_segment): If
12276         -N/--omagic, don't put read-only and read-write sections in
12277         different segments.
12278         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12279         finding a read-only segment.
12280         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12281         don't set the minimum segment alignment to the common page size,
12282         and don't set the file offset to the address modulo the page size.
12283         * script-sections.cc (Script_sections::create_segments): If
12284         -n/--omagic, don't put read-only and read-write sections in
12285         different segments.
12286
12287         * cref.cc: New file.
12288         * cref.h: New file.
12289         * options.h (class General_options): Add --print-symbol-counts.
12290         * main.cc (main): Issue defined symbol report if requested.
12291         * archive.cc (Archive::interpret_header): Make into a const member
12292         function.
12293         (Archive::add_symbols): Call Input_objects::archive_start and
12294         archive_stop.
12295         (Archive::const_iterator): Define new class.
12296         (Archive::begin, Archive::end): New functions.
12297         (Archive::include_all_members): Rewrite to use iterator.
12298         (Archive::count_members): New function.
12299         * archive.h (class Archive): Update declarations.
12300         (Archive::filename): New function.
12301         * object.cc: Include "cref.h".
12302         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12303         (Sized_relobj::do_get_global_symbol_counts): New function.
12304         (Input_objects::add_object): Add object to cross-referencer.
12305         (Input_objects::archive_start): New function.
12306         (Input_objects::archive_stop): New function.
12307         (Input_objects::print_symbol_counts): New function.
12308         * object.h: Declare Cref and Archive.
12309         (Object::get_global_symbol_counts): New function.
12310         (Object::do_get_global_symbol_counts): New pure virtual function.
12311         (class Sized_relobj): Add defined_count_ field.  Update
12312         declarations.
12313         (class Input_objects): Add cref_ field.  Update constructor.
12314         Update declarations.
12315         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12316         defined_count_.
12317         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12318         symbol counts.
12319         (Sized_dynobj::do_get_global_symbol_counts): New function.
12320         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12321         defined_count_.  Update declarations.  Define Symbols typedef.
12322         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12323         parameter.  Change all callers.
12324         (Symbol_table::add_from_dynobj): Add sympointers and defined
12325         parameters.  Change all callers.
12326         * symtab.h (class Symbol_table): Update declarations.
12327         * Makefile.am (CCFILES): Add cref.cc.
12328         (HFILES): Add cref.h.
12329         * Makefile.in: Rebuild.
12330
12331 2008-07-22  Simon Baldwin  <simonb@google.com>
12332
12333         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12334         to zero when writing undefined symbols.
12335
12336 2008-07-22  Ian Lance Taylor  <iant@google.com>
12337
12338         * output.cc (Output_section::add_input_section): Don't try to
12339         merge empty merge sections.
12340
12341 2008-07-21  Craig Silverstein  <csilvers@google.com>
12342
12343         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12344         Include symbol version in error message.
12345
12346 2008-07-20  Chris Demetriou  <cgd@google.com>
12347
12348         * configure.ac (gold_cv_c_random_seed): New configured variable.
12349         (RANDOM_SEED_CFLAGS): New substituted variable.
12350         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12351         * configure: Rebuild.
12352         * Makefile.in: Likewise.
12353         * testsuite/Makefile.in: Likewise.
12354
12355 2008-07-18  Ian Lance Taylor  <iant@google.com>
12356
12357         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12358         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12359         * testsuite/ver_test_main.cc (main): Call t4.
12360         (t4, t4_2a): Define.
12361         * testsuite/ver_test_2.cc (t4_2): Define.
12362         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12363         * testsuite/ver_test_4.cc (t4_2a): Define.
12364         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12365         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12366
12367 2008-07-17  Ian Lance Taylor  <iant@google.com>
12368
12369         * dynobj.cc (Versions::add_def): If we give an error about a
12370         missing version, go ahead and create the version anyhow.
12371
12372 2008-07-10  Ian Lance Taylor  <iant@google.com>
12373
12374         Handle output sections with more than 0x7fffffff bytes.
12375         * object.h (class Relobj): Change map_to_output_ to
12376         output_sections_, and just keep a section pointer.  Change all
12377         uses.  Move comdat group support to Sized_relobj.
12378         (Relobj::is_section_specially_mapped): Remove.
12379         (Relobj::output_section): Remove poff parameter.  Change all
12380         callers.
12381         (Relobj::output_section_offset): New function.
12382         (Relobj::set_section_offset): Rewrite.
12383         (Relobj::map_to_output): Remove.
12384         (Relobj::output_sections): New function.
12385         (Relobj::do_output_section_offset): New pure virtual function.
12386         (Relobj::do_set_section_offset): Likewise.
12387         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12388         group support from Relobj.  Update declarations.
12389         (Sized_relobj::get_output_section_offset): New function.
12390         (Sized_relobj::do_output_section_offset): New function.
12391         (Sized_relobj::do_set_section_offset): New function.
12392         * object.cc (Relobj::output_section_address): Remove.
12393         (Sized_relobj::Sized_relobj): Initialize new fields.
12394         (Sized_relobj::include_section_group): Cast find_kept_object to
12395         Sized_relobj.
12396         (Sized_relobj::include_linkonce_section): Likewise.
12397         (Sized_relobj::do_layout): Use separate arrays for output section
12398         and output offset.
12399         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12400         output_sections.
12401         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12402         output_sections and section_offsets.
12403         (Sized_relobj::write_local_symbols): Likewise.
12404         (map_to_kept_section): Compute output address directly.
12405         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12406         output_sections and section_offsets.
12407         (Sized_relobj::write_sections): Likewise.
12408         (Sized_relobj::relocate_sections): Likewise.
12409         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12410         * output.h (class Output_reloc): Update declarations.  Change
12411         u2_.relobj to Sized_relobj*.
12412         (class Output_data_reloc): Change add functions to use
12413         Sized_relobj*.
12414         * output.cc (Output_reloc::Output_reloc): Change relobj to
12415         Sized_relobj*.
12416         (Output_reloc::local_section_offset): Change return type to
12417         Elf_Addr.  Use get_output_section_offset.
12418         (Output_reloc::get_address): Likewise.
12419         (Output_section::is_input_address_mapped): Don't call
12420         is_section_specially_mapped.
12421         (Output_section::output_offset): Likewise.
12422         (Output_section::output_address): Likewise.
12423         (Output_section::starting_output_address): Likewise.
12424         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12425         parameter to Sized_relobj*.
12426         (Copy_relocs::need_copy_reloc): Likewise.
12427         (Copy_relocs::save): Likewise.
12428         * copy-relocs.h (class Copy_relocs): Update declarations.
12429         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12430         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12431         * target-reloc.h (relocate_for_relocatable): Change
12432         offset_in_output_section type to Elf_Addr.  Change code that uses
12433         it as well.
12434         * layout.cc (Layout::layout): Always set *off.
12435         * mapfile.cc (Mapfile::print_input_section): Use
12436         output_section_offset.
12437         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12438         Sized_relobj*.
12439         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12440         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12441         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12442
12443 2008-07-03  Ian Lance Taylor  <iant@google.com>
12444
12445         * layout.cc (Layout::include_section): Do not discard unrecognized
12446         SHT_STRTAB sections.
12447
12448 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12449
12450         * script.cc (Lex::can_continue_name): Make '?' allowable in
12451         version-script names.
12452         * testsuite/version_script.map: Change glob pattern to use '?'
12453
12454 2008-06-30  Manish Singh  <yosh@gimp.org>
12455
12456         PR 6585
12457         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12458         Correct typo.
12459
12460 2008-06-30  Ian Lance Taylor  <iant@google.com>
12461
12462         PR 6660
12463         PR 6682
12464         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12465         versions]: Don't try to read the value in the contents, since we
12466         don't use it.  Use the template endianness when writing.
12467
12468 2008-06-25  Cary Coutant  <ccoutant@google.com>
12469
12470         * fileread.cc (File_read::make_view): Assert on zero-length view.
12471         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12472         symbol table when there are no symbols to read.
12473
12474 2008-06-23  Craig Silverstein  <csilvers@google.com>
12475
12476         * version.cc (version_string): Bump to 1.7
12477
12478 2008-06-18  Craig Silverstein  <csilvers@google.com>
12479
12480         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12481         constant 0xFFFF to type Valtype.
12482         (Powerpc_relocate_functions::rel16_ha): Likewise.
12483
12484 2008-06-17  Ian Lance Taylor  <iant@google.com>
12485
12486         * output.h (Output_section::Input_section): Initialize p2align_ to
12487         zero for Output_section_data constructors.
12488         (Output_section::Input_section::addralign): If not an input
12489         section, return the alignment of the Output_section_data.
12490         * testsuite/copy_test.cc: New file.
12491         * testsuite/copy_test_1.cc: New file.
12492         * testsuite/copy_test_2.cc: New file.
12493         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12494         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12495         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12496         (copy_test_1_pic.o, copy_test_1.so): New targets.
12497         (copy_test_2_pic.o, copy_test_2.so): New targets.
12498         * testsuite/Makefile.in: Rebuild.
12499
12500         * script-sections.cc (Script_sections::place_orphan): Initialize
12501         local variable exact.
12502
12503 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12504
12505         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12506
12507 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12508             David S. Miller  <davem@davemloft.net>
12509
12510         * powerpc.cc: New file.
12511         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12512         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12513         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12514         * Makefile.in: Rebuild.
12515
12516 2008-06-09  Ian Lance Taylor  <iant@google.com>
12517
12518         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12519         <exception>.
12520         (throwing, orig_terminate): New static variables.
12521         (terminate_handler): New static function.
12522         (t2): Set terminate handler.
12523
12524 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12525
12526         PR 6584
12527         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12528         alignment.
12529
12530 2008-05-30  Cary Coutant  <ccoutant@google.com>
12531
12532         * archive.cc (Archive::include_all_members) Correct to step
12533         over symbol table and extended name table in thin archives.
12534
12535 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12536
12537         PR 6407
12538         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12539         calculation.
12540
12541 2008-05-28  Caleb Howe  <cshowe@google.com>
12542
12543         * reduced_debug_output.cc: New file.
12544         * reduced_debug_output.h: New file.
12545         * options.h (class General_options): Add --strip-debug-non-line.
12546         * options.cc (General_options::finalize): Add strip_debug_non_line
12547         to the strip heirarchy.
12548         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12549         fields.
12550         * layout.cc: Include "reduced_debug_output.h".
12551         (Layout::Layout): Initialize new fields.
12552         (line_only_debug_sections): New static array.
12553         (is_lines_only_debug_sections): New static inline function.
12554         (Layout::include_section): Handle --strip-debug-non-line.
12555         (Layout::make_output_section): If --strip-debug-non-line, build
12556         new output sections for .debug_abbrev and .debug_info.
12557         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12558         gold.  Warn about possible overflow.
12559         (read_signed_LEB_128): Likewise.
12560         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12561         (read_signed_LEB_128): Declare.
12562         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12563         (HFILES): Add reduced_debug_output.h.
12564         * Makefile.in: Rebuild.
12565
12566 2008-05-21  Ian Lance Taylor  <iant@google.com>
12567
12568         * mapfile.cc: New file.
12569         * mapfile.h: New file.
12570         * options.h (class General_options): Add -M/--print-map and -Map.
12571         * options.cc (General_options::finalize): Make -M equivalent to
12572         -Map -.
12573         * main.cc: Include <cstdio> and "mapfile.h".
12574         (main): Open mapfile if requested.
12575         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12576         constructor.  Change caller.
12577         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12578         (queue_middle_tasks): Likewise.
12579         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12580         declarations.
12581         * archive.cc: Include "mapfile.h".
12582         (Archive::add_symbols): Add mapfile parameter.  Change all
12583         callers.  Pass mapfile, symbol, and reason to include_member.
12584         (Archive::include_all_members): Add mapfile parameter.  Change all
12585         callers.
12586         (Archive::include_member): Add mapfile, sym, and why parameters.
12587         Change all callers.  Report inclusion to map file.
12588         * archive.h: Include "fileread.h".
12589         (class Archive): Update declarations.
12590         (Archive::file): New const method.
12591         (class Add_archive_symbols): Add mapfile_ field.  Update
12592         constructor.  Change all callers.
12593         * readsyms.h (class Read_symbols): Likewise.
12594         (class Finish_group): Likewise.
12595         (class Read_script): Likewise.
12596         * common.cc: Include "mapfile.h".
12597         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12598         all callers.
12599         (Symbol_table::do_allocate_commons): Likewise.
12600         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12601         symbol allocation to mapfile.
12602         * common.h (class Allocate_commons_task): Add mapfile_ field.
12603         Update constructor.  Change all callers.
12604         * symtab.h (class Symbol_table): Update declarations.
12605         * layout.cc: Include "mapfile.h".
12606         (Layout_task_runner::run): Print information to mapfile.
12607         (Layout::create_gold_note): Change Output_data_fixed_space to
12608         Output_data_zero_fill.
12609         (Layout::create_build_id): Likewise.
12610         (Layout::print_to_mapfile): New function.
12611         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12612         constructor.  Change caller.
12613         (class Layout): Declare print_to_mapfile.
12614         * output.cc (Output_section::Input_section::print_to_mapfile): New
12615         function.
12616         (Output_section::add_input_section): If producing a map, always
12617         add to input_sections_ list.
12618         (Output_section::do_print_to_mapfile): New function.
12619         (Output_segment::print_sections_to_mapfile): New function.
12620         (Output_segment::print_section_list_to_mapfile): New function.
12621         * output.h: Include "mapfile.h".
12622         (Output_data::print_to_mapfile): New function.
12623         (Output_data::do_print_to_mapfile): New virtual function.
12624         (Output_segment_headers::do_print_to_mapfile): New function.
12625         (Output_file_header::do_print_to_mapfile): New function.
12626         (Output_data_const::do_print_to_mapfile): New function.
12627         (class Output_data_const_buffer): Add map_name_ field.  Update
12628         constructor.  Change all callers.  Add do_print_to_mapfile
12629         function.
12630         (class Output_data_fixed_space): Likewise.
12631         (class Output_data_space): Likewise.
12632         (class Output_data_zero_fill): New class.
12633         (Output_data_strtab::do_print_to_mapfile): New function.
12634         (Output_data_reloc_base::do_print_to_mapfile): New function.
12635         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12636         (Output_data_group::do_print_to_mapfile): New function.
12637         (Output_data_got::do_print_to_mapfile): New function.
12638         (Output_data_dynamic::do_print_to_mapfile): New function.
12639         (Output_symtab_xindex::do_print_to_mapfile): New function.
12640         (class Output_section): Declare do_print_to_mapflie.  Declare
12641         print_to_mapfile in Input_section.
12642         (class Output_segment): Declare new functions.
12643         * object.h (Sized_relobj::symbol_count): New function.
12644         * script-sections.cc
12645         (Output_section_element_dot_assignment::set_section_addresses):
12646         Change Output_data_fixed_space to Output_data_zero_fill.
12647         (Output_data_expression::do_print_to_mapfile): New function.
12648         * script.cc (read_input_script): Add mapfile parameter.  Change
12649         all callers.
12650         * script.h (read_input_script): Update declaration.
12651         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12652         (Eh_frame::do_print_to_mapfile): New function.
12653         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12654         (Output_merge_string::do_print_to_mapfile): New function.
12655         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12656         function.
12657         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12658         function.
12659         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12660         function.
12661         * Makefile.am (CCFILES): Add mapfile.cc.
12662         (HFILES): Add mapfile.h.
12663         * Makefile.in: Rebuild.
12664
12665 2008-05-19  Ian Lance Taylor  <iant@google.com>
12666
12667         * options.h (class General_options): Add -z relro.
12668         * layout.cc (Layout::Layout): Initialize relro_segment_.
12669         (Layout::add_output_section_data): Return the output section.
12670         (Layout::make_output_section): Rcognize relro sections and mark
12671         them appropriately.
12672         (Layout::attach_allocated_section_to_segment): Put relro sections
12673         in a PT_GNU_RELRO segment.
12674         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12675         section as relro.
12676         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12677         PT_TLS segments.
12678         (Layout::linkonce_mapping): Map d.rel.ro.local to
12679         .data.rel.ro.local.
12680         (Layout::output_section_name): Us .data.rel.ro.local for any
12681         section which begins with that.
12682         * layout.h (class Layout): Update add_output_section_data
12683         declaration.  Add relro_segment_ field.
12684         * output.cc (Output_section::Output_section): Initialize is_relro_
12685         and is_relro_local_ fields.
12686         (Output_segment::add_output_section): Group relro sections.
12687         (Output_segment::is_first_section_relro): New function.
12688         (Output_segment::maximum_alignment): If there is a relro section,
12689         align the segment to the common page size.
12690         (Output_segment::set_section_addresses): Track whether we are
12691         looking at relro sections.  If the last section is a relro
12692         section, align to the common page size.
12693         (Output_segment::set_section_list_addresses): Add in_relro
12694         parameter.  Change all callers.  Align to the page size when
12695         moving from relro to non-relro section.
12696         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12697         segment.
12698         * output.h (class Output_section): Add is_relro_ and
12699         is_relro_local_ fields.
12700         (Output_section::is_relro): New function.
12701         (Output_section::set_is_relro): New function.
12702         (Output_section::is_relro_local): New function.
12703         (Output_section::set_is_relro_local): New function.
12704         (class Output_segment): Update declarations.
12705         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12706         * sparc.cc (Target_sparc::got_section): Likewise.
12707         * x86_64.cc (Target_x86_64::got_section): Likewise.
12708         * testsuite/relro_test_main.cc: New file.
12709         * testsuite/relro_test.cc: New file.
12710         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12711         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12712         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12713         (relro_test.so, relro_test_pic.o): New targets.
12714         * testsuite/Makefile.in: Rebuild.
12715
12716 2008-05-16  Ian Lance Taylor  <iant@google.com>
12717
12718         * output.cc (Output_segment::add_output_section): Remove front
12719         parameter.
12720         * output.h (class Output_segment): Remove
12721         add_initial_output_section and overloaded add_output_section.
12722         Update declaration of remaining add_output_section.
12723         * layout.cc (Layout::create_interp): Call add_output_section
12724         rather than add_initial_output_section.
12725         (Layout::finish_dynamic_section): Likewise.
12726
12727         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12728         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12729         know the dynamic type.
12730         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12731         field.  Initialize it in constructor.
12732         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12733         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12734         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12735         reloc.
12736
12737         * output.cc (Output_reloc::get_address): Change return type to
12738         Elf_Addr.
12739         * output.h (class Output_reloc): Update get_address declaration.
12740         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12741         for section addresses.
12742
12743 2008-05-09  Ian Lance Taylor  <iant@google.com>
12744
12745         PR 6493
12746         * gold.cc (gold_nomem): Use return value of write.
12747
12748 2008-05-08  Ian Lance Taylor  <iant@google.com>
12749
12750         * symtab.c (Symbol::init_base_output_data): Add version
12751         parameter.  Change all callers.
12752         (Symbol::init_base_output_segment): Likewise.
12753         (Symbol::init_base_constant): Likewise.
12754         (Symbol::init_base_undefined): Likewise.
12755         (Sized_symbol::init_output_data): Likewise.
12756         (Sized_symbol::init_output_segment): Likewise.
12757         (Sized_symbol::init_constant): Likewise.
12758         (Sized_symbol::init_undefined): Likewise.
12759         (Symbol_table::do_define_in_output_data): If the new symbol has a
12760         version, mark it as the default.
12761         (Symbol_table::do_define_in_output_segment): Likewise.
12762         (Symbol_table::do_define_as_constant): Likewise.
12763         * symtab.h (class Symbol): Update declarations.
12764         (class Sized_symbol): Likewise.
12765         * resolve.cc (Symbol::override_version): New function.
12766         (Symbol::override_base): Call override_version.
12767         (Symbol::override_base_with_special): Likewise.
12768         * testsuite/ver_script_8.script: New file.
12769         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12770         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12771         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12772         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12773
12774 2008-05-06  Ian Lance Taylor  <iant@google.com>
12775
12776         PR 6049
12777         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12778         functions.
12779         (class General_options): Remove existing --undefined, and add
12780         --no-undefined instead.  Add new --undefined as synonym for -u.
12781         * archive.cc (Archive::add_symbols): Check whether symbol was
12782         named with -u.
12783         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12784         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12785         all uses.  Add IS_UNDEFINED.  Update declarations to split
12786         different versions of init_base.  Declare init_base_undefined.
12787         (Symbol::is_defined): Handle IS_UNDEFINED.
12788         (Symbol::is_undefined): Likewise.
12789         (Symbol::is_weak_undefined): Call is_undefined.
12790         (Symbol::is_absolute): Handle IS_CONSTANT.
12791         (class Sized_symbol): Update declarations to split different
12792         versions of init.  Declare init_undefined.
12793         (class Symbol_table): Declare new functions.
12794         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12795         Change all callers.
12796         (Symbol::init_base_output_data): Likewise.
12797         (Symbol::init_base_output_segment): Likewise.
12798         (Symbol::init_base_constant): Likewise.
12799         (Symbol::init_base_undefined): New function.
12800         (Sized_symbol::init_object): Rename from init.  Change all
12801         callers.
12802         (Sized_symbol::init_output_data): Likewise.
12803         (Sized_symbol::init_output_segment): Likewise.
12804         (Sized_symbol::init_constant): Likewise.
12805         (Sized_symbol::init_undefined): New function.
12806         (Symbol_table::add_undefined_symbols_from_command_line): New
12807         function.
12808         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12809         function.
12810         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12811         (Symbol::output_section): Likewise.
12812         (Symbol::set_output_section): Likewise.
12813         (Symbol_table::sized_finalize_symbol): Likewise.
12814         (Symbol_table::sized_write_globals): Likewise.
12815         * resolve.cc (Symbol_table::should_override): Likewise.
12816         (Symbol::override_base_with_special): Likewise.
12817
12818         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12819         symbol, change it to have default visibility.
12820         * testsuite/protected_1.cc: New file.
12821         * testsuite/protected_2.cc: New file.
12822         * testsuite/protected_3.cc: New file.
12823         * testsuite/protected_main_1.cc: New file.
12824         * testsuite/protected_main_2.cc: New file.
12825         * testsuite/protected_main_3.cc: New file.
12826         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12827         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12828         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12829         (protected_1.so): New target.
12830         (protected_1_pic.o, protected_2_pic.o): New targets.
12831         (protected_3_pic.o): New target.
12832         (check_PROGRAMS): Add protected_2.
12833         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12834         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12835         * testsuite/Makefile.in: Rebuild.
12836
12837         * options.h (DEFINE_var): Add set_user_set_##varname__.
12838         (DEFINE_bool_alias): New macro.
12839         (class General_options): Define -Bstatic using DEFINE_bool_alias
12840         rather than DEFINE_special.  Add --undefined as an alias for -z
12841         defs.
12842         * options.cc (General_options::parse_Bstatic): Remove.
12843
12844         * options.h (class General_options): Add --fatal-warnings.
12845         * main.cc (main): Implement --fatal-warnings.
12846         * errors.h (Errors::warning_count): New function.
12847
12848         * options.h (class General_options): Add -Bsymbolic-functions.
12849         * symtab.h (Symbol::is_preemptible): Check for
12850         -Bsymbolic-functions.
12851
12852 2008-05-05  Ian Lance Taylor  <iant@google.com>
12853
12854         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12855         as noVARNAME rather than no-VARNAME.
12856         (class General_options): Add option -z combreloc.
12857         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12858         get_address.
12859         (Output_reloc::sort_before) [SHT_REL]: New function.
12860         (Output_reloc::sort_before) [SHT_RELA]: New function.
12861         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12862         Sort_relocs_comparison.
12863         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12864         parameter.  Change all callers.
12865         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12866         sort_relocs parameter.  Change all callers.
12867         * output.cc (Output_reloc::get_address): New function, broken out
12868         of write_rel.
12869         (Output_reloc::write_rel): Call it.
12870         (Output_reloc::compare): New function.
12871         (Output_data_reloc_base::do_write): Optionally sort relocs.
12872
12873         * configure.ac: If targ_extra_obj is set, link it in.
12874         * configure.tgt: Initialize all variables.
12875         (x86_64*): Set targ_extra_obj and targ_extra_size.
12876         * configure: Rebuild.
12877
12878         * object.cc (Sized_relobj::include_section_group): Adjust section
12879         indexes read from group data.  Build vector to pass to
12880         layout_group.
12881         * layout.cc (Layout::layout_group): Add flags and shndxes
12882         parameters.  Remove contents parameter.  Change caller.  Update
12883         explicit instantiations.
12884         * layout.h (class Layout): Update layout_group declaration.
12885         * output.cc (Output_data_group::Output_data_group): Add flags and
12886         input_shndxes parameters.  Remove contents parameter.  Change
12887         caller.
12888         (Output_data_group::do_write): Change input_sections_ to
12889         input_shndxes_.
12890         * output.h (class Output_data_group): Update constructor
12891         declaration.  Rename input_sections_ to input_shndxes_.
12892         * testsuite/many_sections_test.cc: Add template.
12893
12894 2008-04-30  Cary Coutant  <ccoutant@google.com>
12895
12896         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12897
12898         * layout.cc (Layout::include_section): Refactored check for debug
12899         info section.
12900         (Layout::add_comdat): Add new parameters.  Change type
12901         of signature parameter.  Add object and shndx to signatures table.
12902         (Layout::find_kept_object): New function.
12903         * layout.h: Include <cstring>.
12904         (Layout::is_debug_info_section): New function.
12905         (Layout::add_comdat): Add new parameters.
12906         (Layout::find_kept_object): New function.
12907         (Layout::Kept_section): New struct.
12908         (Layout::Signatures): Change type of map range.
12909         * object.cc (Relobj::output_section_address): New function.
12910         (Sized_relobj::include_section_group): Add new parameters.  Change
12911         calls to Layout::add_comdat.  Change to build table of kept comdat
12912         groups and table mapping discarded sections to kept sections.
12913         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12914         (Sized_relobj::do_layout): Change calls to include_section_group and
12915         include_linkonce_section.
12916         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12917         value to zero when section is discarded.
12918         (Sized_relobj::map_to_kept_section): New function.
12919         * object.h (Relobj::output_section_address): New function.
12920         (Relobj::Comdat_group): New type.
12921         (Relobj::find_comdat_group): New function.
12922         (Relobj::Comdat_group_table): New type.
12923         (Relobj::Kept_comdat_section): New type.
12924         (Relobj::Kept_comdat_section_table): New type.
12925         (Relobj::add_comdat_group): New function.
12926         (Relobj::set_kept_comdat_section): New function.
12927         (Relobj::get_kept_comdat_section): New function.
12928         (Relobj::comdat_groups_): New field.
12929         (Relobj::kept_comdat_sections_): New field.
12930         (Symbol_value::input_value): Update comment.
12931         (Sized_relobj::map_to_kept_section) New function.
12932         (Sized_relobj::include_linkonce_section): Add new parameter.
12933         * target-reloc.h (Comdat_behavior): New type.
12934         (get_comdat_behavior): New function.
12935         (relocate_section): Add code to map a discarded section to the
12936         corresponding kept section when applying a relocation.
12937
12938 2008-04-30  Craig Silverstein  <csilvers@google.com>
12939
12940         * dwarf_reader.cc (next_generation_count): New static var.
12941         (Addr2line_cache_entry): New struct.
12942         (addr2line_cache): New static var.
12943         (Dwarf_line_info::one_addr2line): Added caching.
12944         (Dwarf_line_info::clear_addr2line_cache): New function.
12945         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12946         cache-size parameter.
12947         (Dwarf_line_info::one_addr2line_cache): New function.
12948         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12949         new cache-size argument to one_addr2line(), and clear cache.
12950
12951 2008-04-28  Cary Coutant  <ccoutant@google.com>
12952
12953         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12954         R_386_PC8 relocations.
12955
12956 2008-04-23  Ian Lance Taylor  <iant@google.com>
12957
12958         * object.cc (Sized_relobj::include_section_group): Check for
12959         invalid section group.
12960
12961         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12962         header size.
12963
12964         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12965         than read for file header.
12966         * archive.cc (Archive::include_member): Likewise.
12967
12968 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12969
12970         * aclocal.m4: Regenerate.
12971         * configure: Regenerate.
12972
12973 2008-04-19  Ian Lance Taylor  <iant@google.com>
12974
12975         * version.cc (version_string): Bump to 1.6.
12976
12977         * testsuite/Makefile.am (many_sections_r_test): New target.
12978         (many_sections_r_test_SOURCES): Remove.
12979         (many_sections_r_test_DEPENDENCIES): Remove.
12980         (many_sections_r_test_LDFLAGS): Remove.
12981         (many_sections_r_test_LDADD): Remove.
12982
12983         * object.cc (Sized_relobj::do_add_symbols): Always pass
12984         local_symbol_count_ to add_from_relobj.
12985
12986         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12987         every thousand variables.
12988         * testsuite/Makefile.in: Rebuild.
12989
12990         * object.cc (Xindex::initialize_symtab_xindex): New function.
12991         (Xindex::read_symtab_xindex): New function.
12992         (Xindex::sym_xindex_to_shndx): New function.
12993         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12994         available.
12995         (Sized_relobj::do_initialize_xindex): New function.
12996         (Sized_relobj::do_read_symbols): Adjust section links.
12997         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12998         parameter.  Change all callers.
12999         (Sized_relobj::include_section_group): Adjust section links and
13000         symbol section indexes.
13001         (Sized_relobj::do_layout): Adjust section links.
13002         (Sized_relobj::do_count_local_symbols): Adjust section links and
13003         symbol section indexes.
13004         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13005         ordinary and special symbols.
13006         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13007         dynsym_xindex parameters.  Change all callers.  Adjust section
13008         links.  Use SHN_XINDEX when needed.
13009         (Sized_relobj::get_symbol_location_info): Adjust section links.
13010         Don't get fooled by special symbols.
13011         * object.h (class Xindex): Define.
13012         (class Object): Add xindex_ parameter.  Declare virtual functoin
13013         do_initialize_xindex.
13014         (Object::adjust_sym_shndx): New function.
13015         (Object::set_xindex): New protected function.
13016         (class Symbol_value): Add is_ordinary_shndx_ field.
13017         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13018         (Symbol_value::value): Assert ordinary section.
13019         (Symbol_value::initialize_input_to_output_map): Likewise.
13020         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13021         Change all callers.
13022         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13023         all callers.
13024         (class Sized_relobj): Update declarations.
13025         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13026         parameter.  Change all callers.
13027         (Sized_relobj::adjust_shndx): New function.
13028         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13029         field.
13030         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13031         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13032         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13033         (Sized_dynobj::read_dynsym_section): Adjust section links.
13034         (Sized_dynobj::read_dynamic): Likewise.
13035         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13036         section links.
13037         (Sized_dynobj::do_initialize_xindex): New function.
13038         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13039         do_initialize_xindex.
13040         (Sized_dynobj::adjust_shndx): New function.
13041         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13042         dynsym_xindex_ fields.
13043         (Layout::finalize): Add a call to set_section_indexes before
13044         creating the symtab sections.
13045         (Layout::set_section_indexes): Don't do anything if the section
13046         already has a section index.
13047         (Layout::create_symtab_sections): Add shnum parameter.  Change
13048         caller.  Create .symtab_shndx section if needed.
13049         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13050         caller.
13051         (Layout::allocated_output_section_count): New function.
13052         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13053         needed.
13054         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13055         fields.  Update declarations.
13056         (Layout::symtab_xindex): New function.
13057         (Layout::dynsym_xindex): New function.
13058         (class Write_symbols_task): Add layout_ field.
13059         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13060         Change caller.
13061         * output.cc (Output_section_headers::Output_section_headers): Add
13062         shstrtab_section parameter.  Change all callers.
13063         (Output_section_headers::do_sized_write): Store overflow values
13064         for section count and section string table section index in
13065         section header zero.
13066         (Output_file_header::do_sized_write): Check for overflow of
13067         section count and section string table section index.
13068         (Output_symtab_xindex::do_write): New function.
13069         (Output_symtab_xindex::endian_do_write): New function.
13070         * output.h (class Output_section_headers): Add shstrtab_section_.
13071         Update declarations.
13072         (class Output_symtab_xindex): Define.
13073         (Output_section::has_out_shndx): New function.
13074         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13075         field.
13076         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13077         Change all callers.
13078         (Sized_symbol::init): Likewise.
13079         (Symbol::output_section): Check for ordinary symbol.
13080         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13081         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13082         callers.
13083         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13084         Change all callers.  Simplify handling of symbols from sections
13085         not included in the link.
13086         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13087         distinction.
13088         (Weak_alias_sorter::operator()): Assert that symbols are
13089         ordinary.
13090         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13091         distinction.
13092         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13093         parameters.  Change all callers.
13094         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13095         symbol distinction.  Use SHN_XINDEX when needed.
13096         (Symbol_table::write_section_symbol): Add symtab_xindex
13097         parameter.  Change all callers.
13098         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13099         SHN_XINDEX when needed.
13100         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13101         declarations.
13102         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13103         (Symbol::is_defined): Check is_ordinary.
13104         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13105         (Symbol::is_absolute, Symbol::is_common): Likewise.
13106         (class Sized_symbol): Update declarations.
13107         (class Symbol_table): Update declarations.
13108         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13109         parameters.  Change all callers.
13110         (Sized_symbol::override): Likewise.
13111         (Symbol_table::override): Likewise.
13112         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13113         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13114         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13115         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13116         to be in an ordinary section.
13117         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13118         object and is_ordinary parameters.  Change all callers.
13119         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13120         Change all callers.  Don't add undefined or non-ordinary symbols
13121         to reloc_map_.
13122         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13123         Change all callers.
13124         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13125         declarations.
13126         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13127         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13128         (Sized_relobj::relocate_sections): Likewise.
13129         * target-reloc.h (scan_relocs): Adjust section symbol index.
13130         (scan_relocatable_relocs): Likewise.
13131         * i386.cc (Scan::local): Check for ordinary symbols.
13132         * sparc.cc (Scan::local): Likewise.
13133         * x86_64.cc (Scan::local): Likewise.
13134         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13135         to symbol_section_and_value.
13136         * testsuite/many_sections_test.cc: New file.
13137         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13138         (check_PROGRAMS): Add many_sections_test.
13139         (many_sections_test_SOURCES): Define.
13140         (many_sections_test_DEPENDENCIES): Define.
13141         (many_sections_test_LDFLAGS): Define.
13142         (BUILT_SOURCES): Add many_sections_define.h.
13143         (many_sections_define.h): New target.
13144         (BUILT_SOURCES): Add many_sections_check.h.
13145         (many_sections_check.h): New target.
13146         (check_PROGRAMS): Add many_sections_r_test.
13147         (many_sections_r_test_SOURCES): Define.
13148         (many_sections_r_test_DEPENDENCIES): Define.
13149         (many_sections_r_test_LDFLAGS): Define.
13150         (many_sections_r_test_LDADD): Define.
13151         (many_sections_r_test.o): New target.
13152         * testsuite/Makefile.in: Rebuild.
13153
13154 2008-04-17  Cary Coutant  <ccoutant@google.com>
13155
13156         * errors.cc (Errors::info): New function.
13157         (gold_info): New function.
13158         * errors.h (Errors::info): New function.
13159         * gold.h (gold_info): New function.
13160         * object.cc (Input_objects::add_object): Print trace output.
13161         * options.cc (options::parse_set): New function.
13162         (General_options::parse_wrap): Deleted.
13163         (General_options::General_options): Deleted initializer.
13164         * options.h (options::String_set): New typedef.
13165         (options::parse_set): New function.
13166         (DEFINE_set): New macro.
13167         (General_options::wrap): Changed to use DEFINE_set. Changed
13168         callers of any_wrap_symbols and is_wrap_symbol.
13169         (General_options::trace, General_options::trace_symbol):
13170         New options.
13171         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13172         (General_options::wrap_symbols_): Deleted.
13173         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13174
13175 2008-04-17  David S. Miller  <davem@davemloft.net>
13176
13177         * options.cc (General_options::parse_V): New function.
13178         * options.h: Add entries for -V and -Qy.
13179
13180 2008-04-17  Ian Lance Taylor  <iant@google.com>
13181
13182         * common.cc (Symbol_table::allocate_commons): Remove options
13183         parameter.  Change caller.
13184         (Symbol_table::do_allocate_commons): Remove options parameter.
13185         Change caller.  Just call do_allocate_commons_list twice.
13186         (Symbol_table::do_allocate_commons_list): New function, broken out
13187         of do_allocate_commons.
13188         * common.h (class Allocate_commons_task): Remove options_ field.
13189         Update constructor.
13190         * symtab.cc (Symbol_table::Symbol_table): Initialize
13191         tls_commons_.
13192         (Symbol_table::add_from_object): Put TLS common symbols on
13193         tls_commons_ list.
13194         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13195         which are IN_OUTPUT_DATA.
13196         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13197         allocate_commons and do_allocate_commons declarations.  Declare
13198         do_allocate_commons_list.
13199         * gold.cc (queue_middle_tasks): Update creation of
13200         Allocate_commons_task to not pass options.
13201         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13202         (TLS_TEST_C_FLAGS): New variable.
13203         (tls_test_c_pic.o): New target.
13204         (tls_test_shared.so): Link in tls_test_c_pic.o.
13205         (tls_test_c_pic_ie.o): New target.
13206         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13207         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13208         (tls_test_c.o): New target.
13209         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13210         (tls_pic_test_LDADD): Likewise.
13211         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13212         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13213         (tls_test_c_gnu2.o): New target.
13214         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13215         tls_test_c_gnu2.o.
13216         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13217         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13218         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13219         * testsuite/tls_test.cc: Include "config.h".
13220         (t_last): Call t11_last.
13221         * testsuite/tls_test.h (t11, t11_last): Declare.
13222         * testsuite/tls_test_c.c: New file.
13223         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13224         * configure.ac: Check for OpenMP support.
13225         * configure, config.in, Makefile.in: Rebuild.
13226         * testsuite/Makefile.in: Rebuild.
13227
13228 2008-04-16  Cary Coutant  <ccoutant@google.com>
13229
13230         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13231         (Target_i386::tls_base_symbol_defined_): New field.
13232         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13233         (Target_i386::Scan::global): Likewise.
13234         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13235         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13236         (Target_x86_64::tls_base_symbol_defined_): New field.
13237         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13238         (Target_x86_64::Scan::global): Likewise.
13239
13240 2008-04-16  Cary Coutant  <ccoutant@google.com>
13241
13242         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13243         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13244         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13245         building shared libraries.
13246         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13247         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13248         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13249         * testsuite/Makefile.in: Rebuild.
13250         * testsuite/weak_undef.h: New file.
13251         * testsuite/weak_undef_file1.cc: Add extra test cases.
13252         * testsuite/weak_undef_file2.cc: Likewise.
13253         * testsuite/weak_undef_test.cc: Likewise.
13254
13255 2008-04-16  David S. Miller  <davem@davemloft.net>
13256
13257         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13258         Add issued_non_pic_error_ field.  Declare check_non_pic.
13259         (Target_sparc::Scan::check_non_pic): New function.
13260         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13261         (Target_sparc::Scan::global): Likewise.
13262
13263         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13264         * configure: Rebuild.
13265
13266         * options.h (DEFINE_enable): New macro.
13267         (new_dtags): New enable option.
13268         (initfirst, interpose, loadfltr, nodefaultlib,
13269         nodelete, nodlopen, nodump): New -z options.
13270         * layout.cc (Layout:finish_dynamic_section): If new
13271         dtags enabled, emit DT_RUNPATH.  Also, emit a
13272         DT_FLAGS_1 containing any specified -z flags.
13273
13274 2008-04-16  Ian Lance Taylor  <iant@google.com>
13275
13276         * copy-relocs.cc: New file.
13277         * copy-relocs.h: New file.
13278         * reloc.cc: Remove Copy_relocs code.
13279         * reloc.h: Likewise.
13280         * reloc-types.h (struct Reloc_types) [both versions]: Add
13281         get_reloc_addend_noerror.
13282         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13283         variants of add_global which take an addend which must be zero.
13284         * i386.cc: Include "copy-relocs.h".
13285         (class Target_i386): Change type of copy_relocs_ to variable,
13286         update initializer.
13287         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13288         Change all callers.
13289         (Target_i386::do_finalize_sections): Change handling of
13290         copy_relocs_.
13291         * sparc.cc: Include "copy-relocs.h".
13292         (class Target_sparc): Change type of copy_relocs_ to variable,
13293         update initializer.
13294         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13295         Change all callers.
13296         (Target_sparc::do_finalize_sections): Change handling of
13297         copy_relocs_.
13298         * x86_64.cc: Include "copy-relocs.h".
13299         (class Target_x86_64): Change type of copy_relocs_ to variable,
13300         update initializer.
13301         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13302         class.  Change all callers.
13303         (Target_x86_64::do_finalize_sections): Change handling of
13304         copy_relocs_.
13305         * Makefile.am (CCFILES): Add copy-relocs.cc.
13306         (HFILES): Add copy-relocs.h.
13307
13308         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13309
13310         * testsuite/script_test_4.sh: Permit leading zeroes.
13311
13312 2008-04-15  Ian Lance Taylor  <iant@google.com>
13313
13314         * script-sections.cc (Script_sections::create_segments): Use
13315         header_size_adjustment even when there is enough room for the
13316         headers.
13317         * testsuite/script_test_4.sh: New file.
13318         * testsuite/script_test_4.t: New file.
13319         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13320         (check_DATA): Add script_test_4.stdout.
13321         (MOSTLYCLEANFILES): Likewise.
13322         (script_test_4): New target.
13323         (script_test_4.stdout): New target.
13324         * testsuite/Makefile.in: Rebuild.
13325
13326         * sparc.cc: Add definitions for Output_data_plt_sparc class
13327         constants.
13328
13329 2008-04-14  David S. Miller  <davem@davemloft.net>
13330
13331         * sparc.cc: New file.
13332         * Makefile.am (TARGETSOURCES): Add sparc.cc
13333         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13334         * configure.tgt: Document targ_extra_size and
13335         targ_extra_big_endian.  Add entries for sparc-* and
13336         sparc64-*.
13337         * configure.ac: Handle targ_extra_size and
13338         targ_extra_big_endian.
13339         * Makefile.in: Rebuild.
13340         * configure: Likewise.
13341         * po/POTFILES.in: Likewise.
13342         * po/gold.pot: Likewise.
13343
13344 2008-04-14  Ian Lance Taylor  <iant@google.com>
13345
13346         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13347         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13348         in the name/type/flags to section mapping.  Don't call
13349         allocate_output_section.
13350         (Layout::choose_output_section): Change parameter from adjust_name
13351         to is_input_section.  Don't permit input sections after sections
13352         are attached to segments.  Don't call allocate_output_section.
13353         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13354         not write_enable_output_section.
13355         (Layout::make_output_section): Don't push to
13356         unattached_section_list_ nor call attach_to_segment.  Call
13357         attach_section_to_segment if sections are attached.
13358         (Layout::attach_sections_to_segments): New function.
13359         (Layout::attach_section_to_segment): New function.
13360         (Layout::attach_allocated_section_to_segment): Rename from
13361         attach_to_segment.  Remove flags parameter.
13362         (Layout::allocate_output_section): Remove function.
13363         (Layout::write_enable_output_section): Remove function.
13364         * layout.h (class Layout): Update for above changes.  Add new
13365         field sections_are_attached_.
13366         * output.h (Output_section::update_flags_for_input_section): New
13367         function.
13368         * output.cc (Output_section::add_input_section): Call
13369         update_flags_for_input_section.
13370         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13371
13372 2008-04-11  Cary Coutant  <ccoutant@google.com>
13373
13374         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13375         thought unnecessary.
13376         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13377
13378 2008-04-11  Ian Lance Taylor  <iant@google.com>
13379
13380         * output.h (class Output_section_data): Remove inline definition
13381         of set_addralign.
13382         * output.cc (Output_section_data::set_addralign): New function.
13383
13384 2008-04-11  Cary Coutant  <ccoutant@google.com>
13385
13386         Add support for TLS descriptors for i386 and x86_64.
13387         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13388         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13389         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13390         GOT_TYPE_TLS_DESC.
13391         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13392         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13393         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13394         relocations.
13395         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13396         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13397         Fix problem with initial-exec relocations.
13398         (Target_i386::Relocate::relocate_tls): Likewise.
13399         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13400         relaxation.
13401         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13402         support for section-plus-offset dynamic table entries.
13403         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13404         (Output_data_dynamic::Dynamic_entry): Add support for
13405         section-plus-offset dynamic table entries.
13406         (Output_data_dynamic::Classification): Likewise.
13407         (Output_data_dynamic::classification_): Renamed offset_.
13408         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13409         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13410         (Target_x86_64::make_plt_section): New function.
13411         (Target_x86_64::reserve_tlsdesc_entries): New function.
13412         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13413         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13414         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13415         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13416         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13417         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13418         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13419         add extra PLT entry for TLS descriptors.
13420         (Output_data_plt_x86_64::got_): New field.
13421         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13422         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13423         fields.
13424         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13425         descriptors.
13426         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13427         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13428         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13429         R_386_TLS_DESC_CALL relocations.
13430         (Target_x86_64::Scan::global): Likewise.
13431         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13432         for TLS descriptors.
13433         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13434         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13435         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13436         GD-to-IE relaxation.
13437         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13438         and TLS_DESCRIPTORS.
13439         * Makefile.in: Rebuild.
13440         * configure: Rebuild.
13441         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13442         (tls_test_shared2.so): New target.
13443         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13444         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13445         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13446         (tls_shared_gd_to_ie_test_LDADD): New variable.
13447         (tls_shared_gnu2_gd_to_ie_test): New target.
13448         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13449         New targets.
13450         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13451         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13452         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13453         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13454         (tls_shared_gnu2_test): New target.
13455         (tls_test_gnu2_shared.so): New target.
13456         (tls_shared_gnu2_test_SOURCES): New variable.
13457         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13458         (tls_shared_gnu2_test_LDFLAGS): New variable.
13459         (tls_shared_gnu2_test_LDADD): New variable.
13460         * testsuite/Makefile.in: Rebuild.
13461         * testsuite/Makefile.
13462
13463 2008-04-11  Ian Lance Taylor  <iant@google.com>
13464
13465         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13466         justsyms.t.
13467         * testsuite/Makefile.in: Rebuild.
13468
13469         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13470         long.
13471         * testsuite/script_test_2.cc (main): Adjust test.
13472
13473 2008-04-11  David S. Miller  <davem@davemloft.net>
13474             Ian Lance Taylor  <iant@google.com>
13475
13476         * options.h (General_options): Add entries for '-Y' and
13477         '-relax'.
13478         * options.cc (General_options:finalize): If -Y was used, add those
13479         entries to the library path instead of the default "/lib" and
13480         "/usr/lib".
13481
13482 2008-04-11  David S. Miller  <davem@davemloft.net>
13483
13484         * testsuite/justsyms.t: Start at 0x100.
13485         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13486         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13487         long.
13488         * testsuite/script_test_2.cc: Adjust string and section length
13489         checks.
13490
13491 2008-04-09  Ian Lance Taylor  <iant@google.com>
13492
13493         PR gold/5996
13494         * script-sections.cc (Sections_element::allocate_to_segment): Add
13495         orphan parameter.
13496         (Output_section_definition::allocate_to_segment): Likewise.
13497         (Orphan_output_section::allocate_to_segment): Likewise.
13498         (Script_sections::attach_sections_using_phdrs_clause): Don't
13499         propagate non-PT_LOAD segments to orphan sections.
13500         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13501         readelf rather than objdump.
13502         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13503         .interp section and PT_INTERP segment are the same size.
13504         * testsuite/Makefile.in: Rebuild.
13505
13506         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13507         aliases for symbols defined in the same object.
13508         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13509         (weak_alias_test_SOURCES): New variable.
13510         (weak_alias_test_DEPENDENCIES): New variable.
13511         (weak_alias_test_LDFLAGS): New variable.
13512         (weak_alias_test_LDADD): New variable.
13513         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13514         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13515         (weak_alias_test_3.o): New target.
13516         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13517         * testsuite/weak_alias_test_main.cc: New file.
13518         * testsuite/weak_alias_test_1.cc: New file.
13519         * testsuite/weak_alias_test_2.cc: New file.
13520         * testsuite/weak_alias_test_3.cc: New file.
13521
13522 2008-04-08  Ian Lance Taylor  <iant@google.com>
13523
13524         * options.h (class General_options): Add --noinhibit-exec option.
13525         * main.cc (main): Check --noinhibit-exec.
13526
13527         * options.h (class General_options): Define --wrap as a special
13528         option.  Add wrap_symbols_ field.
13529         (General_options::any_wrap_symbols): New function.
13530         (General_options::is_wrap_symbol): New function.
13531         * options.cc (General_options::parse_wrap): New function.
13532         (General_options::General_options): Initialize wrap_symbols_.
13533         * symtab.cc (Symbol_table::wrap_symbol): New function.
13534         (Symbol_table::add_from_object): Handle --wrap.
13535         * symtab.h (class Symbol_table): Declare wrap_symbol.
13536         * target.h (Target::wrap_char): New function.
13537         (Target::Target_info): Add wrap_char field.
13538         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13539         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13540         * testsuite/testfile.cc (Target_test::test_target_info):
13541         Likewise.
13542
13543         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13544         there is one.
13545
13546         * layout.h (class Layout): Add added_eh_frame_data_ field.
13547         * layout.cc (Layout::Layout): Initialize new field.
13548         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13549         output section until we find a section we merged successfully.
13550         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13551         that the size be non-zero.
13552
13553         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13554         qualifier.
13555
13556 2008-04-08  Craig Silverstein  <csilvers@google.com>
13557
13558         * configure.ac: Export new conditional variable HAVE_ZLIB.
13559         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13560         on HAVE_ZLIB.
13561         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13562         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13563
13564 2008-04-07  Ian Lance Taylor  <iant@google.com>
13565
13566         * version.cc (version_string): Set to "1.5".
13567
13568         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13569         Add issued_non_pic_error_ field.  Declare check_non_pic.
13570         (Target_x86_64::Scan::check_non_pic): New function.
13571         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13572         (Target_x86_64::Scan::global): Likewise.
13573
13574         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13575         addend parameter.  Change caller.  Handle merge sections.
13576         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13577         Address to Addend.  Don't add in the result of
13578         local_section_offset, pass down the addend and use the returned
13579         value.
13580         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13581         Update declarations of local_section_offset and symbol_value.
13582         * testsuite/two_file_test_1.cc (t18): New function.
13583         * testsuite/two_file_test_2.cc (f18): New function.
13584         * testsuite/two_file_test_main.cc (main): Call t18.
13585         * testsuite/two_file_test.h (t18, f18): Declare.
13586
13587         * configure.ac: Don't test for objdump, c++filt, or readelf.
13588         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13589         conditionals.
13590         (TEST_READELF): New variable.
13591         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13592         (check_PROGRAMS): Add two_file_strip_test.
13593         (two_file_strip_test): New target.
13594         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13595         (two_file_same_shared_strip_test_SOURCES): New variable.
13596         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13597         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13598         (two_file_same_shared_strip_test_LDADD): New variable.
13599         (two_file_shared_strip.so): New target.
13600         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13601         (ver_test_5.syms, ver_test_7.syms): Likewise.
13602         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13603         (strip_test_3.stdout): Use TEST_OBJDUMP.
13604         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13605
13606 2008-04-04  Cary Coutant  <ccoutant@google.com>
13607
13608         * symtab.h (Symbol::is_weak_undefined): New function.
13609         (Symbol::is_strong_undefined): New function.
13610         (Symbol::is_absolute): New function.
13611         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13612         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13613         absolute symbols.
13614         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13615         (weak_undef_test): New target.
13616         * testsuite/Makefile.in: Rebuild.
13617         * testsuite/weak_undef_file1.cc: New file.
13618         * testsuite/weak_undef_file2.cc: New file.
13619         * testsuite/weak_undef_test.cc: New file.
13620
13621 2008-04-03  Craig Silverstein  <csilvers@google.com>
13622
13623         * compressed_output.h (class Output_compressed_section): Use
13624         unsigned buffer.
13625         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13626         add zlib header.
13627         (zlib_compressed_suffix): Removed.
13628         (Output_compressed_section::set_final_data_size): Use unsigned
13629         buffers.
13630         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13631         Fix linker invocation.
13632         (flagstest_o_specialfile_and_compress_debug_sections):
13633         Likewise.
13634         * testsuite/Makefile.in: Regenerated.
13635
13636 2008-04-02  David S. Miller  <davem@davemloft.net>
13637
13638         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13639         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13640
13641 2008-04-02  Craig Silverstein  <csilvers@google.com>
13642
13643         * TODO: New file.
13644
13645 2008-04-02  Ian Lance Taylor  <iant@google.com>
13646
13647         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13648         parameters.  Update for new key type to views_.  Change all
13649         callers.
13650         (File_read::read): Adjust for byteshift in returned view.
13651         (File_read::add_view): New function, broken out of
13652         find_and_make_view.
13653         (File_read::make_view): New function, broken out of
13654         find_and_make_view.
13655         (File_read::find_or_make_view): Add offset and aligned
13656         parameters.  Rewrite accordingly.  Change all callers.
13657         (File_read::get_view): Add offset and aligned parameters.  Adjust
13658         for byteshift in return value.
13659         (File_read::get_lasting_view): Likewise.
13660         * fileread.h (class File_read): Update declarations.
13661         (class File_read::View): Add byteshift_ field.  Add byteshift to
13662         constructor.  Add byteshift method.
13663         * archive.h (Archive::clear_uncached_views): New function.
13664         (Archive::get_view): Add aligned parameter.  Change all callers.
13665         * object.h (Object::get_view): Add aligned parameter.  Change all
13666         callers.
13667         (Object::get_lasting_view): Likewise.
13668
13669         * fileread.cc (File_read::release): Don't call clear_views if
13670         there are multiple objects.
13671         * fileread.h (File_read::clear_uncached_views): New function.
13672         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13673         on the archive.
13674
13675 2008-03-31  Cary Coutant  <ccoutant@google.com>
13676
13677         Add thin archive support.
13678         * archive.cc (Archive::armagt): New const.
13679         (Archive::setup): Remove task parameter and calls to unlock.
13680         (Archive::unlock_nested_archives): New function.
13681         (Archive::read_header): Add nested_off parameter. Change
13682         all callers.
13683         (Archive::interpret_header): Likewise.
13684         (Archive::include_all_members): Change to handle thin
13685         archives.
13686         (Archive::include_member): Likewise.
13687         * archive.h (Archive::Archive): Add new parameters and
13688         initializers.
13689         (Archive::armagt): New const.
13690         (Archive::setup): Remove task parameter.
13691         (Archive::unlock_nested_archives): New function.
13692         (Archive::read_header): Add nested_off parameter.
13693         (Archive::interpret_header): Likewise.
13694         (Archive::Nested_archive_table): New typedef.
13695         (Archive::is_thin_archive_): New field.
13696         (Archive::nested_archives_): New field.
13697         (Archive::options_): New field.
13698         (Archive::dirpath_): New field.
13699         (Archive::task_): New field.
13700         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13701         for thin archives.  Pass additional parameters to
13702         Archive::Archive.  Unlock the archive file after calling
13703         Archive::setup.
13704
13705 2008-03-29  Ian Lance Taylor  <iant@google.com>
13706
13707         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13708         version symbol to be local.
13709         * testsuite/ver_test_4.sh: New file.
13710         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13711         (check_DATA): Add ver_test_4.syms.
13712         (ver_test_4.syms): New target.
13713         * testsuite/Makefile.in: Rebuild.
13714
13715         * output.cc
13716         (Output_section::Input_section_sort_entry::has_priority): New
13717         function.
13718         (Output_section::Input_section_sort_entry::match_file_name): New
13719         function.
13720         (Output_section::Input_section_sort_entry::match_section_name):
13721         Remove.
13722         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13723         Remove.
13724         (Output_section::Input_section_sort_entry::match_section_file):
13725         Remove.
13726         (Output_section::Input_section_sort_compare::operator()): Rewrite
13727         using new Input_section_sort_entry functions.  Sort crtbegin and
13728         crtend first.  Sort sections with no priority before sections with
13729         a priority.
13730         * testsuite/initpri1.c (d3): Check j != 4.
13731         (cd5): New constructor/destructor function.
13732         (main): Check j != 2.
13733
13734         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13735         new symbol when resolving, don't call set_is_default.
13736         * testsuite/ver_test_7.cc: New file.
13737         * testsuite/ver_test_7.sh: New file.
13738         * testsuite/Makefile.am (ver_test_7.so): New target.
13739         (ver_test_7.o): New target.
13740         (check_SCRIPTS): Add ver_test_7.sh.
13741         (check_DATA): Add ver_test_7.syms.
13742         (ver_test_7.syms): New target.
13743
13744 2008-03-28  Ian Lance Taylor  <iant@google.com>
13745
13746         * layout.cc (Layout::layout): If we see an input section with a
13747         name that needs sorting, set the must_sort flag for the output
13748         section.
13749         (Layout::make_output_section): If the name of the output section
13750         indicates that it might require sorting, set the may_sort flag.
13751         * output.h (Output_section::may_sort_attached_input_sections): New
13752         function.
13753         (Output_section::set_may_sort_attached_input_sections): New
13754         function.
13755         (Output_section::must_sort_attached_input_sections): New
13756         function.
13757         (Output_section::set_must_sort_attached_input_sections): New
13758         function.
13759         (class Output_section): Declare Input_section_sort_entry.  Define
13760         Input_section_sort_compare.  Declare
13761         sort_attached_input_sections.  Add new fields:
13762         may_sort_attached_input_sections_,
13763         must_sort_attached_input_sections_,
13764         attached_input_sections_are_sorted_.
13765         * output.cc (Output_section::Output_section): Initialize new
13766         fields.
13767         (Output_section::add_input_section): Add an entry to
13768         input_sections_ if may_sort or must_sort are true.
13769         (Output_section::set_final_data_size): Call
13770         sort_attached_input_sections if necessary.
13771         (Output_section::Input_section_sort_entry): Define new class.
13772         (Output_section::Input_section_sort_compare::operator()): New
13773         function.
13774         (Output_section::sort_attached_input_sections): New function.
13775         * configure.ac: Check whether the compiler supports constructor
13776         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13777         * testsuite/initpri1.c: New file.
13778         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13779         CONSTRUCTOR_PRIORITY.
13780         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13781         (initpri1_LDFLAGS): New variable.
13782         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13783
13784 2008-03-27  Ian Lance Taylor  <iant@google.com>
13785
13786         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13787         * testsuite/common_test_1.c: New file.
13788         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13789         (common_test_1_SOURCES): New variable.
13790         (common_test_1_DEPENDENCIES): New variable.
13791         (common_test_1_LDFLAGS): New variable.
13792
13793         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13794         and commons_ correctly when NAME/VERSION does not override
13795         NAME/NULL.
13796         * testsuite/ver_test_6.c: New file.
13797         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13798         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13799         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13800
13801 2008-03-26  Ian Lance Taylor  <iant@google.com>
13802
13803         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13804         of an undefined symbol from a version script.
13805         * testsuite/Makefile.am (ver_test_5.so): New target.
13806         (ver_test_5.o): New target.
13807         (check_SCRIPTS): Add ver_test_5.sh.
13808         (check_DATA): Add ver_test_5.syms.
13809         (ver_test_5.syms): New target.
13810         * testsuite/ver_test_5.cc: New file.
13811         * testsuite/ver_test_5.script: New file.
13812         * testsuite/ver_test_5.sh: New file.
13813         * Makefile.in, testsuite/Makefile.in: Rebuild.
13814
13815         PR gold/5986
13816         Fix problems building gold with gcc 4.3.0.
13817         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13818         (gold_error_at_location, gold_warning_at_location): Use it.
13819         * configure.ac: Check whether we can compile and use a template
13820         function with a printf attribute.
13821         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13822         when jumping over bytes.
13823         * object.cc: Instantiate Object::read_section_data.
13824         * debug.h: Include <cstring>
13825         * dwarf_reader.cc: Include <algorithm>
13826         * main.cc: Include <cstring>.
13827         * options.cc: Include <cstring>.
13828         * output.cc: Include <cstring>.
13829         * script.cc: Include <cstring>.
13830         * script.h: Include <string>.
13831         * symtab.cc: Include <cstring> and <algorithm>.
13832         * target-select.cc: Include <cstring>.
13833         * version.cc: Include <string>.
13834         * testsuite/testmain.cc: Include <cstdlib>.
13835         * configure, config.in: Rebuild.
13836
13837 2008-03-25  Ian Lance Taylor  <iant@google.com>
13838
13839         * options.cc: Include "../bfd/bfdver.h".
13840         (options::help): Print bug reporting address.
13841
13842         * version.cc (print_version): Adjust output for current value of
13843         BFD_VERSION_STRING.
13844
13845         * NEWS: New file.
13846
13847         * options.cc (options::help): Print list of supported targets.
13848         * target-select.h: Include <vector>.
13849         (class Target_selector): Make machine_, size_, and is_big_endian_
13850         fields const.  Add bfd_name_ and instantiated_target_ fields.
13851         (Target_selector::Target_selector): Add bfd_name parameter.
13852         (Target_selector::recognize): Make non-virtual, call
13853         do_recognize.
13854         (Target_selector::recognize_by_name): Make non-virtual, call
13855         do_recognize_by_name.
13856         (Target_selector::supported_names): New function.
13857         (Target_selector::bfd_name): New function.
13858         (Target_selector::do_instantiate_target): New pure virtual
13859         function.
13860         (Target_selector::do_recognize): New virtual function.
13861         (Target_selector::do_recognize_by_name): New virtual function.
13862         (Target_selector::instantiate_target): New private function.
13863         (supported_target_names): Declare.
13864         * target-select.cc (Target_selector::Target_selector): Update for
13865         new parameter and fields.
13866         (select_target_by_name): Check that the name matches before
13867         calling recognize_by_name.
13868         (supported_target_names): New function.
13869         * i386.cc (class Target_selector_i386): Update Target_selector
13870         constructor call.  Remove recognize and recognize_by_name.  Add
13871         do_instantiate_target.
13872         * x86_64.cc (class Target_selector_x86_64): Likewise.
13873         * testsuite/testfile.cc (class Target_selector_test): Update for
13874         changes to Target_selector.
13875
13876         * README: Rewrite, with some notes on unsupported features.
13877
13878 2008-03-24  Cary Coutant  <ccoutant@google.com>
13879
13880         * i386.cc (Target_i386::Got_type): New enum declaration.
13881         (Target_i386::Scan::local): Updated callers of Output_data_got
13882         member functions.
13883         (Target_i386::Scan::global): Likewise.
13884         (Target_i386::Relocate::relocate): Likewise.
13885         (Target_i386::Relocate::relocate_tls): Likewise.
13886         * object.h (Got_offset_list): New class.
13887         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13888         (Sized_relobj::local_got_offset): Likewise.
13889         (Sized_relobj::set_local_got_offset): Likewise.
13890         (Sized_relobj::local_has_tls_got_offset): Removed.
13891         (Sized_relobj::local_tls_got_offset): Removed.
13892         (Sized_relobj::set_local_tls_got_offset): Removed.
13893         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13894         * output.cc (Output_data_got::add_global): Added got_type parameter.
13895         (Output_data_got::add_global_with_rel): Likewise.
13896         (Output_data_got::add_global_with_rela): Likewise.
13897         (Output_data_got::add_global_pair_with_rel): New function.
13898         (Output_data_got::add_global_pair_with_rela): New function.
13899         (Output_data_got::add_local): Added got_type parameter.
13900         (Output_data_got::add_local_with_rel): Likewise.
13901         (Output_data_got::add_local_with_rela): Likewise.
13902         (Output_data_got::add_local_pair_with_rel): New function.
13903         (Output_data_got::add_local_pair_with_rela): New function.
13904         (Output_data_got::add_global_tls): Removed.
13905         (Output_data_got::add_global_tls_with_rel): Removed.
13906         (Output_data_got::add_global_tls_with_rela): Removed.
13907         (Output_data_got::add_local_tls): Removed.
13908         (Output_data_got::add_local_tls_with_rel): Removed.
13909         (Output_data_got::add_local_tls_with_rela): Removed.
13910         * output.h (Output_data_got::add_global): Added got_type parameter.
13911         (Output_data_got::add_global_with_rel): Likewise.
13912         (Output_data_got::add_global_with_rela): Likewise.
13913         (Output_data_got::add_global_pair_with_rel): New function.
13914         (Output_data_got::add_global_pair_with_rela): New function.
13915         (Output_data_got::add_local): Added got_type parameter.
13916         (Output_data_got::add_local_with_rel): Likewise.
13917         (Output_data_got::add_local_with_rela): Likewise.
13918         (Output_data_got::add_local_pair_with_rel): New function.
13919         (Output_data_got::add_local_pair_with_rela): New function.
13920         (Output_data_got::add_global_tls): Removed.
13921         (Output_data_got::add_global_tls_with_rel): Removed.
13922         (Output_data_got::add_global_tls_with_rela): Removed.
13923         (Output_data_got::add_local_tls): Removed.
13924         (Output_data_got::add_local_tls_with_rel): Removed.
13925         (Output_data_got::add_local_tls_with_rela): Removed.
13926         * resolve.cc (Symbol::override_base_with_special): Removed
13927         reference to has_got_offset_ field.
13928         * symtab.cc (Symbol::init_fields): Replaced initialization
13929         of got_offset_ with got_offsets_.  Removed initialization
13930         of has_got_offset_
13931         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13932         (Symbol::got_offset): Likewise.
13933         (Symbol::set_got_offset): Likewise.
13934         (Symbol::has_tls_got_offset): Removed.
13935         (Symbol::tls_got_offset): Removed.
13936         (Symbol::set_tls_got_offset): Removed.
13937         (Symbol::got_offset_): Removed.
13938         (Symbol::tls_mod_got_offset_): Removed.
13939         (Symbol::tls_pair_got_offset_): Removed.
13940         (Symbol::got_offsets_): New field.
13941         (Symbol::has_got_offset): Removed.
13942         (Symbol::has_tls_mod_got_offset): Removed.
13943         (Symbol::has_tls_pair_got_offset): Removed.
13944         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13945         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13946         member functions.
13947         (Target_x86_64::Scan::global): Likewise.
13948         (Target_x86_64::Relocate::relocate): Likewise.
13949         (Target_x86_64::Relocate::relocate_tls): Likewise.
13950
13951 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13952
13953         * yyscript.y: Fix spelling error in comment.
13954
13955 2008-03-24  Ian Lance Taylor  <iant@google.com>
13956
13957         * options.h (class General_options): Define build_id option.
13958         * layout.h (class Layout): Declare write_build_id, create_note,
13959         create_build_id.  Add build_id_note_ member.
13960         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13961         "libiberty.h", "md5.h", "sha1.h".
13962         (Layout::Layout): Initialize eh_frame_data_,
13963         eh_frame_hdr_section_, and build_id_note_.
13964         (Layout::finalize): Call create_build_id.
13965         (Layout::create_note): New function, broken out of
13966         Layout::create_gold_note.
13967         (Layout::create_gold_note): Call create_note.
13968         (Layout::create_build_id): New function.
13969         (Layout::write_build_id): New function.
13970         (Close_task_runner::run): Call write_build_id.
13971
13972         * x86_64.cc: Correct license to GPLv3.
13973
13974 2008-03-23  Ian Lance Taylor  <iant@google.com>
13975
13976         * options.cc: Include "demangle.h".
13977         (parse_optional_string): New function.
13978         (parse_long_option): Handle takes_optional_argument.
13979         (parse_short_option): Update dash_z initializer.  Handle
13980         takes_optional_argument.
13981         (General_options::General_options): Initialize do_demangle_.
13982         (General_options::finalize): Set do_demangle_.  Handle demangling
13983         style.
13984         * options.h (parse_optional_string): Declare.
13985         (struct One_option): Add optional_arg field.  Update constructor.
13986         Update call constructor calls.  Add takes_optional_argument
13987         function.
13988         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13989         (DEFINE_optional_string): Define.
13990         (General_options::demangle): Change from DEFINE_bool to
13991         DEFINE_optional_string.
13992         (General_options::no_demangle): New function.
13993         (General_options::do_demangle): New function.
13994         (General_options::set_do_demangle): New function.
13995         (General_options::execstack_status_): Move definition to end of
13996         class definition.
13997         (General_options::static_): Likewise.
13998         (General_options::do_demangle_): New field.
13999         * object.cc (big_endian>::get_symbol_location_info): Call
14000         Options::do_demangle, not Options::demangle.
14001         * symtab.cc (demangle): Likewise.
14002
14003 2008-03-22  Ian Lance Taylor  <iant@google.com>
14004
14005         * gold.h: Include <cstddef> and <sys/types.h>
14006         * options.h: Include <cstring>.
14007
14008 2008-03-21  Ian Lance Taylor  <iant@google.com>
14009
14010         * Added source code to GNU binutils.