gold/
[external/binutils.git] / gold / ChangeLog
1 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2
3         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
4         SYMNDX to off_t before comparing it to this->data_size().
5         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
6         * incremental.cc (Output_section_incremental_inputs::do_write):
7         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
8
9 2012-11-01  Roland McGrath  <mcgrathr@google.com>
10
11         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
12
13 2012-11-01  Roland McGrath  <mcgrathr@google.com>
14
15         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
16         parameter, which is unused in the [!F_SETFD] case.
17
18 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
19
20         * gold.cc (Target_arm::do_adjust_elf_header): Add the
21         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
22         in EABI_VER5.
23
24 2012-10-29  Cary Coutant  <ccoutant@google.com>
25
26         * dwp.cc (usage): Add file and exit status parameters;
27         add --help and --version options.
28         (print_version): New function.
29         (main): Add --help and --version options.
30
31 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
32
33         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
34         final_layout_sequence.txt.
35         * testsuite/Makefile.in: Regenerated.
36
37 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
38
39         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
40         COMPILE generated by automake.
41         (LINK1): Likewise.
42         (CXXCOMPILE1): Likewise.
43         (CXXLINK1): Likewise.
44         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
45         (LINK): Likewise.
46         (CXXCOMPILE): Likewise.
47         (CXXLINK): Likewise.
48         * testsuite/Makefile.in: Regenerated.
49
50 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
51
52         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
53         on bad fwrite return.
54
55 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
56
57         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
58         on val.
59
60 2012-10-23  Cary Coutant  <ccoutant@google.com>
61
62         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
63         * testsuite/Makefile.in: Regenerate.
64         * testsuite/dwp_test.h: New source file.
65         * testsuite/dwp_test_1.cc: New source file.
66         * testsuite/dwp_test_1.s: New source file.
67         * testsuite/dwp_test_1.sh: New source file.
68         * testsuite/dwp_test_1b.cc: New source file.
69         * testsuite/dwp_test_1b.s: New source file.
70         * testsuite/dwp_test_2.cc: New source file.
71         * testsuite/dwp_test_2.s: New source file.
72         * testsuite/dwp_test_2.sh: New source file.
73         * testsuite/dwp_test_main.cc: New source file.
74         * testsuite/dwp_test_main.s: New source file.
75
76 2012-10-23  Cary Coutant  <ccoutant@google.com>
77
78         * dwp.h: New header file.
79         * dwp.cc: New source file.
80         * gold.h: Move shared declarations to system.h.
81         * system.h: New header file.
82         * Makefile.am: Add dwp.
83         * Makefile.in: Regenerate.
84
85 2012-10-23  Cary Coutant  <ccoutant@google.com>
86
87         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
88         Dwarf_info_reader::read_from_pointer.
89         (Dwarf_pubnames_table::read_header): Likewise.
90         (Dwarf_pubnames_table::next_name): Likewise.
91         (Dwarf_die::read_attributes): Likewise.
92         (Dwarf_die::skip_attributes): Likewise.
93         (Dwarf_info_reader::read_from_pointer): New function template.
94         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
95         (Dwarf_pubnames_table): Likewise.
96         (Dwarf_info_reader::read_from_pointer): New function template.
97         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
98         Dwarf_pubnames_table ctor.
99
100 2012-10-23  Cary Coutant  <ccoutant@google.com>
101
102         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
103         abbrev_shndx.
104         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
105         abbrev_shndx_.
106         (Dwarf_info_reader::set_abbrev_shndx): New method.
107         (Dwarf_info_reader::abbrev_shndx_): New data member.
108
109 2012-10-23  Cary Coutant  <ccoutant@google.com>
110
111         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
112         from object, not parameters.
113         (Dwarf_info_reader::parse): Likewise.
114         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
115         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
116         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
117         methods.
118
119 2012-10-23  Cary Coutant  <ccoutant@google.com>
120
121         * fileread.cc (Input_file::Input_file): New constructor.
122         * fileread.h (class Input_file): Add new constructor.
123
124 2012-10-18  Alan Modra  <amodra@gmail.com>
125
126         PR gold/14727
127         * object.cc (Relobj::is_section_name_included): Also match
128         .sdata personality section.
129
130 2012-10-18  Alan Modra  <amodra@gmail.com>
131
132         * target-reloc.h (class Default_comdat_behavior): New, package up..
133         (get_comdat_behaviour): ..this.
134         (relocate_section): Add Relocate_comdat_behavior template arg,
135         adjust code to suit.
136         * arm.cc (Target_arm::relocate_section): Adjust to suit.
137         (Target_arm::scan_reloc_section): Likewise.
138         * i386.cc (Target_i386::relocate_section): Likewise.
139         * sparc.cc (Target_sparc::relocate_section): Likewise.
140         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
141         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
142         * powerpc.cc (class Relocate_comdat_behavior): New.
143         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
144         gold::relocate_section with new template arg.
145
146 2012-10-18  Alan Modra  <amodra@gmail.com>
147
148         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
149         dynamic relocs for GOT_TPREL got entries, without symbol if
150         resolving locally.
151         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
152         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
153         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
154
155 2012-10-17  Alan Modra  <amodra@gmail.com>
156
157         PR gold/14726
158         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
159
160 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
161
162         * layout.cc (Layout::include_section): Keep sections marked
163         SHF_EXCLUDE when doing relocatable links.
164
165 2012-10-16  Alan Modra  <amodra@gmail.com>
166
167         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
168         (Target_powerpc::do_finalize_sections): Call it.
169         (Output_data_save_res): New class and supporting functions.
170         (Target_powerpc::symval_for_branch): Only look up .opd entry for
171         normal symbols defined in object files.
172
173 2012-10-12  Alan Modra  <amodra@gmail.com>
174
175         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
176         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
177         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
178         section if scan_opd_relocs not yet called.
179         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
180
181 2012-10-12  Alan Modra  <amodra@gmail.com>
182
183         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
184         add_local_ifunc_entry): Revert last change.
185         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
186
187 2012-10-05  Alan Modra  <amodra@gmail.com>
188
189         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
190         do_plt_address_for_global): New functions.
191         (Output_data_got_powerpc::do_write): Don't segfault when linking
192         statically.
193         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
194         add_local_ifunc_entry): Return true on adding entry..
195         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
196         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
197         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
198         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
199         set up symbols here.
200         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
201         syms here.  Do so even when no .iplt.  Don't segfault when linking
202         statically.
203         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
204         new variants without reloc param.
205         (Glink_sym_ent::Glink_sym_ent): Likewise.
206         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
207         reloc when refs will resolve to plt call stub.
208         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
209         R_PPC_PLTREL24 to resolve locally.
210         (Target_powerpc::Scan::global): Correct ifunc handling.
211         (Target_powerpc::Relocate::relocate): Correct local sym glink
212         lookup.  Don't destroy "value" when we have a plt call stub,
213         and when checking plt call validity.
214         (Target_powerpc::do_dynsym_value): Simplify.
215
216 2012-10-05  Alan Modra  <amodra@gmail.com>
217
218         * i386.cc (Output_data_plt_i386::address_for_global,
219         address_for_local): Add plt offset to returned value.  Adjust uses.
220         * sparc.cc (Output_data_plt_sparc::address_for_global,
221         address_for_local): Likewise.
222         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
223         address_for_local): Likewise.
224         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
225         address_for_local): Likewise.
226         * target.h (Target::plt_address_for_global, plt_address_for_local):
227         Update comment.
228         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
229         (Output_data_got::Got_entry::write): Nor here.
230         * output.h: Comment fix.
231
232 2012-10-02  Jiong Wang  <jiwang@tilera.com>
233
234         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
235         global_offset_table_ value for larget got.
236         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
237
238 2012-09-29  Alan Modra  <amodra@gmail.com>
239
240         * powerpc.cc (Target_powerpc::iplt_): New output section.
241         (Target_powerpc::iplt_section, make_iplt_section,
242         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
243         (Target_powerpc::make_plt_entry): Handle ifunc syms.
244         Target_powerpc::plt_entry_count): Count iplt entries too.
245         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
246         reloc section in constructor.  New params.
247         (Target_powerpc::make_plt_section): Create reloc section here instead.
248         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
249         functions.
250         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
251         (Output_data_glink::add_entry, find_entry): New functions to
252         deal with local syms.
253         (Glink_sym_ent): Add support for local syms.
254         (Output_data_glink::do_write): Handle ifunc plt entries.
255         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
256         (Target_powerpc::Scan::local, global): Handle ifunc syms.
257         (Target_powerpc::Relocate::relocate): Likewise.
258         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
259
260 2012-09-25  Alan Modra  <amodra@gmail.com>
261
262         * object.h (Sized_relobj_file::adjust_local_symbol,
263         do_adjust_local_symbol): New functions.
264         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
265         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
266         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
267         and irregular opd entry spacing.
268         (Powerpc_relobj::do_read_relocs): Add opd size checks.
269         (Global_symbol_visitor_opd): New functor.
270         (Target_powerpc::do_finalize_sections): Omit global symbols defined
271         on deleted opd entries.
272
273 2012-09-15  Jiong Wang  <jiwang@tilera.com>
274
275         * tilegx.cc: New file.
276         * Makefile.am (TARGETSOURCES): Add tilegx.cc
277         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
278         * configure.tgt: Add entries for tilegx*.
279         * configure.ac: Likewise.
280         * Makefile.in: Rebuild.
281         * configure: Likewise.
282         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
283         tilegx.
284
285 2012-09-13  Alan Modra  <amodra@gmail.com>
286
287         * target-reloc.h (scan_relocs): Call scan.local for relocs
288         against symbols in discarded sections.  Pass is_discarded
289         param.
290         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
291         Add is_discarded param.
292         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
293         is_discarded to flag opd entry as discarded.  Don't emit dyn
294         relocs on such entries.
295         (Target_powerpc::Scan::global): Similarly detect and handle
296         such opd entries.
297         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
298         opd_ent_.  Update all uses.
299         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
300         (Target_powerpc::relocate_section): Zero out discarded opd
301         entry relocs.
302
303 2012-09-12  Ian Lance Taylor  <iant@google.com>
304
305         PR gold/14570
306         * output.cc: Rename Output_data_got template parameter from size
307         to got_size for all functions.  Compile all variants of
308         Output_data_got.
309         (Output_data_got::Got_entry::write): Correct use of size for
310         symbol value.  Use local_is_tls rather than casting to
311         Sized_relobj_file.
312         * object.h (class Object): Add local_is_tls and do_local_is_tls.
313         (class Sized_relobj_file): Add do_local_is_tls.
314         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
315
316 2012-09-11  Alan Modra  <amodra@gmail.com>
317
318         PR gold/14566
319         * layout.cc (Layout::set_segment_offsets): When using
320         common-page-size alignment, ensure we are on a new max-page-size
321         page.
322         * output.cc (Output_segment::set_section_addresses): Use
323         abi_pagesize, not common_pagesize for relro boundary.
324         (Output_segment::set_offset): Likewise.
325
326 2012-09-11  Alan Modra  <amodra@gmail.com>
327
328         * output.h (Output_data_got::add_global_tls, add_local_tls,
329         add_local_tls_pair): New functions.
330         (Output_data_got::add_local_pair_with_rel): Remove second
331         reloc param.  Expand comment.
332         (Output_data_got::Got_entry): Rename use_plt_offset_ to
333         use_plt_or_tls_offset_, similarly for constructor param.
334         (Output_data_got::Got_entry::write): Add got_index param.
335         * output.cc (Output_data_got::add_global_tls, add_local_tls,
336         add_local_tls_pair): New functions.
337         (Output_data_got::Got_entry::write): Handle tls symbols
338         with use_plt_or_tls_offset_ set specially.
339         (Output_data_got::add_local_pair_with_rel): Only one reloc.
340         (Output_data_got::do_write): Replace iterator with index, pass
341         index to entry write function.
342         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
343         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
344         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
345         call.
346         * i386.cc (Target_i386::Scan::local): Likewise.
347         * sparc.cc (Target_sparc::Scan::local): Likewise.
348         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
349         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
350         do_tls_offset_for_global): New functions.
351         (Target_powerpc::Scan::local): Correct TLS relocations and got
352         entry values.
353         (Target_powerpc::Scan::global): Don't emit unnecessary
354         dynamic relocations on TLS GOT entries.
355
356 2012-09-10  Matthias Klose  <doko@ubuntu.com>
357
358         * config.in: Disable sanity check for kfreebsd.
359
360 2012-09-10  Sterling Augustine  <saugustine@google.com>
361
362         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
363         (Gdb_index::pubtypes_read): New parameter.
364         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
365         to calls.
366         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
367         pubtypes_object_.
368
369 2012-09-09  Alan Modra  <amodra@gmail.com>
370
371         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
372         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
373         * gc.h (gc_process_relocs): Call target gc_add_reference.
374         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
375         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
376         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
377         unnecessary cast.
378         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
379         to cater for when we don't need code offset.  Update use.
380         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
381         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
382         set_opd_valid): New functions.
383         (Target_powerpc::do_gc_add_reference): New function.
384         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
385         stashed refs.
386         (Target_powerpc::do_gc_mark_symbol): New function.
387
388 2012-09-06  Cary Coutant  <ccoutant@google.com>
389
390         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
391         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
392         (Dwarf_die::skip_attributes): Likewise.
393         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
394         * testsuite/gdb_index_test.cc (inline_func_1): New function.
395         (main): Call it.
396         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
397
398 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
399
400         * testsuite/script_test_3.t: Add .got.plt output section
401         statement.
402         * testsuite/script_test_4.t: Likewise.
403
404 2012-09-05  Alan Modra  <amodra@gmail.com>
405
406         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
407         update all uses and lose "enum" when using type.
408
409 2012-09-05  Alan Modra  <amodra@gmail.com>
410
411         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
412         * configure: Regenerate.
413         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
414         (plugin_final_layout.stdout): Likewise.
415         (memory_test): Set page sizes to 0x1000.
416         * testsuite/Makefile.in: Regenerate.
417         * testsuite/discard_locals_test.sh: Add FIXME comment.
418         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
419         * testsuite/pr14265.t: Add .got output section statement.
420         * testsuite/script_test_2.t: Likewise.
421         * testsuite/script_test_3.t: Likewise.
422         * testsuite/script_test_4.t: Likewise.
423         * testsuite/script_test_5.t: Likewise.
424         * testsuite/script_test_6.t: Likewise.
425         * testsuite/script_test_7.t: Likewise.
426         * testsuite/script_test_9.t: Likewise.
427
428 2012-09-05  Alan Modra  <amodra@gmail.com>
429
430         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
431         (Powerpc_relocate_functions::Status): New typedef.
432         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
433         (Target_powerpc::Scan::local): Handle REL64.
434         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
435         for REL32 and REL64.
436         (Target_powerpc::symval_for_branch): New function, extracted from..
437         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
438         checks.  Report overflow errors.
439
440 2012-09-05  Alan Modra  <amodra@gmail.com>
441
442         * object.h (Sized_relobj_file::emit_relocs): Delete.
443         (Sized_relobj_file::emit_relocs_reltype): Delete.
444         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
445         relocate_relocs for --emit-relocs.
446         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
447         * output.h: Update comment.
448         (Output_segment::first_section): New function.
449         (Output_segment::first_section_load_address): Use first_section.
450         * output.cc (Output_segment::first_section): New function extracted..
451         (Output_segment::first_section_load_address): ..from here.  Delete.
452         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
453         * target.h (Sized_target::relocate_for_relocatable): Likewise.
454         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
455         adjust call to target.h function.
456         * i386.cc (Target_i386): Likewise.
457         * sparc.cc (Target_sparc): Likewise.
458         * x86_64.cc (Target_x86_64): Likewise.
459         * powerpc.cc (Target_powerpc): Likewise.
460         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
461         first tls section has section symbol for optimised local dynamic
462         output relocs.
463         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
464         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
465         optimised tls code.
466         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
467         Rename to relocate_relocs.  Update error message.
468
469 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
470
471         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
472         --just-symbols.
473
474 2012-08-31  Alan Modra  <amodra@gmail.com>
475
476         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
477         (Powerpc_relobj::toc_base_offset): New stub function.
478         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
479         got_mod_index_offset to tlsld_got_offset.  Update all refs.
480         (Target_powerpc::Relocate::enum skip_tls): New.
481         (Target_powerpc::call_tls_get_addr_): New var.
482         (Target_powerpc::is_branch_reloc): Move to file scope.
483         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
484         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
485         New functions.
486         (Target_powerpc::enum Got_type): Delete old values, add new ones.
487         (powerpc_info): Correct common_pagesize for ppc64.
488         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
489         (Powerpc_relocate_functions): Add overflow check enums and functions.
490         Add non-shift version of rela, rela_ua.  Delete all rel public
491         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
492         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
493         addr16_ha3, addr14 functions.
494         (Output_data_got_powerpc::add_constant_pair): New function.
495         (Output_data_got_powerpc::got_base_offset): Likewise.
496         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
497         (instruction constants): Sort, add some more.
498         (Output_data_glink::do_write): Add and use Address typedef.  Use
499         object->toc_base_offset() stub for 64-bit.
500         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
501         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
502         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
503         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
504         Always treat .opd relocs as against locally defined symbol.
505         Correct condition for RELATIVE relocs.
506         (Target_powerpc::do_finalize_sections): Test for NULL sections.
507         (Target_powerpc::Relocate::relocate): Use plt call stub as value
508         for 32-bit syms with a plt entry.  Correct ppc64 toc base
509         calculations.  Handle TLS relocs, and more.  Add overflow
510         checking and adjust for Powerpc_relocate_functions changes.
511         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
512         Reinstate --emit-relocs code with FIXME.
513
514 2012-08-30  Alan Modra  <amodra@gmail.com>
515
516         * layout.cc (Layout::set_segment_offsets): Set p_align to
517         abi_pagesize, not common_pagesize.
518         (Layout::relaxation_loop_body): Similarly use abi_pagesize
519         to determine whether file header can go in segment.
520
521 2012-08-30  Alan Modra  <amodra@gmail.com>
522
523         * output.h (Output_reloc::Output_reloc <output section>): Add
524         is_relative param.  Adjust calls.
525         (Output_reloc::add_output_section_relative): New functions.
526         * output.cc (Output_reloc::Output_reloc <output section>): Handle
527         is_relative.
528         (Output_reloc::symbol_value): Handle SECTION_CODE.
529
530 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
531
532         * gold.cc (queue_middle_tasks): Call layout again when unique
533         segments for sections is desired.
534         * layout.cc (Layout::Layout): Initialize new members.
535         (Layout::get_output_section_flags): New function.
536         (Layout::choose_output_section): Call get_output_section_flags.
537         (Layout::layout): Make output section for mapping to a unique segment.
538         (Layout::insert_section_segment_map): New function.
539         (Layout::attach_allocated_section_to_segment): Make unique segment for
540         output sections marked so.
541         (Layout::segment_precedes): Check for unique segments when sorting.
542         * layout.h (Layout::Unique_segment_info): New struct.
543         (Layout::Section_segment_map): New typedef.
544         (Layout::insert_section_segment_map): New function.
545         (Layout::get_output_section_flags): New function.
546         (Layout::is_unique_segment_for_sections_specified): New function.
547         (Layout::set_unique_segment_for_sections_specified): New function.
548         (Layout::unique_segment_for_sections_specified_): New member.
549         (Layout::section_segment_map_): New member.
550         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
551         Rename is_gc_pass_one to is_pass_one.
552         Rename is_gc_pass_two to is_pass_two.
553         Rename is_gc_or_icf to is_two_pass.
554         Check for which pass based on whether symbols data is present.
555         Make it two pass when unique segments for sections is desired.
556         * output.cc (Output_section::Output_section): Initialize new
557         members.
558         * output.h (Output_section::is_unique_segment): New function.
559         (Output_section::set_is_unique_segment): New function.
560         (Output_section::is_unique_segment_): New member.
561         (Output_section::extra_segment_flags): New function.
562         (Output_section::set_extra_segment_flags): New function.
563         (Output_section::extra_segment_flags_): New member.
564         (Output_section::segment_alignment): New function.
565         (Output_section::set_segment_alignment): New function.
566         (Output_section::segment_alignment_): New member.
567         (Output_segment::Output_segment): Initialize is_unique_segment_.
568         (Output_segment::is_unique_segment): New function.
569         (Output_segment::set_is_unique_segment): New function.
570         (Output_segment::is_unique_segment_): New member.
571         * plugin.cc (allow_unique_segment_for_sections): New function.
572         (unique_segment_for_sections): New function.
573         (Plugin::load): Add new functions to transfer vector.
574         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
575         * Makefile.in: Regenerate.
576         * testsuite/plugin_final_layout.sh: Check if unique segment
577         functionality works.
578         * testsuite/plugin_section_order.c (onload): Check if new interfaces
579         are available.
580         (allow_unique_segment_for_sections): New global.
581         (unique_segment_for_sections): New global.
582         (claim_file_hook): Call allow_unique_segment_for_sections.
583         (all_symbols_read_hook): Call unique_segment_for_sections.
584
585 2012-08-22  Cary Coutant  <ccoutant@google.com>
586
587         * layout.cc (Layout::include_section): Don't assert on GROUP
588         sections with --emit-relocs.
589
590 2012-08-21  Cary Coutant  <ccoutant@google.com>
591
592         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
593         if --export-dynamic-symbol names an undef symbol.
594
595 2012-08-18  Alan Modra  <amodra@gmail.com>
596
597         * powerpc.cc: Formatting and white space.
598         (Powerpc_relobj): Rename got2_section_ to special_.
599         Add opd_ent_shndx_ and opd_ent_off_ vectors.
600         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
601         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
602         (Target_powerpc): Add Address typedef and invalid_address.  Use
603         throughout.
604         (Target_powerpc::is_branch_reloc): New function.
605         (Powerpc_relocate_functions): Add Address typedef, use throughout.
606         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
607         for dst_mask, value and addend.
608         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
609         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
610         (Output_data_glink::do_write): Correct toc base.  Don't try to use
611         uint16_t for 24-bit offset.  Use get_output_section_offset and
612         check return.
613         (Target_powerpc::Scan::local): Handle more relocs.
614         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
615         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
616         Plug in toc restoring insn after plt calls.  Translate branches
617         to function descriptor symbols to corresponding entry point.
618         (Target_powerpc::relocate_for_relocatable): Check return from
619         get_output_section_offset.
620         * symtab.h: Comment typo.
621
622 2012-08-14  Ian Lance Taylor  <iant@google.com>
623
624         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
625         unsupported_relocal_local to call unsupported_reloc_global.
626
627 2012-08-14  Nick Clifton  <nickc@redhat.com>
628
629         PR ld/14265
630         * script-sections.cc (Sections_element::output_section_name): Add
631         keep return parameter.
632         (Output_section_element::match_name): Add keep return parameter.
633         Return the value of the keep_ member.
634         * script-sections.h (class Output_section): Update
635         output_section_name prototype.
636         * layout.cc (Layout::keep_input_section): New public member
637         function.
638         (Layout::choose_output_section): Pass keep parameter to
639         output_section_name.
640         * layout.h (class Layout): Add keep_input_section.
641         * object.cc (Sized_relobj_file::do_layout): Check for kept input
642         sections.
643         * testsuite/Makefile.am: Add a test.
644         * testsuite/Makefile.in: Regenerate.
645         * testsuite/pr14265.c: Source file for the test.
646         * testsuite/pr14265.t: Linker script for the test.
647         * testsuite/pr14265.sh: Shell script for the test.
648
649 2012-08-14  Alan Modra  <amodra@gmail.com>
650
651         * target.h (Target::output_section_name): New function.
652         (Target::do_output_section_name): New function.
653         * layout.cc (Layout::choose_output_section): Call the above.
654         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
655
656 2012-08-14  Alan Modra  <amodra@gmail.com>
657
658         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
659         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
660         for replace_constant call.
661         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
662         (Output_data_glink::do_print_to_mapfile): New function.
663         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
664         (Target_powerpc::Relocate::relocate): Likewise.
665
666 2012-08-14  Alan Modra  <amodra@gmail.com>
667
668         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
669         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
670         (Output_data_glink::add_entry,find_entry): Remove shndx param.
671         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
672         all references to shndx_.  Handle special case for R_PPC_PLTREL24
673         here.
674         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
675         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
676         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
677         here.
678         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
679         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
680
681 2012-08-12  Alan Modra  <amodra@gmail.com>
682
683         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
684         (glink insn constants): Use uint32_t.
685         (Output_data_glink::add_entry): Use insert, not [] operator.
686
687 2012-08-11  Alan Modra  <amodra@gmail.com>
688
689         * object.h (Sized_relobj_file::find_shdr): New function.
690         (Sized_relobj_file::find_special_sections): New function.
691         * object.cc (Sized_relobj_file::find_shdr): New function.
692         (Sized_relobj_file::find_eh_frame): Use find_shdr.
693         (Sized_relobj_file::find_special_sections): New function, split out..
694         (Sized_relobj_file::do_read_symbols): ..from here.
695         * output.h (Output_data_got::replace_constant): New function.
696         (Output_data_got::num_entries): New function.
697         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
698         (Output_data_got::got_offset): Protected rather than private.
699         (Output_data_got::replace_got_entry): New function.
700         * output.cc (Output_data_got::replace_got_entry): New function.
701         * powerpc.cc (class Powerpc_relobj): New.
702         (class Powerpc_relocate_functions): Delete all psymval variants or
703         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
704         Implement _ha functions using corresponding _hi function.
705         (Powerpc_relobj::find_special_sections): New function.
706         (Target_powerpc::do_make_elf_object): New function.
707         (class Output_data_got_powerpc): New.
708         (class Output_data_glink): New.
709         (class Powerpc_scan_relocatable_reloc): New.
710         Many more changes througout file.
711
712 2012-08-09  Nick Clifton  <nickc@redhat.com>
713
714         * po/vi.po: Updated Vietnamese translation.
715
716 2012-08-07  Ian Lance Taylor  <iant@google.com>
717
718         * layout.cc (Layout::add_target_dynamic_tags): If
719         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
720         plt_rel.
721
722 2012-07-30  Nick Clifton  <nickc@redhat.com>
723
724         * po/gold.pot: Updated template.
725         * po/es.po: Updated Spanish translation.
726
727 2012-07-18  Cary Coutant  <ccoutant@google.com>
728
729         PR gold/14344
730         * configure.ac: Add check for -gpubnames support.
731         * configure: Regenerate.
732         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
733         support; force -gno-pubnames.
734         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
735         support.
736         (gdb_index_test_4): New test.
737         * testsuite/Makefile.in: Regenerate.
738         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
739         * testsuite/gdb_index_test_2.sh: Likewise.
740         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
741         * testsuite/gdb_index_test_4.sh: New script.
742         * testsuite/gdb_index_test_comm.sh: New script with common code;
743         don't look for space after colon.
744
745 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
746
747         * gold.cc (queue_middle_tasks): Update function order only after
748         deferred objects due to plugins are processed.
749
750 2012-07-11  Ian Lance Taylor  <iant@google.com>
751
752         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
753         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
754         (Target_arm::scan_reloc_for_stub): Likewise.
755         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
756         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
757         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
758         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
759         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
760
761 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
762             Ian Lance Taylor  <iant@google.com>
763
764         PR gold/14309
765         * configure.ac: Test whether std::tr1::hash<off_t> works.
766         * gold.h: Add a specialization for std::tr1::hash<off_t> if
767         needed.
768         * output.h (class Output_fill): Add virtual destructor.
769         * configure, config.in: Rebuild.
770
771 2012-06-22  Roland McGrath  <mcgrathr@google.com>
772
773         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
774
775 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
776
777         * plugin.cc (Plugin::load): Handle position independent executables.
778
779 2012-06-06  Cary Coutant  <ccoutant@google.com>
780
781         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
782         add .debug_macro.
783         (lines_only_debug_sections): Likewise.
784         (gdb_fast_lookup_sections): New static array.
785         (is_gdb_debug_section): Rename formal parameter.
786         (is_lines_only_debug_section): Likewise.
787         (is_gdb_fast_lookup_section): New function.
788         (Layout::include_section): Check for ".zdebug_" prefix; pass
789         section name suffix to is_gdb_debug_section, et al.; check for
790         fast-lookup sections when building .gdb_index.
791         * options.h (--strip-debug-gdb): Update GDB version number.
792
793 2012-06-06  Cary Coutant  <ccoutant@google.com>
794
795         * configure.ac: Add check for fallocate.
796         * configure: Regenerate.
797         * config.in: Regenerate.
798
799         * options.h (class General_options): Add --mmap-output-file and
800         --posix-fallocate options.
801         * output.cc: (posix_fallocate): Remove; replace with...
802         (gold_fallocate): New function.
803         (Output_file::map_no_anonymous): Call gold_fallocate.
804         (Output_file::map): Check --mmap-output-file option.
805
806 2012-06-05  Jing Yu  <jingyu@google.com>
807
808         * gold.h (textdomain): Add do {} to empty while(0).
809         (bindtextdomain): Likewise.
810
811 2012-06-04  Cary Coutant  <ccoutant@google.com>
812
813         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
814         has_dynsym_index.
815
816 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
817
818         * symtab.cc (Symbol_table::define_special_symbol):
819         Initialize *poldsym to prevent uninitialized variable errors.
820
821 2012-05-23  Cary Coutant  <ccoutant@google.com>
822
823         * layout.cc (Layout::section_name_mapping): Add rules to handle
824         exact match on .data.rel.ro.local or .data.rel.ro.
825         (Layout::output_section_name): Check for exact matches.
826
827 2012-05-23  Cary Coutant  <ccoutant@google.com>
828
829         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
830         more carefully.
831
832 2012-05-22  Cary Coutant  <ccoutant@google.com>
833
834         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
835         object before exporting symbol.
836
837 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
838
839         * testsuite/tls_test.cc: Include "config.h" first.
840         * testsuite/tls_test_c.c: Likewise.
841
842 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
843             Nick Clifton  <nickc@redhat.com>
844
845         PR 14072
846         * configure.in: Add check that sysdep.h has been included before
847         any system header files.
848         * configure: Regenerate.
849         * config.in: Regenerate.
850
851 2012-05-14  Cary Coutant  <ccoutant@google.com>
852
853         * layout.cc (Layout::make_output_section): Mark .tdata section
854         as RELRO.
855         * testsuite/relro_test.cc: Add a TLS variable.
856
857 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
858
859         PR gold/14091
860         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
861         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
862         R_X86_64_64.
863
864 2012-05-08  Cary Coutant  <ccoutant@google.com>
865
866         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
867         (lines_only_debug_sections): Likewise.
868
869 2012-05-02  Roland McGrath  <mcgrathr@google.com>
870
871         * nacl.cc: New file.
872         * nacl.h: New file.
873         * Makefile.am (CCFILES, HFILES): Add them.
874         * Makefile.in: Regenerate.
875         * i386.cc (Output_data_plt_i386_nacl): New class.
876         (Output_data_plt_i386_nacl_exec): New class.
877         (Output_data_plt_i386_nacl_dyn): New class.
878         (Target_i386_nacl): New class.
879         (Target_selector_i386_nacl): New class.
880         (target_selector_i386): Use it instead of Target_selector_i386.
881         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
882         (Target_x86_64_nacl): New class.
883         (Target_selector_x86_64_nacl): New class.
884         (target_selector_x86_64, target_selector_x32): Use it instead of
885         Target_selector_x86_64.
886         * arm.cc (Output_data_plt_arm_nacl): New class.
887         (Target_arm_nacl): New class.
888         (Target_selector_arm_nacl): New class.
889         (target_selector_arm, target_selector_armbe): Use it instead of
890         Target_selector_arm.
891
892         * target-select.cc (select_target): Take new Input_file* and off_t
893         arguments, pass them on to recognize method of selector.
894         * object.cc (make_elf_sized_object): Update caller.
895         * parameters.cc (parameters_force_valid_target): Likewise.
896         * incremental.cc (make_sized_incremental_binary): Likewise.
897         * target-select.h: Update decl.
898         (Target_selector::recognize): Take new Input_file* argument,
899         pass it on to do_recognize.
900         (Target_selector::do_recognize): Take new Input_file* argument.
901         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
902         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
903         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
904         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
905
906         * target.h (Target::Target_info): New members isolate_execinstr
907         and rosegment_gap.
908         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
909         * arm.cc (Target_arm::arm_info): Update initializer.
910         * i386.cc (Target_i386::i386_info): Likewise.
911         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
912         * sparc.cc (Target_sparc::sparc_info): Likewise.
913         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
914         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
915         * layout.cc (Layout::attach_allocated_section_to_segment):
916         Take new const Target* argument.  If target->isolate_execinstr(), act
917         like --rosegment.
918         (Layout::find_first_load_seg): Take new const Target* argument;
919         if target->isolate_execinstr(), reject PF_X segments.
920         (Layout::relaxation_loop_body): Update caller.
921         (Layout::set_segment_offsets): If target->isolate_execinstr(),
922         reset file offset to zero when we hit LOAD_SEG, and then do a second
923         loop over the segments before LOAD_SEG to reassign offsets after
924         addresses have been determined.  Handle target->rosegment_gap().
925         (Layout::attach_section_to_segment): Take new const Target* argument;
926         pass it to attach_allocated_section_to_segment.
927         (Layout::make_output_section): Update caller.
928         (Layout::attach_sections_to_segments): Take new const Target* argument;
929         pass it to attach_section_to_segment.
930         * gold.cc (queue_middle_tasks): Update caller.
931         * layout.h (Layout): Update method decls with new arguments.
932
933         * arm.cc (Target_arm::Target_arm): Take optional argument for the
934         Target_info pointer to use.
935         (Target_arm::do_make_data_plt): New virtual method.
936         (Target_arm::make_data_plt): New method that calls it.
937         (Target_arm::make_plt_entry): Use it.
938         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
939         for the section alignment.
940         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
941         method.
942         (Output_data_plt_arm::first_plt_entry_offset): Call it.
943         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
944         method.
945         (Output_data_plt_arm::get_plt_entry_size): Call it.
946         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
947         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
948         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
949         method.
950         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
951         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
952         method instead of sizeof(plt_entry).
953         (Output_data_plt_arm::add_entry): Likewise.
954         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
955         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
956         than static method.
957         (Target_arm::plt_entry_size): Likewise.
958         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
959         Move to ...
960         (Output_data_plt_arm_standard): ... here, new class.
961         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
962         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
963         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
964
965         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
966         Take additional argument for the PLT entry size.
967         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
968         Use get_plt_entry_size method rather than plt_entry_size variable.
969         (Output_data_plt_x86_64::reserve_slot): Likewise.
970         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
971         (Output_data_plt_x86_64::add_entry): Likewise.
972         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
973         (Output_data_plt_x86_64::address_for_global): Likewise.
974         (Output_data_plt_x86_64::address_for_local): Likewise.
975         (Output_data_plt_x86_64::set_final_data_size): Likewise.
976         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
977         Make method non-static.
978         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
979         method.
980         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
981         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
982         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
983         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
984         virtual method.
985         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
986         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
987         virtual method.
988         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
989         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
990         virtual method.
991         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
992         (Output_data_plt_x86_64::plt_entry_size)
993         (Output_data_plt_x86_64::first_plt_entry)
994         (Output_data_plt_x86_64::plt_entry)
995         (Output_data_plt_x86_64::tlsdesc_plt_entry)
996         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
997         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
998         (Output_data_plt_x86_64_standard): ... here, new class.
999         (Target_x86_64::Target_x86_64): Take optional argument for the
1000         Target_info pointer to use.
1001         (Target_x86_64::do_make_data_plt): New virtual method.
1002         (Target_x86_64::make_data_plt): New method to call it.
1003         (Target_x86_64::init_got_plt_for_update): Use that.
1004         Call this->plt_->add_eh_frame method here.
1005         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1006         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1007         rather than static method.
1008         (Target_x86_64::plt_entry_size): Likewise.
1009         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1010         rather than plt_entry_size variable.  Move guts of PLT filling to...
1011         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1012         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1013         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1014
1015         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1016         additional argument for the section alignment.
1017         Don't do add_eh_frame_for_plt here.
1018         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1019         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1020         variable.
1021         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1022         method.
1023         (Output_data_plt_i386::get_plt_entry_size): Call it.
1024         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1025         (Output_data_plt_i386::add_eh_frame): New method to call it.
1026         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1027         method.
1028         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1029         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1030         method.
1031         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1032         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1033         method instead of plt_entry_size.
1034         (Output_data_plt_i386::plt_entry_size)
1035         (Output_data_plt_i386::plt_eh_frame_fde_size)
1036         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1037         (Output_data_plt_i386_standard): ... here, new class.
1038         (Output_data_plt_i386_exec): New class.
1039         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1040         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1041         (Output_data_plt_i386::exec_plt_entry): Move to ...
1042         (Output_data_plt_i386_exec::plt_entry): ... here.
1043         (Output_data_plt_i386_dyn): New class.
1044         (Output_data_plt_i386::first_plt_entry): Move to ...
1045         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1046         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1047         (Output_data_plt_i386_dyn::plt_entry): ... here.
1048         (Target_i386::Target_i386): Take optional argument for the Target_info
1049         pointer to use.
1050         (Target_i386::do_make_data_plt): New virtual method.
1051         (Target_i386::make_data_plt): New method to call it.
1052         (Target_i386::make_plt_section): Use that.
1053         Call this->plt_->add_eh_frame method here.
1054         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1055         rather than plt_entry_size variable.
1056         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1057         (Output_data_plt_i386::address_for_local): Likewise.
1058         (Output_data_plt_i386::do_write): Likewise.
1059         Move guts of PLT filling to...
1060         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1061         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1062         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1063         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1064
1065 2012-05-01  Cary Coutant  <ccoutant@google.com>
1066
1067         * dwarf_reader.cc (Dwarf_die::read_attributes)
1068         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1069         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1070         * reduced_debug_output.cc
1071         (Output_reduced_debug_info_section::get_die_end): Remove
1072         DW_FORM_GNU_ref_index.  Add default case.
1073
1074 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1075
1076         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1077         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1078         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1079         DW_AT_high_pc as offset from DW_AT_low_pc.
1080
1081         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1082         * testsuite/Makefile.in: Regenerate.
1083         * testsuite/gdb_index_test_3.c: New test source file.
1084         * testsuite/gdb_index_test_3.sh: New test source file.
1085
1086 2012-04-25  Ian Lance Taylor  <iant@google.com>
1087
1088         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1089         pointer.
1090         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1091         as a class, not a struct.
1092         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1093         (Target_arm::apply_cortex_a8_workaround): Likewise.
1094         * gc.h: Declare Reloc_types as a struct, not a class.
1095         * object.h: Declare Symbols_data as a struct.
1096         * reloc.h: Declare Read_relocs_data as a struct.
1097         * target.h: Declare Relocate_info as a struct.
1098
1099 2012-04-24  David S. Miller  <davem@davemloft.net>
1100
1101         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1102         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1103         and R_SPARC_WPLT30.
1104
1105 2012-04-24  Cary Coutant  <ccoutant@google.com>
1106
1107         * incremental-dump.cc (find_input_containing_global): Replace
1108         magic number with symbolic constant.
1109         (dump_incremental_inputs): Update version number.
1110         * incremental.cc (Output_section_incremental_inputs): Update version
1111         number; import symbolic constants from Incremental_inputs_reader.
1112         (Incremental_inputs::create_data_sections): Align relocations
1113         section correctly for 64-bit targets.
1114         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1115         constants; add padding.
1116         (Output_section_incremental_inputs::write_header): Add assert for
1117         header_size.
1118         (Output_section_incremental_inputs::write_input_files): Add assert
1119         for input_entry_size.
1120         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1121         add assert for object_info_size, input_section_entry_size,
1122         global_sym_entry_size.
1123         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1124         for data structure sizes; use them.
1125         (Incremental_input_entry_reader): Import symbolic constants from
1126         Incremental_inputs_reader; use them.
1127
1128 2012-04-23  David S. Miller  <davem@davemloft.net>
1129
1130         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1131         and elf_flags_set_.
1132         (Target_sparc::Target_sparc): Initialize new fields.
1133         (Target_sparc::do_make_elf_object): New function.
1134         (Target_sparc::do_adjust_elf_header): New function.
1135
1136 2012-04-23  Cary Coutant  <ccoutant@google.com>
1137
1138         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1139         CU range table of gdb index.
1140
1141 2012-04-20  David S. Miller  <davem@davemloft.net>
1142
1143         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1144         instead of false.
1145
1146 2012-04-16  David S. Miller  <davem@davemloft.net>
1147
1148         * sparc.cc (Target_sparc::got_address): New function.
1149         (Sparc_relocate_functions::gdop_hix22): New function.
1150         (Sparc_relocate_functions::gdop_lox10): New function.
1151         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1152         relocs.
1153         (Target_sparc::Scan::local): Likewise if the global symbol is not
1154         preemptible and is not IFUNC.
1155         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1156         transformations for local and non-preemptible non-IFUNC global
1157         symbols.
1158
1159         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1160         writing out 64-bit part of ranges.
1161
1162         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1163         -fpic and -fpie respectively.
1164         * Makefile.in: Regenerate.
1165
1166         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1167         (Target_sparc::Target_sparc): Initialize new field.
1168         (Target_sparc::do_plt_section_for_global): New function.
1169         (Target_sparc::do_plt_section_for_local): New function.
1170         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1171         (Target_sparc::make_plt_section): New function, broken out of
1172         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1173         (Target_sparc::make_plt_entry): Call make_plt_section.
1174         (Target_sparc::make_local_ifunc_plt_entry): New function.
1175         (Target_sparc::rela_ifunc_section): New function.
1176         (Target_sparc::plt_section): Remove const.
1177         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1178         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1179         and ifunc_count_ fields.
1180         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1181         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1182         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1183         (Output_data_plt_sparc::rela_ifunc): New function.
1184         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1185         (Output_data_plt_sparc::has_ifunc_section): New function.
1186         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1187         (Output_data_plt_sparc::address_for_global): New function.
1188         (Output_data_plt_sparc::address_for_local): New function.
1189         (Output_data_plt_sparc::plt_index_to_offset): New function.
1190         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1191         and entry_count.
1192         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1193         entry_count.
1194         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1195         R_SPARC_JMP_IREL to switch.
1196         (Target_sparc::Scan::check_non_pic): Likewise.
1197         (Target_sparc::Scan::local): Handle IFUNC symbols.
1198         (Target_sparc::Scan::local): Likewise.
1199         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1200         and plt_address_for_local.
1201         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1202         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1203
1204         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1205         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1206         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1207         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1208         global relocs too.
1209         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1210         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1211         calls.
1212         * sparc.cc (Target_sparc::Scan::global): Likewise.
1213         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1214
1215 2012-04-16  Cary Coutant  <ccoutant@google.com>
1216
1217         * archive.cc (Library_base::should_include_member): Check for
1218         --export-dynamic-symbol.
1219         * options.h (class General_options): Add --export-dynamic-symbol.
1220         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1221         --export-dynamic-symbol.
1222         (Symbol_table::gc_mark_undef_symbols): Likewise.
1223         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1224
1225 2012-04-12  David S. Miller  <davem@davemloft.net>
1226
1227         * sparc.cc (Reloc::wdisp10): New relocation method.
1228         (Reloc::h34): Likewise.
1229         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1230         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1231         R_SPARC_WDISP10.
1232         (Target_sparc::Scan::local): Likewise.
1233         (Target_sparc::Scan::global): Likewise.
1234         (Target_sparc::Relocate::relocate): Likewise.
1235
1236 2012-04-09  Cary Coutant  <ccoutant@google.com>
1237
1238         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1239         low_pc == 0.
1240
1241 2012-04-06  Ian Lance Taylor  <iant@google.com>
1242
1243         * timer.cc: #include <unistd.h>.
1244
1245 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1246
1247         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1248         * config.in: Regenerate.
1249         * configure: Regenerate.
1250
1251 2012-04-05  Nick Clifton  <nickc@redhat.com>
1252
1253         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1254         (AM_LC_MESSAGES): Add.
1255         * aclocal.m4: Regenerate.
1256         * config.in: Regenerate.
1257         * configure: Regenerate.
1258
1259 2012-03-21  Cary Coutant  <ccoutant@google.com>
1260
1261         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1262         * Makefile.in: Regenerate.
1263         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1264         (Sized_elf_reloc_mapper::symbol_section): New function.
1265         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1266         (make_elf_reloc_mapper): New function.
1267         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1268         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1269         (Dwarf_abbrev_table::do_get_abbrev): New function.
1270         (Dwarf_ranges_table::read_ranges_table): New function.
1271         (Dwarf_ranges_table::read_range_list): New function.
1272         (Dwarf_pubnames_table::read_section): New function.
1273         (Dwarf_pubnames_table::read_header): New function.
1274         (Dwarf_pubnames_table::next_name): New function.
1275         (Dwarf_die::Dwarf_die): New function.
1276         (Dwarf_die::read_attributes): New function.
1277         (Dwarf_die::skip_attributes): New function.
1278         (Dwarf_die::set_name): New function.
1279         (Dwarf_die::set_linkage_name): New function.
1280         (Dwarf_die::attribute): New function.
1281         (Dwarf_die::string_attribute): New function.
1282         (Dwarf_die::int_attribute): New function.
1283         (Dwarf_die::uint_attribute): New function.
1284         (Dwarf_die::ref_attribute): New function.
1285         (Dwarf_die::child_offset): New function.
1286         (Dwarf_die::sibling_offset): New function.
1287         (Dwarf_info_reader::check_buffer): New function.
1288         (Dwarf_info_reader::parse): New function.
1289         (Dwarf_info_reader::do_parse): New function.
1290         (Dwarf_info_reader::do_read_string_table): New function.
1291         (Dwarf_info_reader::lookup_reloc): New function.
1292         (Dwarf_info_reader::get_string): New function.
1293         (Dwarf_info_reader::visit_compilation_unit): New function.
1294         (Dwarf_info_reader::visit_type_unit): New function.
1295         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1296         Sized_elf_reloc_mapper.
1297         (Sized_dwarf_line_info::symbol_section): Remove function.
1298         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1299         (Sized_dwarf_line_info::read_line_mappings): Remove object
1300         parameter, adjust callers.
1301         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1302         * dwarf_reader.h: Include <sys/types.h>.
1303         (class Track_relocs): Remove forward declaration.
1304         (class Elf_reloc_mapper): New class.
1305         (class Sized_elf_reloc_mapper): New class.
1306         (class Dwarf_abbrev_table): New class.
1307         (class Dwarf_range_list): New class.
1308         (class Dwarf_ranges_table): New class.
1309         (class Dwarf_pubnames_table): New class.
1310         (class Dwarf_die): New class.
1311         (class Dwarf_info_reader): New class.
1312         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1313         (Sized_dwarf_line_info::symbol_section): Remove member function.
1314         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1315         base class.
1316         * gdb-index.cc: New source file.
1317         * gdb-index.h: New source file.
1318         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1319         and .debug_types sections, call Layout::add_to_gdb_index.
1320         (Sized_relobj_incr::do_section_name): Implement.
1321         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1322         return type; Implement.
1323         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1324         return type.
1325         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1326         parameter list and return type.
1327         (Sized_incr_dynobj::do_section_contents): Likewise.
1328         * layout.cc: Include gdb-index.h.
1329         (Layout::Layout): Initialize gdb_index_data_.
1330         (Layout::init_fixed_output_section): Check for .gdb_index section.
1331         (Layout::add_to_gdb_index): New function. Instantiate.
1332         * layout.h: Add forward declaration for class Gdb_index.
1333         (Layout::add_to_gdb_index): New member function.
1334         (Layout::gdb_index_data_): New data member.
1335         * main.cc: Include gdb-index.h.
1336         (main): Print statistics for gdb index.
1337         * object.cc (Object::section_contents): Move code into
1338         do_section_contents.
1339         (need_decompressed_section): Check for sections needed when building
1340         gdb index.
1341         (build_compressed_section_map): Likewise.
1342         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1343         gdb index.
1344         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1345         sections; call Layout::add_to_gdb_index.
1346         (Sized_relobj_file::do_decompressed_section_contents): Call
1347         do_section_contents directly.
1348         * object.h (Object::do_section_contents): Adjust parameter list and
1349         return type.
1350         (Object::do_decompressed_section_contents): Call do_section_contents
1351         directly.
1352         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1353         return type.
1354         * options.h (class General_options): Add --gdb-index option.
1355         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1356         list and return type.
1357         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1358         * reloc.h (Track_relocs::checkpoint): New function.
1359         (Track_relocs::reset): New function.
1360
1361         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1362         New test cases.
1363         * testsuite/Makefile.in: Regenerate.
1364         * testsuite/gdb_index_test.cc: New test source file.
1365         * testsuite/gdb_index_test_1.sh: New test source file.
1366         * testsuite/gdb_index_test_2.sh: New test source file.
1367
1368 2012-03-19  Doug Kwan  <dougkwan@google.com>
1369
1370         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1371         (Target_arm::do_finalize_sections): Remove code which defines
1372         __exidx_start and __exidx_end.  Make symbol table parameter
1373         anonymous as it is not used.
1374         * gold.cc (queue_middle_tasks): Call target hook to define any
1375         target-specific symbols.
1376         * target.h (Target::define_standard_symbols): New method.
1377         (Target::do_define_standard_symbols): Same.
1378         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1379         * testsuite/Makefile.in: Regenerate.
1380         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1381         and __exidx_end.
1382         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1383         relocations are generated for __exidx_start and __exidx_end.
1384
1385 2012-03-16  Doug Kwan  <dougkwan@google.com>
1386
1387         * testsuite/Makefile.am: Disable test initpri3b.
1388         * testsuite/Makefile.in: Regenerate.
1389
1390 2012-03-15  Doug Kwan  <dougkwan@google.com>
1391
1392         * arm.cc (Target_arm::got_section): Make .got section read-only
1393         if -z now is given.
1394
1395 2012-03-15  Ian Lance Taylor  <iant@google.com>
1396
1397         PR gold/13850
1398         * layout.cc (Layout::make_output_section): Correctly mark
1399         SHT_INIT_ARRAY, et. al., as relro.
1400
1401 2012-03-14  Doug Kwan  <dougkwan@google.com>
1402
1403         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1404         dynamic relocations for protected symbols in shared objects.
1405
1406 2012-03-13  Ian Lance Taylor  <iant@google.com>
1407
1408         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1409         keep the larger alignment.
1410
1411 2012-03-12  Cary Coutant  <ccoutant@google.com>
1412
1413         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1414         handling of DW_LNE_define_file.
1415
1416 2012-03-12  Cary Coutant  <ccoutant@google.com>
1417
1418         * reduced_debug_output.cc
1419         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1420         codes to switch.
1421
1422 2012-02-29  Cary Coutant  <ccoutant@google.com>
1423
1424         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1425
1426 2012-02-29  Cary Coutant  <ccoutant@google.com>
1427
1428         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1429         Call Object::decompressed_section_contents.
1430         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1431         New dtor.
1432         (Sized_dwarf_line_info::buffer_start_): New data member.
1433         * merge.cc (Output_merge_data::do_add_input_section): Call
1434         Object::decompressed_section_contents.
1435         (Output_merge_string::do_add_input_section): Likewise.
1436         * object.cc (need_decompressed_section): New function.
1437         (build_compressed_section_map): Decompress sections needed later.
1438         (Sized_relobj_file::do_decompressed_section_contents): New function.
1439         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1440         * object.h (Object::decompressed_section_contents): New function.
1441         (Object::discard_decompressed_sections): New function.
1442         (Object::do_decompressed_section_contents): New function.
1443         (Object::do_discard_decompressed_sections): New function.
1444         (Compressed_section_info): New type.
1445         (Compressed_section_map): Include decompressed section contents.
1446         (Sized_relobj_file::do_decompressed_section_contents): New function.
1447         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1448
1449 2012-02-16  Cary Coutant  <ccoutant@google.com>
1450
1451         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1452         * testsuite/Makefile.in: Regenerate.
1453
1454 2012-02-14  Cary Coutant  <ccoutant@google.com>
1455
1456         * options.cc (General_options::finalize): Disallow -pie and -static.
1457
1458 2012-02-03  Doug Kwan  <dougkwan@google.com>
1459
1460         * arm.cc (Arm_relocate_functions::abs8,
1461         Arm_relocate_functions::abs16): Use
1462         Bits::has_signed_unsigned_overflow32.
1463         (Arm_relocate_functions::thm_abs8): Correct range of
1464         overflow check.
1465         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1466         in assertions.
1467
1468 2012-02-02  Doug Kwan  <dougkwan@google.com>
1469
1470         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1471         position independent outputs, not just shared objects.
1472
1473 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1474
1475         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1476         * configure: Regenerated.
1477
1478 2012-01-27  Ian Lance Taylor  <iant@google.com>
1479
1480         * reloc.h (Bits): New class with static functions, copied from
1481         namespace utils in arm.cc.
1482         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1483         instead.
1484
1485 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1486
1487         * incremental.cc (write_info_blocks): Correct relocation offset.
1488
1489 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1490
1491         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1492         (Relocate::tls_gd_to_le): Likewise.
1493
1494 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1495
1496         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1497
1498 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1499
1500         * configure.ac: Check if -mcmodel=medium works.
1501         * configure: Regenerated.
1502
1503 2012-01-24  Cary Coutant  <ccoutant@google.com>
1504
1505         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1506         definition and ...
1507         (read_unsigned_LEB_128_x): ... this new function.
1508         (read_signed_LEB_128): Replaced with inline definition and ...
1509         (read_signed_LEB_128_x): ... this new function.
1510         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1511         (read_unsigned_LEB_128): Add inline definition.
1512         (read_signed_LEB_128_x): New function.
1513         (read_signed_LEB_128): Add inline definition.
1514         * testsuite/Makefile.am (leb128_unittest): New unit test.
1515         * testsuite/Makefile.in: Regenerate.
1516         * testsuite/leb128_unittest.cc: New unit test.
1517
1518 2012-01-23  Ian Lance Taylor  <iant@google.com>
1519
1520         PR gold/13617
1521         * i386.cc (Target_i386::do_code_fill): When using a jmp
1522         instruction, pad with nop instructions.
1523         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1524
1525 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1526
1527         * x86_64.cc (gc_process_relocs): Add typename on types used in
1528         template.
1529         (scan_relocs): Likewise.
1530         (relocate_section): Likewise.
1531         (apply_relocation): Likewise.
1532
1533 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1534
1535         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1536         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1537         under x32.
1538
1539 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1540
1541         * x86_64.cc: Initial support for x32.
1542
1543 2012-01-03  Cary Coutant  <ccoutant@google.com>
1544
1545         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1546         Use abstract base class for GOT.
1547         * gold/output.h (class Output_data_got_base): New abstract base class.
1548         (class Output_data_got): Derive from new base class, adjust ctors.
1549         (Output_data_got::reserve_slot): Make virtual; rename to
1550         do_reserve_slot; Adjust callers.
1551         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1552         pointer to abstract base class.
1553         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1554
1555 2011-12-18  Ian Lance Taylor  <iant@google.com>
1556
1557         * object.h (Relobj::local_symbol_value): New function.
1558         (Relobj::local_plt_offset): New function.
1559         (Relobj::local_has_got_offset): New function.
1560         (Relobj::local_got_offset): New function.
1561         (Relobj::set_local_got_offset): New function.
1562         (Relobj::do_local_symbol_value): New pure virtual function.
1563         (Relobj::do_local_plt_offset): Likewise.
1564         (Relobj::do_local_has_got_offset): Likewise.
1565         (Relobj::do_local_got_offset): Likewise.
1566         (Relobj::do_set_local_got_offset): Likewise.
1567         (Sized_relobj::do_local_has_got_offset): Rename from
1568         local_has_got_offset.
1569         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1570         (Sized_relobj::do_set_local_got_offset): Rename from
1571         set_local_got_offset.
1572         (Sized_relobj_file::do_local_plt_offset): Rename from
1573         local_plt_offset.
1574         (Sized_relobj_file::do_local_symbol_value): New function.
1575         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1576         local_plt_offset.
1577         * output.cc (Output_data_got::Got_entry::write): Change object to
1578         Relobj.  Use local_symbol_value.
1579         (Output_data_got::add_global_with_rel): Change rel_dyn to
1580         Output_data_reloc_generic*.  Use add_global_generic.
1581         (Output_data_got::add_global_with_rela): Remove.  Change all
1582         callers to use add_global_with_rel.
1583         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1584         Output_data_reloc_generic*.  Use add_global_generic.
1585         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1586         callers to use add_global_pair_with_rel.
1587         (Output_data_got::add_local): Change object to Relobj*.
1588         (Output_data_got::add_local_plt): Likewise.
1589         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1590         change rel_dyn to Output_data_reloc_generic*.  Use
1591         add_local_generic.
1592         (Output_data_got::add_local_with_rela): Remove.  Change all
1593         callers to use all_local_with_rel.
1594         (Output_data_got::add_local_pair_with_rel): Change object to
1595         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1596         add_output_section_generic.
1597         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1598         callers to use add_local_pair_with_rel.
1599         (Output_data_got::reserve_local): Change object to Relobj*.
1600         * output.h: (class Output_data_reloc_generic): Add pure virtual
1601         declarations for add_global_generic, add_local_generic,
1602         add_output_section_generic.
1603         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1604         functions for Output_data_reloc_generic.  Update declarations for
1605         changes listed in output.cc.
1606         (class Output_data_got): Change template parameter to got_size.
1607         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1608         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1609         function.
1610         (Sized_relobj_incr::do_local_plt_offset): New function.
1611         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1612         add_global_generic.
1613
1614 2011-12-17  Cary Coutant  <ccoutant@google.com>
1615
1616         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1617         * resolve.cc (Symbol_table::resolve): Likewise.
1618         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1619         arrays.
1620         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1621
1622 2011-12-16  Ian Lance Taylor  <iant@google.com>
1623
1624         * output.h (Output_data_reloc_generic::add): Only call
1625         add_dynamic_reloc if this is a dynamic reloc section.
1626
1627 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1628
1629         PR gold/13505
1630         * target-reloc.h (apply_relocation): Replace <64, false> with
1631         <size, big_endian>.
1632
1633 2011-11-25  Nick Clifton  <nickc@redhat.com>
1634
1635         * po/it.po: New Italian translation.
1636
1637 2011-11-17  Sterling Augustine  <saugustine@google.com>
1638
1639         * script.cc (script_include_directive): Implement.
1640         (read_script_file): New local variables name and search_path. Update
1641         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1642         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1643         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1644
1645 2011-11-11  Sterling Augustine  <saugustine@google.com>
1646
1647         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1648         (file_or_sections_cmd): Likewise.
1649
1650 2011-11-11  Doug Kwan  <dougkwan@google.com>
1651
1652         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1653         if --just-symbols is given.
1654
1655 2011-11-10  Doug Kwan  <dougkwan@google.com>
1656
1657         PR gold/13362
1658         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1659         when processing data relocs.
1660         * reloc.h (Relocate_functions::rel_unaligned): New method.
1661         (Relocate_functions::pcrel_unaligned): Ditto.
1662         (Relocate_functions::rel32_unaligned): Ditto.
1663         (Relocate_functions::pcrel32_unaligned): Ditto.
1664
1665 2011-11-09  Doug Kwan  <dougkwan@google.com>
1666
1667         PR gold/13362
1668         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1669         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1670         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1671         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1672         (Relocate_functions::rel_unaligned): New.
1673         (Relocate_functions::rel32_unaligned): New.
1674         * target-reloc.h (relocate_for_relocatable): Add code to handle
1675         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1676         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1677         arm_unaligned_reloc_r): New targets.
1678         * testsuite/Makefile.in: Regenerate.
1679         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1680         linking.
1681
1682 2011-11-02  Ian Lance Taylor  <iant@google.com>
1683
1684         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1685         NATIVE_LINKER.
1686         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1687         * options.cc (General_options::finalize): Use library search path
1688         from configure script if specified.  If not native and no sysroot,
1689         only search TOOLLIBDIR.
1690         * options.h (Search_directory::Search_directory): Change name to
1691         const std::string&.
1692         (General_options::add_to_library_path_with_sysroot): Change arg to
1693         const std::string&.
1694         * configure, Makefile.in, config.in: Rebuild.
1695
1696 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1697
1698         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1699         we are working around the ARM1176 Erratum.
1700         * options.h (General_options::fix_arm1176): Add option.
1701         * testsuite/Makefile.am: Add testcases, and keep current ones
1702         working.
1703         * testsuite/Makefile.in: Regenerate.
1704         * testsuite/arm_fix_1176.s: New file.
1705         * testsuite/arm_fix_1176.sh: Likewise.
1706
1707 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1708
1709         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1710         may_use_blx_.
1711         (Target_arm::may_use_blx): Remove method.
1712         (Target_arm::set_may_use_blx): Likewise.
1713         (Target_arm::may_use_v4t_interworking): New method.
1714         (Target_arm::may_use_v5t_interworking): Likewise.
1715         (Target_arm::may_use_blx_): Remove member variable.
1716         (Arm_relocate_functions::arm_branch_common): Check for v5T
1717         interworking.
1718         (Arm_relocate_functions::thumb_branch_common): Likewise.
1719         (Reloc_stub::stub_type_for_reloc): Likewise.
1720         (Target_arm::do_finalize_sections): Correct interworking checks.
1721         * testsuite/Makefile.am: Add new tests.
1722         * testsuite/Makefile.in: Regenerate.
1723         * testsuite/arm_farcall_arm_arm.s: New test.
1724         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1725         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1726         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1727         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1728         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1729         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1730         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1731
1732 2011-10-31  Cary Coutant  <ccoutant@google.com>
1733
1734         PR gold/13023
1735         * expression.cc (Expression::eval_with_dot): Add
1736         is_section_dot_assignment parameter.
1737         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1738         absolute and assigning to dot within a section.
1739         * script-sections.cc
1740         (Output_section_element_assignment::set_section_addresses): Pass
1741         dot_section to set_if_absolute.
1742         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1743         as is_section_dot_assignment flag to eval_with_dot.
1744         (Output_section_element_dot_assignment::set_section_addresses):
1745         Likewise.
1746         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1747         parameter.  Also set value if relative to dot_section; set the
1748         symbol's output_section.
1749         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1750         parameter.  Adjust all callers.
1751         (Expression::eval_maybe_dot): Likewise.
1752         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1753         Adjust all callers.
1754         * testsuite/script_test_2.t: Test assignment of an absolute value
1755         to dot within an output section element.
1756
1757 2011-10-31  Cary Coutant  <ccoutant@google.com>
1758
1759         * options.h (class General_options): Add --[no-]gnu-unique options.
1760         * symtab.cc (Symbol_table::sized_write_globals): Convert
1761         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1762
1763 2011-10-31  Cary Coutant  <ccoutant@google.com>
1764
1765         PR gold/13359
1766         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1767         unnecessary assertion.
1768         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1769
1770 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1771
1772         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1773         gc_mark_symbol.
1774         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1775         gc_mark_symbol.
1776         Change to just keep the section associated with symbol.
1777         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1778         they are externally visible and --export-dynamic is turned on.
1779         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1780
1781 2011-10-19  Ian Lance Taylor  <iant@google.com>
1782
1783         PR gold/13163
1784         * script-sections.cc
1785         (Output_section_element_dot_assignment::needs_output_section): New
1786         function.
1787
1788 2011-10-19  Ian Lance Taylor  <iant@google.com>
1789
1790         PR gold/13204
1791         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1792         --section-start option was seen.
1793         * options.h (General_options::any_section_start): New function.
1794
1795 2011-10-18  David S. Miller  <davem@davemloft.net>
1796
1797         PR binutils/13301
1798         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1799         member to track relocation locations that have moved during TLS
1800         reloc optimizations.
1801         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1802         (Target_sparc::Relocate::relocate): Adjust view down by 4
1803         bytes if it matches reloc_adjust_addr_.
1804         (Target_sparc::Relocate::relocate_tls): Always move the
1805         __tls_get_addr call delay slot instruction forward 4 bytes when
1806         performing relaxation.
1807
1808 2011-10-18  Cary Coutant  <ccoutant@google.com>
1809
1810         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1811         (Output_file::map_no_anonymous): Check for non-zero
1812         return code from posix_fallocate.
1813
1814 2011-10-17  Cary Coutant  <ccoutant@google.com>
1815
1816         PR gold/13245
1817         * plugin.cc (is_visible_from_outside): Check for symbols
1818         referenced from dynamic objects.
1819         * resolve.cc (Symbol_table::resolve): Don't count references
1820         from dynamic objects as references from real ELF files.
1821         * testsuite/plugin_test_2.sh: Adjust expected result.
1822
1823 2011-10-17  Cary Coutant  <ccoutant@google.com>
1824
1825         * gold.cc: Include timer.h.
1826         (queue_middle_tasks): Stamp time.
1827         (queue_final_tasks): Likewise.
1828         * main.cc (main): Store timer in parameters.  Print timers
1829         for each pass.
1830         * parameters.cc (Parameters::Parameters): Initialize timer_.
1831         (Parameters::set_timer): New function.
1832         (set_parameters_timer): New function.
1833         * parameters.h (Parameters::set_timer): New function.
1834         (Parameters::timer): New function.
1835         (Parameters::timer_): New data member.
1836         (set_parameters_timer): New function.
1837         * timer.cc (Timer::stamp): New function.
1838         (Timer::get_pass_time): New function.
1839         * timer.h (Timer::stamp): New function.
1840         (Timer::get_pass_time): New function.
1841         (Timer::pass_times_): New data member.
1842
1843 2011-10-17  Cary Coutant  <ccoutant@google.com>
1844
1845         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1846         task for members of lib groups.
1847
1848 2011-10-17  Cary Coutant  <ccoutant@google.com>
1849
1850         PR gold/13288
1851         * fileread.cc (File_read::find_view): Add assert.
1852         (File_read::make_view): Move bounds check (replace with assert)...
1853         (File_read::find_or_make_view): ... to here.
1854
1855 2011-10-12  Cary Coutant  <ccoutant@google.com>
1856
1857         * output.cc (Output_file::open_base_file): Handle case where
1858         ::read returns less than requested size.
1859
1860 2011-10-10  Cary Coutant  <ccoutant@google.com>
1861
1862         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1863         Initialize defined_count_.
1864         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1865         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1866         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1867         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1868         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1869         * incremental.h (Sized_relobj_incr::defined_count_): New data
1870         member.
1871         (Sized_incr_dynobj::defined_count_): New data member.
1872         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1873         Return zeroes instead of internal error.
1874
1875 2011-10-10  Cary Coutant  <ccoutant@google.com>
1876
1877         PR gold/13249
1878         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1879         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1880         * output.h (class Output_reloc): Add use_plt_offset flag.
1881         (Output_reloc::type_): Adjust size of bit field.
1882         (Output_reloc::use_plt_offset_): New bit field.
1883         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1884         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1885         flag.  Adjust all callers.
1886         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1887         creating RELATIVE relocations.
1888
1889 2011-10-10  Nick Clifton  <nickc@redhat.com>
1890
1891         * po/es.po: Updated Spanish translation.
1892         * po/fi.po: Updated Finnish translation.
1893
1894 2011-10-03   Diego Novillo  <dnovillo@google.com>
1895
1896         * options.cc (parse_uint): Fix dereference of RETVAL.
1897
1898 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1899
1900         * layout.h (section_order_map_): New member.
1901         (get_section_order_map): New member function.
1902         * output.cc (Output_section::add_input_section): Check for patterns
1903         only when --section-ordering-file is specified.
1904         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1905         output_sections have been formed.
1906         * layout.cc (Layout_Layout): Initialize section_order_map_.
1907         * plugin.cc (update_section_order): Store order in order_map. Do not
1908         update the order.
1909         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1910         * testsuite/Makefile.in: Regenerate.
1911         * testsuite/plugin_section_order.c: New file.
1912         * testsuite/plugin_final_layout.cc: New file.
1913         * testsuite/plugin_final_layout.sh: New file.
1914
1915 2011-09-29  Cary Coutant  <ccoutant@google.com>
1916
1917         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1918         Check for NULL.
1919         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1920         symbols during incremental update.
1921         (Symbol_table::add_from_dynobj): Likewise.
1922
1923 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1924             Ian Lance Taylor  <iant@google.com>
1925
1926         * symtab.cc (Symbol_table::define_special_symbol): Always
1927         canonicalize version string.
1928
1929 2011-09-26  Cary Coutant  <ccoutant@google.com>
1930
1931         * gold.cc (queue_initial_tasks): Move option checks ...
1932         * options.cc (General_options::finalize): ... to here. Disable
1933         some options; make others fatal.
1934
1935 2011-09-26  Cary Coutant  <ccoutant@google.com>
1936
1937         gcc PR lto/47247
1938         * plugin.cc (get_symbols_v2): New function.
1939         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1940         (is_referenced_from_outside): New function.
1941         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1942         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1943         (get_symbols): Pass version parameter.
1944         (get_symbols_v2): New function.
1945         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1946         parameter.
1947         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1948         (onload): Add LDPT_GET_SYMBOLS_V2.
1949         (all_symbols_read_hook): Use get_symbols_v2; check for
1950         LDPR_PREVAILING_DEF_IRONLY_EXP.
1951         * testsuite/plugin_test_3.sh: Update expected results.
1952
1953 2011-09-23  Simon Baldwin  <simonb@google.com>
1954
1955         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1956         configuration options.
1957         * configure: Regenerate.
1958         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1959         * Makefile.in: Regenerate.
1960         * testsuite/Makefile.in: Regenerate.
1961
1962 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1963
1964         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1965
1966 2011-09-19  Cary Coutant  <ccoutant@google.com>
1967
1968         * incremental.cc (can_incremental_update): Fix typo in comment.
1969         * incremental.h (can_incremental_update): Likewise.
1970
1971 2011-09-18  Cary Coutant  <ccoutant@google.com>
1972
1973         * incremental.cc (can_incremental_update): New function.
1974         * incremental.h (can_incremental_update): New function.
1975         * layout.cc (Layout::init_fixed_output_section): Call it.
1976         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1977         * object.cc (Sized_relobj_file::do_layout): Call
1978         can_incremental_update.
1979
1980 2011-09-13  Cary Coutant  <ccoutant@google.com>
1981
1982         * configure.ac: Check for glibc support for gnu_indirect_function
1983         support with static linking, setting automake conditional
1984         IFUNC_STATIC.
1985         * Makefile.in: Regenerate.
1986         * configure: Regenerate.
1987
1988         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1989         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1990         for IFUNC_STATIC.
1991         * testsuite/Makefile.in: Regenerate.
1992
1993 2011-09-13  Cary Coutant  <ccoutant@google.com>
1994
1995         * incremental.cc (Sized_relobj_incr::do_layout): Call
1996         report_comdat_group for kept comdat sections.
1997         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1998         * testsuite/Makefile.in: Regenerate.
1999         * testsuite/incr_comdat_test_1.cc: New source file.
2000         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2001         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2002         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2003
2004 2011-09-13  Ian Lance Taylor  <iant@google.com>
2005
2006         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2007         variable external_symbols_offset.
2008
2009 2011-09-12  Ian Lance Taylor  <iant@google.com>
2010
2011         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2012         triggered if object has no symbols.
2013
2014 2011-09-09  David S. Miller  <davem@davemloft.net>
2015
2016         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2017         (Output_fill_debug_line::do_write): Likewise.
2018
2019 2011-08-29  Cary Coutant  <ccoutant@google.com>
2020
2021         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2022         casts to match formatting specs.
2023         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2024
2025 2011-08-26  Cary Coutant  <ccoutant@google.com>
2026
2027         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2028         remaining hole size when allocating.
2029         (Layout::make_output_section): Set fill methods for debug sections.
2030         * layout.h (Free_list::Free_list_node): Move from private to
2031         public.
2032         (Free_list::set_min_hole_size): New function.
2033         (Free_list::begin, Free_list::end): New functions.
2034         (Free_list::min_hole_): New data member.
2035         * output.cc: Include dwarf.h.
2036         (Output_fill_debug_info::do_minimum_hole_size): New function.
2037         (Output_fill_debug_info::do_write): New function.
2038         (Output_fill_debug_line::do_minimum_hole_size): New function.
2039         (Output_fill_debug_line::do_write): New function.
2040         (Output_section::Output_section): Initialize new data member.
2041         (Output_section::set_final_data_size): Ensure patch space is larger
2042         than minimum hole size.
2043         (Output_section::do_write): Fill holes in debug sections.
2044         * output.h (Output_fill): New class.
2045         (Output_fill_debug_info): New class.
2046         (Output_fill_debug_line): New class.
2047         (Output_section::set_free_space_fill): New function.
2048         (Output_section::free_space_fill_): New data member.
2049         * testsuite/Makefile.am (incremental_test_3): Add
2050         --incremental-patch option.
2051         (incremental_test_4): Likewise.
2052         (incremental_test_5): Likewise.
2053         (incremental_test_6): Likewise.
2054         (incremental_copy_test): Likewise.
2055         (incremental_common_test_1): Likewise.
2056         * testsuite/Makefile.in: Regenerate.
2057
2058 2011-08-26  Nick Clifton  <nickc@redhat.com>
2059
2060         * po/es.po: Updated Spanish translation.
2061
2062 2011-08-01  Cary Coutant  <ccoutant@google.com>
2063
2064         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2065         * gold/testsuite/Makefile.in: Regenerate.
2066         * gold/testsuite/justsyms_exec.c: New source file.
2067         * gold/testsuite/justsyms_lib.c: New source file.
2068
2069 2011-08-01  Cary Coutant  <ccoutant@google.com>
2070
2071         * layout.cc (Layout::set_segment_offsets): Don't realign text
2072         segment if -Ttext was specified.
2073         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2074         file type.
2075         * object.h (Sized_relobj_file::e_type): New function.
2076         (Sized_relobj_file::e_type_): New data member.
2077         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2078         base address for ET_EXEC files.
2079         * target.cc (Target::do_make_elf_object_implementation): Allow
2080         ET_EXEC files with --just-symbols option.
2081
2082 2011-07-28  Cary Coutant  <ccoutant@google.com>
2083
2084         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2085         Add thread_number parameter.
2086         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2087         * workqueue-threads.cc
2088         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2089         current thread if its thread number is greater than desired thread
2090         count.
2091         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2092         Add thread_number parameter.
2093         (Workqueue::should_cancel_thread): Likewise.
2094         (Workqueue::find_runnable_or_wait): Pass thread_number to
2095         should_cancel_thread.
2096         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2097         parameter.
2098
2099 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2100
2101         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2102         only after checking if it cannot be forced local.
2103         * symtab.h (is_externally_visible): Check if the symbol is not forced
2104         local.
2105
2106 2011-07-15  Ian Lance Taylor  <iant@google.com>
2107
2108         * options.h (class General_options): Add --print-output-format.
2109         Move -EL next to -EB, for  better --help output.
2110         * target-select.cc: Include <cstdio>, "options.h", and
2111         "parameters.h".
2112         (Target_selector::do_target_bfd_name): New function.
2113         (print_output_format): New function.
2114         * target-select.h (class Target_selector): Update declarations.
2115         (Target_selector::target_bfd_name): New function.
2116         (print_output_format): Declare.
2117         * main.cc: Include "target-select.h".
2118         (main): Handle --print-output-format.
2119         * gold.cc: Include "target-select.h".
2120         (queue_initial_tasks): Handle --print-output-format when there are
2121         no input files.
2122         * parameters.cc (parameters_force_valid_target): Give a better
2123         error message if -EB/-EL does not match target.
2124         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2125         function.
2126
2127 2011-07-15  Ian Lance Taylor  <iant@google.com>
2128
2129         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2130         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2131         (Output_data_plt_i386::do_write): Write address of .dynamic
2132         section to first entry in .got.plt section.
2133         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2134         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2135         Initialize layout_.
2136         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2137         section to first entry in .got.plt section.
2138         * layout.h (Layout::dynamic_section): New function.
2139
2140 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2141
2142         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2143         to claim_file call.
2144         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2145         input_section_position_, and input_section_glob_.
2146         (read_layout_from_file): Call function section_ordering_specified.
2147         * layout.h (is_section_ordering_specified): New function.
2148         (section_ordering_specified): New function.
2149         (section_ordering_specified_): New boolean member.
2150         * main.cc(main): Call load_plugins after layout object is defined.
2151         * output.cc (Output_section::add_input_section): Use
2152         function section_ordering_specified to check if section ordering is
2153         needed.
2154         * output.cc (Output_section::add_relaxed_input_section): Use
2155         function section_ordering_specified to check if section ordering is
2156         needed.
2157         (Output_section::update_section_layout): New function.
2158         (Output_section::sort_attached_input_sections): Check if input section
2159         must be reordered.
2160         * output.h (Output_section::update_section_layout): New function.
2161         * plugin.cc (get_section_count): New function.
2162         (get_section_type): New function.
2163         (get_section_name): New function.
2164         (get_section_contents): New function.
2165         (update_section_order): New function.
2166         (allow_section_ordering): New function.
2167         (Plugin::load): Add the new interfaces to the transfer vector.
2168         (Plugin_manager::load_plugins): New parameter.
2169         (Plugin_manager::all_symbols_read): New parameter.
2170         (Plugin_manager::claim_file): New parameter. Save the elf object for
2171         unclaimed objects.
2172         (Plugin_manager::get_elf_object): New function.
2173         (Plugin_manager::get_view): Change to directly use the bool to check
2174         if get_view is called from claim_file_hook.
2175         * plugin.h (input_objects): New function
2176         (Plugin__manager::load_plugins): New parameter.
2177         (Plugin_manager::claim_file): New parameter.
2178         (Plugin_manager::get_elf_object): New function.
2179         (Plugin_manager::in_claim_file_handler): New function.
2180         (Plugin_manager::in_claim_file_handler_): New member.
2181         (layout): New function.
2182         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2183         handler with an extra parameter. Make the elf object before calling
2184         claim_file handler.
2185         * testsuite/plugin_test.c (get_section_count): New function pointer.
2186         (get_section_type): New function pointer.
2187         (get_section_name): New function pointer.
2188         (get_section_contents): New function pointer.
2189         (update_section_order): New function pointer.
2190         (allow_section_ordering): New function pointer.
2191         (onload): Check if the new interfaces exist.
2192
2193 2011-07-13  Ian Lance Taylor  <iant@google.com>
2194
2195         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2196         relro section.
2197         * x86_64.cc (Target_x86_64::got_section): Likewise.
2198         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2199         (relro_now_test_SOURCES): New variable.
2200         (relro_now_test_DEPENDENCIES): New variable.
2201         (relro_now_test_LDFLAGS): New variable.
2202         (relro_now_test_LDADD): New variable.
2203         (relro_now_test.so): New target.
2204         * testsuite/Makefile.in: Rebuild.
2205
2206 2011-07-12  Ian Lance Taylor  <iant@google.com>
2207
2208         PR gold/12980
2209         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2210         GLOB_DAT relocation rather than a RELATIVE relocation for a
2211         protected symbol when creating a shared library.
2212         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2213         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2214         * testsuite/protected_main_1.cc (main): Test that protected
2215         function has same address.
2216
2217 2011-07-11  Ian Lance Taylor  <iant@google.com>
2218
2219         PR gold/12979
2220         * options.h (class General_options): Add -Bgroup.
2221         * options.cc (General_options::finalize): If -Bgroup is set,
2222         default to --unresolved-symbols=report-all.
2223         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2224         * target-reloc.h (issue_undefined_symbol_error): Handle
2225         --unresolved-symbols=report-all.
2226
2227 2011-07-08  Ian Lance Taylor  <iant@google.com>
2228
2229         PR gold/11985
2230         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2231         if linker script discards key sections.
2232         (Layout::create_dynamic_symtab): Likewise.
2233         (Layout::assign_local_dynsym_offsets): Likewise.
2234         (Layout::sized_create_version_sections): Likewise.
2235         (Layout::create_interp): Likewise.
2236         (Layout::finish_dynamic_section): Likewise.
2237         (Layout::set_dynamic_symbol_size): Likewise.
2238
2239 2011-07-08  Ian Lance Taylor  <iant@google.com>
2240
2241         PR gold/12386
2242         * options.h (class General_options): Add --unresolved-symbols.
2243         * target-reloc.h (issue_undefined_symbol_error): Check
2244         --unresolved-symbols.  Add comments.
2245
2246 2011-07-08  Ian Lance Taylor  <iant@google.com>
2247
2248         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2249         expression more complex.
2250
2251 2011-07-08  Ian Lance Taylor  <iant@google.com>
2252
2253         PR gold/11317
2254         * target-reloc.h (issue_undefined_symbol_error): New inline
2255         function, broken out of relocate_section.
2256         (relocate_section): Call issue_undefined_symbol_error.
2257         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2258         there is no TLS segment if we are about to issue an undefined
2259         symbol error.
2260         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2261
2262 2011-07-08  Ian Lance Taylor  <iant@google.com>
2263
2264         PR gold/12279
2265         * resolve.cc (Symbol_table::should_override): Add fromtype
2266         parameter.  Change all callers.  Give error when linking together
2267         TLS and non-TLS symbol.
2268         (Symbol_table::should_override_with_special): Add fromtype
2269         parameter.  Change all callers.
2270         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2271         there is no TLS segment if we have reported some errors.
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/12372
2277         * target.h (Target::plt_address_for_global): New function.
2278         (Target::plt_address_for_local): New function.
2279         (Target::plt_section_for_global): Remove.
2280         (Target::plt_section_for_local): Remove.
2281         (Target::do_plt_address_for_global): New virtual function.
2282         (Target::do_plt_address_for_local): New virtual function.
2283         (Target::do_plt_section_for_global): Remove.
2284         (Target::do_plt_section_for_local): Remove.
2285         (Target::register_global_plt_entry): Add Symbol_table and Layout
2286         parameters.
2287         * output.cc (Output_data_got::Got_entry::write): Use
2288         plt_address_for_global and plt_address_for_local.
2289         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2290         address of output section.
2291         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2292         got_irelative_, and irelative_count_ fields.  Update
2293         declarations.
2294         (Output_data_plt_i386::has_irelative_section): New function.
2295         (Output_data_plt_i386::entry_count): Add irelative_count_.
2296         (Output_data_plt_i386::set_final_data_size): Likewise.
2297         (class Target_i386): Add got_irelative_ and rel_irelative_
2298         fields.  Update declarations.
2299         (Target_i386::Target_i386): Initialize new fields.
2300         (Target_i386::do_plt_address_for_global): New function replacing
2301         do_plt_section_for_global.
2302         (Target_i386::do_plt_address_for_local): New function replacing
2303         do_plt_section_for_local.
2304         (Target_i386::got_section): Create got_irelative_.
2305         (Target_i386::rel_irelative_section): New function.
2306         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2307         fields.  Don't define __rel_iplt_{start,end}.
2308         (Output_data_plt_i386::add_entry): Add symtab and layout
2309         parameters.  Change all callers.  Use different PLT and GOT for
2310         IFUNC symbols.
2311         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2312         layout parameters.  Change all callers.  Use different PLT and
2313         GOT.
2314         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2315         (Output_data_plt_i386::rel_irelative): New function.
2316         (Output_data_plt_i386::address_for_global): New function.
2317         (Output_data_plt_i386::address_for_local): New function.
2318         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2319         IRELATIVE GOT when changing IFUNC GOT entries.
2320         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2321         reloc.
2322         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2323         if we didn't create an IRELATIVE GOT.
2324         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2325         plt_address_for_local.
2326         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2327         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2328         got_irelative_, and irelative_count_ fields.  Update
2329         declarations.
2330         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2331         Initialize new fields.  Remove symtab parameter.  Change all
2332         callers.
2333         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2334         irelative_count_.
2335         (Output_data_plt_x86_64::has_irelative_section): New function.
2336         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2337         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2338         fields.  Update declarations.
2339         (Target_x86_64::Target_x86_64): Initialize new fields.
2340         (Target_x86_64::do_plt_address_for_global): New function replacing
2341         do_plt_section_for_global.
2342         (Target_x86_64::do_plt_address_for_local): New function replacing
2343         do_plt_section_for_local.
2344         (Target_x86_64::got_section): Create got_irelative_.
2345         (Target_x86_64::rela_irelative_section): New function.
2346         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2347         all callers.  Don't create __rel_iplt_{start,end}.
2348         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2349         parameters.  Change all callers.  Use different PLT and GOT for
2350         IFUNC symbols.
2351         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2352         layout parameters.  Change all callers.  Use different PLT and
2353         GOT.
2354         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2355         parameters.  Change all callers.  Use different PLT and GOT for
2356         IFUNC symbols.
2357         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2358         (Output_data_plt_x86_64::rela_irelative): New function.
2359         (Output_data_plt_x86_64::address_for_global): New function.
2360         (Output_data_plt_x86_64::address_for_local): New function.
2361         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2362         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2363         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2364         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2365         parameters.
2366         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2367         reloc.
2368         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2369         symbols if we didn't create an IRELATIVE GOT.
2370         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2371         plt_address_for_local.
2372         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2373         * testsuite/ifuncvar1.c: New test file.
2374         * testsuite/ifuncvar2.c: New test file.
2375         * testsuite/ifuncvar3.c: New test file.
2376         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2377         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2378         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2379         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2380         * testsuite/Makefile.in: Rebuild.
2381
2382 2011-07-07  Cary Coutant  <ccoutant@google.com>
2383
2384         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2385         (two_file_test_1_ndebug.o): Likewise.
2386         (two_file_test_1b_ndebug.o): Likewise.
2387         (two_file_test_2_ndebug.o): Likewise.
2388         (two_file_test_main_ndebug.o): Likewise.
2389         (incremental_test_2): Link with no-debug versions.
2390
2391 2011-07-06  Cary Coutant  <ccoutant@google.com>
2392
2393         * gold/incremental.cc
2394         (Output_section_incremental_inputs::write_info_blocks): Check for
2395         hidden and internal symbols.
2396
2397 2011-07-06  Cary Coutant  <ccoutant@google.com>
2398
2399         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2400         Check disposition for startup file.
2401         (Incremental_inputs::report_command_line): Ignore
2402         --incremental-startup-unchanged option.
2403         * options.cc (General_options::parse_incremental_startup_unchanged):
2404         New function.
2405         (General_options::General_options): Initialize new data member.
2406         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2407         (General_options): Add --incremental-startup-unchanged option.
2408         (General_options::incremental_startup_disposition): New function.
2409         (General_options::incremental_startup_disposition_): New data member.
2410
2411 2011-07-06  Cary Coutant  <ccoutant@google.com>
2412
2413         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2414         input file index to Script_info ctor.
2415         (Sized_incremental_binary::do_file_has_changed): Find the
2416         command-line argument for files named in scripts.
2417         * incremental.h (Script_info::Script_info): New ctor
2418         with input file index.
2419         (Script_info::input_file_index): New function.
2420         (Script_info::input_file_index_): New data member.
2421         (Incremental_binary::get_library): Add const.
2422         (Incremental_binary::get_script_info): Add const.
2423         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2424         * testsuite/Makefile.am (incremental_test_5): New test case.
2425         (incremental_test_6): New test case.
2426         * testsuite/Makefile.in: Regenerate.
2427
2428 2011-07-06  Cary Coutant  <ccoutant@google.com>
2429
2430         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2431         debug output when command lines differ.
2432
2433 2011-07-06  Cary Coutant  <ccoutant@google.com>
2434
2435         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2436         --incremental-patch option.
2437         * layout.cc (Free_list::allocate): Extend allocation beyond original
2438         end if enabled.
2439         (Layout::make_output_section): Mark sections that should get
2440         patch space.
2441         * options.cc (parse_percent): New function.
2442         * options.h (parse_percent): New function.
2443         (DEFINE_percent): New macro.
2444         (General_options): Add --incremental-patch option.
2445         * output.cc (Output_section::Output_section): Initialize new data
2446         members.
2447         (Output_section::add_input_section): Print section name when out
2448         of patch space.
2449         (Output_section::add_output_section_data): Likewise.
2450         (Output_section::set_final_data_size): Add patch space when
2451         doing --incremental-full.
2452         (Output_section::do_reset_address_and_file_offset): Remove patch
2453         space.
2454         (Output_segment::set_section_list_addresses): Print debug output
2455         only if --incremental-update.
2456         * output.h (Output_section::set_is_patch_space_allowed): New function.
2457         (Output_section::is_patch_space_allowed_): New data member.
2458         (Output_section::patch_space_): New data member.
2459         * parameters.cc (Parameters::incremental_full): New function.
2460         * parameters.h (Parameters::incremental_full): New function
2461         * testsuite/Makefile.am (incremental_test_2): Add test for
2462         --incremental-patch option.
2463         * testsuite/Makefile.in: Regenerate.
2464         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2465         (t18): Remove function body.
2466
2467 2011-07-05  Doug Kwan  <dougkwan@google.com>
2468
2469         PR gold/12771
2470         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2471         Arm_Address type for relocation result.
2472         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2473         overflow check.
2474         (Arm_relocate_functions::abs32): Use unaligned access.
2475         (Arm_relocate_functions::rel32): Ditto.
2476         (Arm_relocate_functions::prel31): Ditto.
2477         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2478         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2479         static data relocations.
2480         * testsuite/Makefile.in: Regnerate.
2481         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2482
2483 2011-07-05  Ian Lance Taylor  <iant@google.com>
2484
2485         PR gold/12392
2486         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2487         symbols if necessary.
2488         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2489
2490 2011-07-05  Ian Lance Taylor  <iant@google.com>
2491
2492         PR gold/12952
2493         * resolve.cc (Symbol::override_base_with_special): Simply override
2494         version with special symbol version, ignoring previous version.
2495
2496 2011-07-05  Ian Lance Taylor  <iant@google.com>
2497
2498         * object.cc (Sized_relobj_file::include_section_group): Add
2499         information to comment about signature location.
2500
2501 2011-07-02  Ian Lance Taylor  <iant@google.com>
2502
2503         PR gold/12957
2504         * options.h (class General_options): Add -f and -F.
2505         * options.cc (General_options::finalize): Fatal error if -f/-F
2506         are used without -shared.
2507         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2508
2509 2011-07-02  Ian Lance Taylor  <iant@google.com>
2510
2511         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2512
2513 2011-07-01  Ian Lance Taylor  <iant@google.com>
2514
2515         PR gold/12525
2516         PR gold/12952
2517         * resolve.cc (Symbol::override_base_with_special): Don't override
2518         the version if the overriding symbol has a different name.
2519         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2520         all callers.  If we give an error about an undefined version,
2521         define the base version if necessary.
2522         * dynobj.h (class Versions): Update declaration.
2523         * testsuite/weak_alias_test_5.cc: New file.
2524         * testsuite/weak_alias_test.script: New file.
2525         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2526         and versioned_alias have the right value, and call t2.
2527         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2528         weak_alias_test_5.so.
2529         (weak_alias_test_LDADD): Likewise.
2530         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2531         * testsuite/Makefile.in: Rebuild.
2532
2533 2011-07-01  Ian Lance Taylor  <iant@google.com>
2534
2535         PR gold/12525
2536         * options.h (class General_options): Support -z notext.
2537         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2538         -Wl,-z,notext.
2539         (two_file_shared_nonpic.so): Likewise.
2540         (two_file_shared_mixed.so): Likewise.
2541         (two_file_shared_mixed_1.so): Likewise.
2542         (weak_undef_lib_nonpic.so): Likewise.
2543         (alt/weak_undef_lib_nonpic.so): Likewise.
2544         (tls_test_shared_nonpic.so): Likewise.
2545         * testsuite/Makefile.in: Rebuild.
2546
2547 2011-07-01  Ian Lance Taylor  <iant@google.com>
2548
2549         PR gold/12525
2550         * configure.ac: Test whether static linking works, setting
2551         the automake conditional HAVE_STATIC.
2552         * testsuite/Makefile.am: Disable tests using -static if
2553         HAVE_STATIC is not true.
2554         * configure, testsuite/Makefile.in: Rebuild.
2555
2556 2011-07-01  Ian Lance Taylor  <iant@google.com>
2557
2558         PR gold/12525
2559         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2560         Assert if we see DW_EH_PE_indirect.
2561         * target.h (Target::ehframe_datarel_base): New function.
2562         (Target::do_ehframe_datarel_base): New target function.
2563         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2564         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2565         function.
2566
2567 2011-07-01  Ian Lance Taylor  <iant@google.com>
2568
2569         PR gold/12571
2570         * options.h (class General_options): Add
2571         --ld-generated-unwind-info.
2572         * ehframe.cc (Fde::write): Add address parameter.  Change all
2573         callers.  If associated with PLT, fill in address and size.
2574         (Cie::set_output_offset): Only add merge mapping if there is an
2575         object.
2576         (Cie::write): Add address parameter.  Change all callers.
2577         (Eh_frame::add_ehframe_for_plt): New function.
2578         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2579         input_offset_ fields into union u_, with new plt field.
2580         (Fde::Fde): Adjust for new union field.
2581         (Fde::Fde) [Output_data version]: New constructor.
2582         (Fde::add_mapping): Only add merge mapping if there is an object.
2583         (class Cie): Update declarations.
2584         (class Eh_frame): Declare add_ehframe_for_plt.
2585         * layout.cc (Layout::layout_eh_frame): Break out code into
2586         make_eh_frame_section, and call it.
2587         (Layout::make_eh_frame_section): New function.
2588         (Layout::add_eh_frame_for_plt): New function.
2589         * layout.h (class Layout): Update declarations.
2590         * merge.cc (Merge_map::add_mapping): Add assertion.
2591         * i386.cc: Include "dwarf.h".
2592         (class Output_data_plt_i386): Make first_plt_entry,
2593         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2594         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2595         and plt_eh_frame_fde.
2596         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2597         boundary.  Call add_eh_frame_for_plt if appropriate.
2598         * x86_64.cc: Include "dwarf.h".
2599         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2600         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2601         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2602         and plt_eh_frame_fde.
2603         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2604         appropriate.
2605
2606 2011-06-29  Ian Lance Taylor  <iant@google.com>
2607
2608         PR gold/12629
2609         * object.cc (Sized_relobj_file::layout_section): Change shdr
2610         parameter to be const.
2611         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2612         out of do_layout.
2613         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2614         appropriate.  Call layout_eh_frame_section.
2615         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2616         sections.
2617         * object.h (class Sized_relobj_file): Update declarations.
2618
2619 2011-06-29  Ian Lance Taylor  <iant@google.com>
2620
2621         PR gold/12652
2622         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2623         modifier.
2624         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2625
2626 2011-06-29  Ian Lance Taylor  <iant@google.com>
2627
2628         PR gold/12675
2629         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2630         SHT_X86_64_UNWIND.
2631         * layout.cc (Layout::layout_eh_frame): Likewise.
2632
2633 2011-06-29  Ian Lance Taylor  <iant@google.com>
2634
2635         PR gold/12695
2636         * layout.cc (Layout::symtab_section_shndx): New function.
2637         * layout.h (class Layout): Declare symtab_section_shndx.
2638         * output.cc (Output_section::write_header): Call it.
2639
2640 2011-06-29  Ian Lance Taylor  <iant@google.com>
2641
2642         PR gold/12818
2643         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2644         symbols which are not used in a relocation.
2645
2646 2011-06-28  Ian Lance Taylor  <iant@google.com>
2647
2648         PR gold/12898
2649         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2650         script create indistinguishable segments.
2651         (Layout::set_segment_offsets): Use stable_sort when sorting
2652         segments.  Pass this to Compare_segments constructor.
2653         * layout.h (class Layout): Make segment_precedes non-static.
2654         (class Compare_segments): Change from struct to class.  Add
2655         layout_ field.  Add constructor.
2656         * script-sections.cc
2657         (Script_sections::attach_sections_using_phdrs_clause): Rename
2658         local orphan to is_orphan.  Don't report failure to put empty
2659         section in segment.  On attachment failure, report name of
2660         section, and attach to first PT_LOAD segment.
2661
2662 2011-06-28  Ian Lance Taylor  <iant@google.com>
2663
2664         PR gold/12934
2665         * target-select.cc (Target_selector::Target_selector): Add
2666         emulation parameter.  Change all callers.
2667         (select_target_by_bfd_name): Rename from select_target_by_name.
2668         Change all callers.
2669         (select_target_by_emulation): New function.
2670         (supported_emulation_names): New function.
2671         * target-select.h (class Target_selector): Add emulation_ field.
2672         Update declarations.
2673         (Target_selector::recognize_by_bfd_name): Rename from
2674         recognize_by_name.  Change all callers.
2675         (Target_selector::supported_bfd_names): Rename from
2676         supported_names.  Change all callers.
2677         (Target_selector::recognize_by_emulation): New function.
2678         (Target_selector::supported_emulations): New function.
2679         (Target_selector::emulation): New function.
2680         (Target_selector::do_recognize_by_bfd_name): Rename from
2681         do_recognize_by_name.  Change all callers.
2682         (Target_selector::do_supported_bfd_names): Rename from
2683         do_supported_names.  Change all callers.
2684         (Target_selector::do_recognize_by_emulation): New function.
2685         (Target_selector::do_supported_emulations): New function.
2686         (select_target_by_bfd_name): Change name in declaration.
2687         (select_target_by_emulation): Declare.
2688         (supported_emulation_names): Declare.
2689         * parameters.cc (parameters_force_valid_target): Try to find
2690         target based on emulation from -m option.
2691         * options.h (class General_options): Change doc string for -m.
2692         * options.cc (help): Print emulations.
2693         (General_options::parse_V): Likewise.
2694         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2695         Add emulation parameter.  Change all callers.
2696
2697 2011-06-28  Ian Lance Taylor  <iant@google.com>
2698
2699         * target.h (class Target): Add osabi_ field.
2700         (Target::osabi): New function.
2701         (Target::set_osabi): New function.
2702         (Target::Target): Initialize osabi_.
2703         (Target::do_adjust_elf_header): Make pure virtual.
2704         (Sized_target::do_adjust_elf_header): Declare.
2705         * target.cc (Sized_target::do_adjust_elf_header): New function.
2706         (class Sized_target): Instantiate all versions.
2707         * freebsd.h (class Target_freebsd): Remove.
2708         (Target_selector_freebsd::do_recognize): Call set_osabi on
2709         Target.
2710         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2711         (Target_selector_freebsd::set_osabi): Remove.
2712         * i386.cc (class Target_i386): Inherit from Sized_target rather
2713         than Target_freebsd.
2714         * x86_64.cc (class Target_x86_64): Likewise.
2715
2716 2011-06-28  Ian Lance Taylor  <iant@google.com>
2717
2718         * target.h (Target::can_check_for_function_pointers): Rewrite.
2719         Make non-virtual.
2720         (Target::can_icf_inline_merge_sections): Likewise.
2721         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2722         (Target::Target_info): Add can_icf_inline_merge_sections field.
2723         (Target::do_can_check_for_function_pointers): New virtual
2724         function.
2725         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2726         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2727         from can_check_for_function_pointers, move in file.
2728         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2729         section_may_have_icf_unsafe_poineters, move in file.
2730         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2731         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2732         Rename from can_check_for_function_pointers, move in file.
2733         (Target_i386::can_icf_inline_merge_sections): Remove.
2734         (Target_i386::i386_info): Initialize
2735         can_icf_inline_merge_sections.
2736         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2737         Initialize can_icf_inline_merge_sections.
2738         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2739         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2740         Rename from can_check_for_function_pointers, move in file.
2741         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2742         (Target_x86_64::x86_64_info): Initialize
2743         can_icf_inline_merge_sections.
2744         * testsuite/testfile.cc (Target_test::test_target_info):
2745         Likewise.
2746         * icf.cc (get_section_contents): Correct formatting.
2747
2748 2011-06-27  Ian Lance Taylor  <iant@google.com>
2749
2750         * symtab.cc (Symbol::versioned_name): New function.
2751         (Symbol_table::add_to_final_symtab): Use versioned_name when
2752         appropriate.
2753         (Symbol_table::sized_write_symbol): Likewise.
2754         * symtab.h (class Symbol): Declare versioned_name.
2755         * stringpool.h (class Stringpool_template): Add variant of add
2756         which takes a std::basic_string.
2757         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2758         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2759         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2760         (ver_test_12.o): New target.
2761         * testsuite/Makefile.in: Rebuild.
2762
2763 2011-06-27  Doug Kwan  <dougkwan@google.com>
2764
2765         * arm.cc (Arm_relocate_functions::thm_jump8,
2766         Arm_relocate_functions::thm_jump11): Use a wider signed
2767         type to compute offset.
2768         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2769         arm_thm_jump8.
2770         * testsuite/Makefile.in: Regenerate.
2771         * testsuite/arm_branch_in_range.sh: Check test results of
2772         arm_thm_jump11 and arm_thm_jump8.
2773         * testsuite/arm_thm_jump11.s: New test source file.
2774         * testsuite/arm_thm_jump11.t: New linker script.
2775         * testsuite/arm_thm_jump8.s: New test source file.
2776         * testsuite/arm_thm_jump8.t: New linker script.
2777
2778 2011-06-24  Ian Lance Taylor  <iant@google.com>
2779
2780         * layout.cc: Include "object.h".
2781         (ctors_sections_in_init_array): New static variable.
2782         (Layout::is_ctors_in_init_array): New function.
2783         (Layout::layout): Add entry to ctors_sections_in_init_array if
2784         appropriate.
2785         * layout.h (class Layout): Declare is_ctors_in_init_array.
2786         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2787         is_ctors_reverse_view is set.
2788         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2789         all callers.  Set is_ctors_reverse_view field of View_size.
2790         (Sized_relobj_file::reverse_words): New function.
2791         * object.h (Sized_relobj_file::View_size): Add
2792         is_ctors_reverse_view field.
2793         (class Sized_relobj_file): Update declarations.
2794         * testsuite/initpri3.c: New test.
2795         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2796         initpri3b.
2797         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2798         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2799         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2800         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2801         * testsuite/Makefile.in: Rebuild.
2802
2803 2011-06-24  Cary Coutant  <ccoutant@google.com>
2804
2805         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2806         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2807         (debug_msg_cdebug.err): New targets.
2808         * testsuite/Makefile.in: Regenerate.
2809         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2810         Fix checks for link with shared library.
2811
2812 2011-06-24  Doug Kwan  <dougkwan@google.com>
2813
2814         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2815         skip empty text sections.
2816         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2817
2818 2011-06-22  Ian Lance Taylor  <iant@google.com>
2819
2820         PR gold/12910
2821         * options.h (class General_options): Add --ctors-in-init-array.
2822         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2823         friends as SHT_PROGBITS for merging sections.
2824         (Layout::layout): Remove special handling of .init_array and
2825         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2826         and .dtors if ctors_in_init_array.
2827         (Layout::make_output_section): Force correct section types for
2828         .init_array and friends.  Don't sort if doing relocatable link,
2829         Don't sort .ctors and .dtors if ctors_in_init_array.
2830         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2831         (Layout::output_section_name): Add relobj parameter.  Change all
2832         callers.  Handle .ctors. and .dtors. in code rather than table.
2833         Handle .ctors and .dtors if ctors_in_init_array.
2834         (Layout::match_file_name): New function, moved from output.cc.
2835         * layout.h (class Layout): Update declarations.
2836         * output.cc: Include "layout.h".
2837         (Input_section_sort_entry::get_priority): New function.
2838         (Input_section_sort_entry::match_file_name): Just call
2839         Layout::match_file_name.
2840         (Output_section::Input_section_sort_init_fini_compare::operator()):
2841         Handle .ctors and .dtors.  Sort by explicit priority rather than
2842         by name.
2843         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2844         * testsuite/initpri2.c: New test.
2845         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2846         (check_PROGRAMS): Add initpri2.
2847         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2848         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2849         * configure, testsuite/Makefile.in: Rebuild.
2850
2851 2011-06-19  Ian Lance Taylor  <iant@google.com>
2852
2853         PR gold/12880
2854         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2855         .interp section to a PT_INTERP segment even if we have seen a
2856         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2857         clause in a linker script.
2858         (Layout::finalize): Don't create a .interp section if we've
2859         already create a PT_INTERP segment.
2860         (Layout::create_interp): Always call choose_output_section (revert
2861         patch of 2011-06-17).  Don't create PT_INTERP segment.
2862         * script-sections.cc
2863         (Script_sections::create_note_and_tls_segments): Add a .interp
2864         section to a PT_INTERP segment even if we have seen a
2865         --dynamic-linker option.
2866
2867 2011-06-18  Ian Lance Taylor  <iant@google.com>
2868
2869         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2870         merely because a non-PT_LOAD segment has a dynamic reloc.
2871
2872 2011-06-18  Ian Lance Taylor  <iant@google.com>
2873
2874         * layout.cc (Layout::finish_dynamic_section): Don't create
2875         DT_FLAGS entry if not needed.
2876
2877 2011-06-18  Ian Lance Taylor  <iant@google.com>
2878
2879         PR gold/12745
2880         * layout.cc (Layout::layout_eh_frame): Correct handling of
2881         writable .eh_frame section.
2882
2883 2011-06-17  Ian Lance Taylor  <iant@google.com>
2884
2885         PR gold/12893
2886         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2887         symbol is redefined with the exact same object and value.
2888
2889 2011-06-17  Ian Lance Taylor  <iant@google.com>
2890
2891         PR gold/12880
2892         * layout.h (class Layout): Add interp_segment_ field.
2893         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2894         (Layout::attach_allocated_section_to_segment): If making shared
2895         library, put .interp section in PT_INTERP segment.
2896         (Layout::finalize): Also call create_interp if -dynamic-linker
2897         option was used.
2898         (Layout::create_interp): Assert that there is no PT_INTERP
2899         segment.  If not using a SECTIONS clause, use make_output_section.
2900         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2901         * script-sections.cc
2902         (Script_sections::create_note_and_tls_segments): If making shared
2903         library, put .interp section in PT_INTERP segment.
2904
2905 2011-06-17  Ian Lance Taylor  <iant@google.com>
2906
2907         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2908         when making a shared library.
2909
2910 2011-06-17  Ian Lance Taylor  <iant@google.com>
2911
2912         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2913         parameter.  Change all callers.  Don't issue warning about PC32
2914         against locally defined symbol.
2915
2916 2011-06-16  Ian Lance Taylor  <iant@google.com>
2917
2918         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2919         occurs in same object.
2920
2921 2011-06-14  Alan Modra  <amodra@gmail.com>
2922
2923         * po/POTFILES.in: Regenerate.
2924
2925 2011-06-09  Ian Lance Taylor  <iant@google.com>
2926
2927         * script-sections.cc
2928         (Orphan_output_section::set_section_addresses): For a relocatable
2929         link set address to 0.
2930
2931 2011-06-09  Cary Coutant  <ccoutant@google.com>
2932
2933         PR gold/12804
2934         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2935         used with --compress-debug-sections.
2936         * gold/object.cc (Sized_relobj_file::do_layout): Report
2937         uncompressed size of compressed input sections.
2938
2939 2011-06-08  Cary Coutant  <ccoutant@google.com>
2940
2941         PR gold/12804
2942         * testsuite/two_file_test_2_v1.cc: Change initialization of
2943         v2 to keep it in .data.
2944
2945 2011-06-07  Cary Coutant  <ccoutant@google.com>
2946
2947         * common.cc (Symbol_table::do_allocate_commons_list): Call
2948         gold_fallback.
2949         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2950         (Errors::fallback): New function.
2951         (gold_fallback): New function.
2952         * errors.h (Errors::fallback): New function.
2953         * gold.cc (gold_exit): Change status parameter to enum; adjust
2954         all callers.
2955         (queue_initial_tasks): Call gold_fallback.
2956         * gold.h: Include cstdlib.
2957         (Exit_status): New enum type.
2958         (gold_exit): Change status parameter to enum.
2959         (gold_fallback): New function.
2960         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2961         (Layout::create_symtab_sections): Likewise.
2962         (Layout::create_shdrs): Likewise.
2963         * main.cc (main): Adjust call to gold_exit.
2964         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2965         (Output_data_got::add_got_entry_pair): Likewise.
2966         (Output_section::add_input_section): Likewise.
2967         (Output_section::add_output_section_data): Likewise.
2968         (Output_segment::set_section_list_addresses): Likewise.
2969         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2970
2971 2011-06-07  Cary Coutant  <ccoutant@google.com>
2972
2973         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2974         for incremental links.
2975         * output.cc (Output_segment::set_section_list_addresses): Remove
2976         FIXME and test for TLS or BSS.
2977
2978 2011-06-07  Cary Coutant  <ccoutant@google.com>
2979
2980         * testsuite/Makefile.am: Add incremental_copy_test,
2981         incremental_common_test_1.
2982         * testsuite/Makefile.in: Regenerate.
2983         * testsuite/common_test_1_v1.c: New source file.
2984         * testsuite/common_test_1_v2.c: New source file.
2985         * testsuite/copy_test_v1.cc: New source file.
2986
2987 2011-06-07  Cary Coutant  <ccoutant@google.com>
2988
2989         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2990         update, allocate common from bss section's free list.
2991         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2992         linker-defined symbols.
2993         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2994         Skip GOT and PLT entries that are no longer referenced.
2995         (Output_section_incremental_inputs::write_info_blocks): Mark
2996         linker-defined symbols.
2997         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2998         * output.cc (Output_section::allocate): New function.
2999         * output.h (Output_section::allocate): New function.
3000         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3001         linker-defined symbols.
3002         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3003         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3004         (Symbol::init_base_output_data): Likewise.
3005         (Symbol::init_base_output_segment): Likewise.
3006         (Symbol::init_base_constant): Likewise.
3007         (Sized_symbol::init_output_data): Likewise.
3008         (Sized_symbol::init_output_segment): Likewise.
3009         (Sized_symbol::init_constant): Likewise.
3010         (Symbol_table::do_define_in_output_data): Likewise.
3011         (Symbol_table::do_define_in_output_segment): Likewise.
3012         (Symbol_table::do_define_as_constant): Likewise.
3013         * symtab.h (Symbol::is_predefined): New function.
3014         (Symbol::init_base_output_data): Add is_predefined parameter.
3015         (Symbol::init_base_output_segment): Likewise.
3016         (Symbol::init_base_constant): Likewise.
3017         (Symbol::is_predefined_): New data member.
3018         (Sized_symbol::init_output_data): Add is_predefined parameter.
3019         (Sized_symbol::init_output_segment): Likewise.
3020         (Sized_symbol::init_constant): Likewise.
3021         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3022
3023 2011-06-07  Cary Coutant  <ccoutant@google.com>
3024
3025         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3026         instead of emit_copy_reloc.
3027         (Copy_relocs::emit_copy_reloc): Refactor.
3028         (Copy_relocs::make_copy_reloc): New function.
3029         (Copy_relocs::add_copy_reloc): Remove.
3030         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3031         section.
3032         (Copy_relocs::make_copy_reloc): New function.
3033         (Copy_relocs::add_copy_reloc): Remove.
3034         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3035         unchanged input files.
3036         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3037         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3038         Reserve BSS space for COPY relocations.
3039         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3040         (Output_section_incremental_inputs::write_info_blocks): Record
3041         whether a symbol is copied from a shared object.
3042         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3043         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3044         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3045         (Incremental_input_entry_reader::get_output_symbol_index): Add
3046         is_copy parameter.
3047         (Incremental_binary::emit_copy_relocs): New function.
3048         (Incremental_binary::do_emit_copy_relocs): New function.
3049         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3050         new data member.
3051         (Sized_incremental_binary::add_copy_reloc): New function.
3052         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3053         (Sized_incremental_binary::Copy_reloc): New struct.
3054         (Sized_incremental_binary::Copy_relocs): New typedef.
3055         (Sized_incremental_binary::copy_relocs_): New data member.
3056         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3057         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3058         * target.h (Sized_target::emit_copy_reloc): New function.
3059         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3060
3061 2011-06-02  Cary Coutant  <ccoutant@google.com>
3062
3063         PR gold/12163
3064         * gold/archive.cc (Archive::Archive): Initialize new data member.
3065         (Archive::include_all_members): Return if archive has already been
3066         included.
3067         * gold/archive.h (Archive::include_all_members_): New data member.
3068
3069 2011-06-02  Nick Clifton  <nickc@redhat.com>
3070
3071         * dynobj.h: Fix spelling mistake in comment.
3072         * output.cc: Likewise.
3073
3074 2011-05-31  Doug Kwan  <dougkwan@google.com>
3075             Asier Llano
3076
3077         PR gold/12826
3078         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3079         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3080         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3081         redundant arm_exidx_test.so.
3082         * testsuite/Makefile.in: Regenerate.
3083         (check_SCRIPTS): Add pr12826.sh
3084         (check_DATA): Add pr12826.stdout
3085         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3086         * testsuite/pr12826.sh: New file.
3087         * testsuite/pr12826_1.s: Ditto.
3088         * testsuite/pr12826_1.s: Ditto.
3089
3090 2011-05-30  Ian Lance Taylor  <iant@google.com>
3091
3092         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3093         sections.
3094
3095 2011-05-29  Ian Lance Taylor  <iant@google.com>
3096
3097         PR gold/12804
3098         * testsuite/Makefile.am: Use different file name for two_file_test
3099         temporary file for each incremental test.
3100         * testsuite/Makefile.in: Rebuild.
3101
3102 2011-05-29  Ian Lance Taylor  <iant@google.com>
3103
3104         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3105         binary input file is empty.
3106
3107 2011-05-27  Ian Lance Taylor  <iant@google.com>
3108
3109         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3110         (ver_test_9.so): Likewise.
3111         * testsuite/Makefile.in: Rebuild.
3112
3113 2011-05-26 Cary Coutant  <ccoutant@google.com>
3114
3115         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3116         * incremental.cc (Incremental_inputs::report_input_section): Fix
3117         comment, indentation.
3118         (Incremental_inputs::report_comdat_group): New function.
3119         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3120         of data for incremental input file entry.
3121         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3122         group count, COMDAT group signatures.
3123         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3124         an unchanged input file.
3125         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3126         Initialize new data member.
3127         (Incremental_object_entry::add_comdat_group): New function.
3128         (Incremental_object_entry::get_comdat_group_count): New function.
3129         (Incremental_object_entry::get_comdat_signature_key): New function.
3130         (Incremental_object_entry::groups_): New data member.
3131         (Incremental_inputs::report_comdat_group): New function.
3132         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3133         data for incremental input file entry.
3134         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3135         (Incremental_input_entry_reader::get_input_section): Adjust size of
3136         data for incremental input file entry.
3137         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3138         (Incremental_input_entry_reader::get_comdat_group_signature): New
3139         function.
3140         * object.cc (Sized_relobj::include_section_group): Report kept
3141         COMDAT groups for incremental links.
3142
3143 2011-05-24  David Meyer  <pdox@google.com>
3144
3145         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3146         with name parameter.  Add found_name parameter.
3147         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3148         * dirsearch.h (class Dirsearch): Update declaration.
3149
3150 2011-05-24  Ian Lance Taylor  <iant@google.com>
3151
3152         * archive.cc (Library_base::should_include_member): Pull in object
3153         from archive if it defines the entry symbol.
3154         * parameters.cc (Parameters::entry): New function.
3155         * parameters.h (class Parameters): Declare entry.
3156         * output.h (class Output_file_header): Remove entry_ field.
3157         * output.cc (Output_file_header::Output_file_header): Remove entry
3158         parameter.  Change all callers.
3159         (Output_file_header::entry): Use parameters->entry.
3160         * gold.cc (queue_middle_tasks): Likewise.
3161         * plugin.cc (Plugin_hook::run): Likewise.
3162
3163 2011-05-24 Cary Coutant  <ccoutant@google.com>
3164
3165         * gold.cc (queue_initial_tasks): Pass incremental base filename
3166         to Output_file::open_base_file; don't print error message.
3167         * incremental-dump.cc (main): Adjust call to
3168         Output_file::open_for_modification.
3169         * incremental-dump.cc (main): Likewise.
3170         * incremental.cc (Incremental_inputs::report_command_line):
3171         Ignore --incremental-base option when comparing command lines.
3172         Ignore parameter when given as separate argument.
3173         * options.h (class General_options): Add --incremental-base.
3174         * output.cc (Output_file::Output_file):
3175         (Output_file::open_base_file): Add base_name and writable parameters;
3176         read base file into new file; print error message here.
3177         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3178         callers.
3179         * output.h (Output_file::open_for_modification): Rename to...
3180         (Output_file::open_base_file): ...this; add base_name and
3181         writable parameters; adjust all callers.
3182         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3183         callers.
3184         * testsuite/Makefile.am (incremental_test_4): Test
3185         --incremental-base.
3186         * testsuite/Makefile.in: Regenerate.
3187
3188 2011-05-24 Cary Coutant  <ccoutant@google.com>
3189
3190         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3191         incremental_test_4.
3192         * testsuite/Makefile.in: Regenerate.
3193         * testsuite/two_file_test_1_v1.cc: New test source file.
3194         * testsuite/two_file_test_1b_v1.cc: New test source file.
3195         * testsuite/two_file_test_2_v1.cc: New test source file.
3196
3197 2011-05-24 Cary Coutant  <ccoutant@google.com>
3198
3199         * dynobj.h (Dynobj::do_dynobj): New function.
3200         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3201         flag and soname for shared objects.
3202         * incremental.cc (Incremental_inputs::report_object): Make
3203         either Incremental_object_entry or Incremental_dynobj_entry; add
3204         soname to string table.
3205         (Incremental_inputs::report_input_section): Add assertion.
3206         (Output_section_incremental_inputs::set_final_data_size): Adjust
3207         type of input file entry for shared libraries; adjust size of
3208         shared library info entry.
3209         (Output_section_incremental_inputs::write_input_files): Write
3210         as_needed flag for shared libraries.
3211         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3212         of input file entry for shared libraries; write soname.
3213         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3214         soname from incremental info.
3215         * incremental.h (enum Incremental_input_flags): Add
3216         INCREMENTAL_INPUT_AS_NEEDED.
3217         (Incremental_input_entry::Incremental_input_entry): Initialize new
3218         data member.
3219         (Incremental_input_entry::set_as_needed): New function.
3220         (Incremental_input_entry::as_needed): New function.
3221         (Incremental_input_entry::do_dynobj_entry): New function.
3222         (Incremental_input_entry::as_needed_): New data member.
3223         (Incremental_object_entry::Incremental_object_entry): Don't check
3224         for shared library.
3225         (Incremental_object_entry::do_type): Likewise.
3226         (class Incremental_dynobj_entry): New class.
3227         (Incremental_input_entry_reader::as_needed): New function.
3228         (Incremental_input_entry_reader::get_soname): New function.
3229         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3230         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3231         size of shared library info entry.
3232         * layout.cc (Layout::finish_dynamic_section): Don't test for
3233         incremental link when adding DT_NEEDED entries.
3234         * object.h (Object::Object): Initialize new data member.
3235         (Object::dynobj): New function.
3236         (Object::set_as_needed): New function.
3237         (Object::as_needed): New function.
3238         (Object::do_dynobj): New function.
3239         (Object::as_needed_): New data member.
3240
3241 2011-05-24 Cary Coutant  <ccoutant@google.com>
3242
3243         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3244         info; adjust display of GOT entries.
3245         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3246         vector of input objects; remove file_status_.
3247         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3248         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3249         got_plt reader; call target hooks to reserve GOT entries.
3250         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3251         of input file info header and GOT info entry.
3252         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3253         relocation info.
3254         (Got_plt_view_info::got_descriptor): Remove.
3255         (Got_plt_view_info::sym_index): New data member.
3256         (Got_plt_view_info::input_index): New data member.
3257         (Local_got_offset_visitor::visit): Write input file index.
3258         (Global_got_offset_visitor::visit): Write 0 for input file index.
3259         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3260         with sym_index and input_index.
3261         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3262         incremental info GOT entry; replace got_descriptor with input_index.
3263         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3264         map from input file index to object.
3265         (Sized_relobj_incr::do_layout): Replace direct data member reference
3266         with accessor function.
3267         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3268         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3269         Adjust size of input file info header.
3270         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3271         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3272         (Incremental_input_entry_reader::get_input_section): Adjust size of
3273         input file info header.
3274         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3275         of incremental info GOT entry.
3276         (Incremental_got_plt_reader::get_got_desc): Remove.
3277         (Incremental_got_plt_reader::get_got_symndx): New function.
3278         (Incremental_got_plt_reader::get_got_input_index): New function.
3279         (Sized_incremental_binary::Sized_incremental_binary): Remove
3280         file_status_; add input_objects_.
3281         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3282         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3283         (Sized_incremental_binary::file_is_unchanged): Remove.
3284         (Sized_incremental_binary::set_input_object): New function.
3285         (Sized_incremental_binary::input_object): New function.
3286         (Sized_incremental_binary::file_status_): Remove.
3287         (Sized_incremental_binary::input_objects_): New data member.
3288         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3289         references.
3290         (Sized_relobj_incr::invalid_address): Move to base class.
3291         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3292         class.
3293         (Sized_relobj_incr::do_output_section_offset): Likewise.
3294         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3295         (Sized_relobj_incr::section_offsets_): Likewise.
3296         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3297         function.
3298         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3299         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3300         with accessor function.
3301         (Sized_relobj_file::do_layout): Likewise.
3302         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3303         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3304         (Sized_relobj_file::compute_final_local_value): Replace refs to
3305         section_offsets_ with accessor function.
3306         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3307         * object.h (Relobj::Relobj): Initialize new data members.
3308         (Relobj::add_dyn_reloc): New function.
3309         (Relobj::first_dyn_reloc): New function.
3310         (Relobj::dyn_reloc_count): New function.
3311         (Relobj::first_dyn_reloc_): New data member.
3312         (Relobj::dyn_reloc_count_): New data member.
3313         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3314         references.
3315         (Sized_relobj::Address): New typedef.
3316         (Sized_relobj::invalid_address): Move here from child class.
3317         (Sized_relobj::Sized_relobj): Initialize new data members.
3318         (Sized_relobj::sized_relobj): New function.
3319         (Sized_relobj::is_output_section_offset_invalid): Move here from
3320         child class.
3321         (Sized_relobj::get_output_section_offset): Likewise.
3322         (Sized_relobj::local_has_got_offset): Likewise.
3323         (Sized_relobj::local_got_offset): Likewise.
3324         (Sized_relobj::set_local_got_offset): Likewise.
3325         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3326         (Sized_relobj::clear_got_offsets): New function.
3327         (Sized_relobj::section_offsets): Move here from child class.
3328         (Sized_relobj::do_output_section_offset): Likewise.
3329         (Sized_relobj::do_set_section_offset): Likewise.
3330         (Sized_relobj::Local_got_offsets): Likewise.
3331         (Sized_relobj::local_got_offsets_): Likewise.
3332         (Sized_relobj::section_offsets_): Likewise.
3333         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3334         references.
3335         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3336         class.
3337         (Sized_relobj_file::sized_relobj): New function
3338         (Sized_relobj_file::local_has_got_offset): Move to base class.
3339         (Sized_relobj_file::local_got_offset): Likewise.
3340         (Sized_relobj_file::set_local_got_offset): Likewise.
3341         (Sized_relobj_file::get_output_section_offset): Likewise.
3342         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3343         (Sized_relobj_file::do_output_section_offset): Likewise.
3344         (Sized_relobj_file::do_set_section_offset): Likewise.
3345         (Sized_relobj_file::Local_got_offsets): Likewise.
3346         (Sized_relobj_file::local_got_offsets_): Likewise.
3347         (Sized_relobj_file::section_offsets_): Likewise.
3348         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3349         (all constructors).
3350         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3351         (Output_reloc::get_symbol_index): Likewise.
3352         (Output_reloc::local_section_offset): Likewise.
3353         (Output_reloc::get_address): Likewise.
3354         (Output_reloc::symbol_value): Likewise.
3355         (Output_data_got::reserve_slot): Move to class definition.
3356         (Output_data_got::reserve_local): New function.
3357         (Output_data_got::reserve_slot_for_global): Remove.
3358         (Output_data_got::reserve_global): New function.
3359         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3360         (all constructors, two instantiations).
3361         (Output_reloc::get_relobj): New function (two instantiations).
3362         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3363         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3364         (Output_data_reloc::add_global): Adjust type of relobj.
3365         (Output_data_reloc::add_global_relative): Likewise.
3366         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3367         (Output_data_reloc::add_local): Likewise.
3368         (Output_data_reloc::add_local_relative): Likewise.
3369         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3370         (Output_data_reloc::add_local_section): Likewise.
3371         (Output_data_reloc::add_output_section): Likewise.
3372         (Output_data_reloc::add_absolute): Likewise.
3373         (Output_data_reloc::add_target_specific): Likewise.
3374         (Output_data_got::reserve_slot): Move definition here.
3375         (Output_data_got::reserve_local): New function.
3376         (Output_data_got::reserve_global): New function.
3377         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3378         section_offsets_ with accessor function.
3379         (Sized_relobj_file::write_sections): Likewise.
3380         (Sized_relobj_file::do_relocate_sections): Likewise.
3381         * target.h (Sized_target::reserve_local_got_entry): New function.
3382         (Sized_target::reserve_global_got_entry): New function.
3383         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3384         (Target_x86_64::reserve_global_got_entry): New function.
3385         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3386
3387 2011-05-23 Cary Coutant  <ccoutant@google.com>
3388
3389         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3390         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3391         bit when checking got_type.
3392         * incremental.cc (Sized_incremental_binary::setup_readers):
3393         Store symbol table and string table locations; initialize bit vector
3394         of file status flags.
3395         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3396         unchanged files.
3397         (Sized_incremental_binary::do_process_got_plt): New function.
3398         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3399         (Output_section_incremental_inputs::set_final_data_size): Record
3400         file index for each input file.
3401         (Output_section_incremental_inputs::write_got_plt): Store file index
3402         instead of input entry offset for each GOT entry.
3403         * incremental.h
3404         (Incremental_input_entry::Incremental_input_entry): Initialize new
3405         data member.
3406         (Incremental_input_entry::set_offset): Store file index.
3407         (Incremental_input_entry::get_file_index): New function.
3408         (Incremental_input_entry::file_index_): New data member.
3409         (Incremental_binary::process_got_plt): New function.
3410         (Incremental_binary::do_process_got_plt): New function.
3411         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3412         data members.
3413         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3414         (Sized_incremental_binary::set_file_is_unchanged): New function.
3415         (Sized_incremental_binary::file_is_unchanged): New function.
3416         (Sized_incremental_binary::do_process_got_plt): New function.
3417         (Sized_incremental_binary::file_status_): New data member.
3418         (Sized_incremental_binary::main_symtab_loc_): New data member.
3419         (Sized_incremental_binary::main_strtab_loc_): New data member.
3420         * output.cc (Output_data_got::Got_entry::write): Add case
3421         RESERVED_CODE.
3422         (Output_data_got::add_global): Call add_got_entry.
3423         (Output_data_got::add_global_plt): Likewise.
3424         (Output_data_got::add_global_with_rel): Likewise.
3425         (Output_data_got::add_global_with_rela): Likewise.
3426         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3427         (Output_data_got::add_global_pair_with_rela): Likewise.
3428         (Output_data_got::add_local): Call add_got_entry.
3429         (Output_data_got::add_local_plt): Likewise.
3430         (Output_data_got::add_local_with_rel): Likewise.
3431         (Output_data_got::add_local_with_rela): Likewise.
3432         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3433         (Output_data_got::add_local_pair_with_rela): Likewise.
3434         (Output_data_got::reserve_slot): New function.
3435         (Output_data_got::reserve_slot_for_global): New function.
3436         (Output_data_got::add_got_entry): New function.
3437         (Output_data_got::add_got_entry_pair): New function.
3438         (Output_section::add_output_section_data): Edit FIXME.
3439         * output.h
3440         (Output_section_data_build::Output_section_data_build): New
3441         constructor with size parameter.
3442         (Output_data_space::Output_data_space): Likewise.
3443         (Output_data_got::Output_data_got): Initialize new data member; new
3444         constructor with size parameter.
3445         (Output_data_got::add_constant): Call add_got_entry.
3446         (Output_data_got::reserve_slot): New function.
3447         (Output_data_got::reserve_slot_for_global): New function.
3448         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3449         (Output_data_got::add_got_entry): New function.
3450         (Output_data_got::add_got_entry_pair): New function.
3451         (Output_data_got::free_list_): New data member.
3452         * target.h (Sized_target::init_got_plt_for_update): New function.
3453         (Sized_target::register_global_plt_entry): New function.
3454         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3455         Initialize new data member; call init; add constructor with PLT count.
3456         (Output_data_plt_x86_64::init): New function.
3457         (Output_data_plt_x86_64::add_relocation): New function.
3458         (Output_data_plt_x86_64::reserve_slot): New function.
3459         (Output_data_plt_x86_64::free_list_): New data member.
3460         (Target_x86_64::init_got_plt_for_update): New function.
3461         (Target_x86_64::register_global_plt_entry): New function.
3462         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3463         incremental updates.
3464         (Output_data_plt_x86_64::add_relocation): New function.
3465         * testsuite/object_unittest.cc (Object_test): Set default options.
3466
3467 2011-05-16  Ian Lance Taylor  <iant@google.com>
3468
3469         * options.h (class General_options): Make -i a synonym for -r.
3470
3471 2011-05-16  Ian Lance Taylor  <iant@google.com>
3472
3473         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3474
3475 2011-05-10 Cary Coutant  <ccoutant@google.com>
3476
3477         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3478         strip_all (-s).
3479
3480 2011-05-06  Ian Lance Taylor  <iant@google.com>
3481
3482         * layout.cc (Layout::layout): If the output section flags change,
3483         update the ordering.
3484
3485 2011-04-25 Cary Coutant  <ccoutant@google.com>
3486
3487         * incremental-dump.cc (dump_incremental_inputs): Print local
3488         symbol info for each input file.
3489         * incremental.cc
3490         (Output_section_incremental_inputs::set_final_data_size): Add local
3491         symbol info to input file entries in incremental info.
3492         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3493         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3494         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3495         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3496         implementation.
3497         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3498         (Sized_incr_relobj::do_relocate): Write the local symbols.
3499         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3500         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3501         Adjust size of input file header.
3502         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3503         (Incremental_inputs_reader::get_local_symbol_count): New function.
3504         (Incremental_inputs_reader::get_input_section): Adjust size of input
3505         file header.
3506         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3507         (Sized_incr_relobj::This): New typedef.
3508         (Sized_incr_relobj::sym_size): New const data member.
3509         (Sized_incr_relobj::Local_symbol): New struct.
3510         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3511         (Sized_incr_relobj::do_local_symbol_offset): New function.
3512         (Sized_incr_relobj::local_symbol_count_): New data member.
3513         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3514         (Sized_incr_relobj::local_symbol_index_): New data member.
3515         (Sized_incr_relobj::local_symbol_offset_): New data member.
3516         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3517         (Sized_incr_relobj::local_symbols_): New data member.
3518         * object.h (Relobj::output_local_symbol_count): New function.
3519         (Relobj::local_symbol_offset): New function.
3520         (Relobj::do_output_local_symbol_count): New function.
3521         (Relobj::do_local_symbol_offset): New function.
3522         (Sized_relobj::do_output_local_symbol_count): New function.
3523         (Sized_relobj::do_local_symbol_offset): New function.
3524
3525 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3526
3527         * descriptors.cc (set_close_on_exec): New function.
3528         (Descriptors::open): Use set_close_on_exec.
3529         * output.cc (S_ISLNK): Define if not defined.
3530
3531 2011-04-22 Cary Coutant  <ccoutant@google.com>
3532
3533         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3534         global symbol map.
3535         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3536         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3537         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3538         relocations.
3539         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3540         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3541         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3542         * incremental.h
3543         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3544         function.
3545         (Incremental_binary::apply_incremental_relocs): New function.
3546         (Incremental_binary::do_apply_incremental_relocs): New function.
3547         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3548         data member.
3549         (Sized_incremental_binary::add_global_symbol): New function.
3550         (Sized_incremental_binary::global_symbol): New function.
3551         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3552         (Sized_incremental_binary::symbol_map_): New data member.
3553         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3554         * target.h (Sized_target::apply_relocation): New function.
3555         * target-reloc.h (apply_relocation): New function.
3556         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3557
3558 2011-04-22  Doug Kwan  <dougkwan@google.com>
3559
3560         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3561         flag of a SHT_ARM_EXIDX section.
3562         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3563         * testsuite/Makefile.in: Regenerate.
3564         * testsuite/arm_exidx_test.s: New file.
3565         * testsuite/arm_exidx_test.sh: Same.
3566
3567 2011-04-20 Cary Coutant  <ccoutant@google.com>
3568
3569         PR gold/12689
3570         * archive.h (Incremental_archive_entry::Archive_member):
3571         Initialize arg_serial_ (second constructor).
3572
3573 2011-04-17  Ian Lance Taylor  <iant@google.com>
3574
3575         * object.cc (Relocate_info::location): Simplify location string.
3576         * errors.cc (Errors::error_at_location): Don't print program
3577         name.
3578         (Errors::warning_at_location): Likewise.
3579         (Errors::undefined_symbol): Likewise.
3580         * testsuite/debug_msg.sh: Update accordingly.
3581
3582 2011-04-14 Cary Coutant  <ccoutant@google.com>
3583
3584         * gold/layout.cc (Layout::symtab_section_offset): New function.
3585         * gold/layout.h (Layout::symtab_section_offset): New function.
3586         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3587
3588 2011-04-12  Ian Lance Taylor  <iant@google.com>
3589
3590         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3591         with MREMAP_MAYMOVE.
3592         * output.h (class Output_file): Add map_is_allocated_ field.
3593         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3594         not available, provide stubs.  If mremap is not available, #define
3595         it to gold_mremap.
3596         (MREMAP_MAYMOVE): Define if not defined.
3597         (Output_file::Output_file): Initialize map_is_allocated_.
3598         (Output_file::resize): Check map_is_allocated_.
3599         (Output_file::map_anonymous): If mmap fails, use malloc.
3600         (Output_file::unmap): Don't do anything for an anonymous map.
3601         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3602         is not available, provide stubs.
3603         (File_read::View::~View): Use free rather than delete[].
3604         (File_read::make_view): Use malloc rather than new[].  If mmap
3605         fails, use malloc.
3606         (File_read::find_or_make_view): Use malloc rather than new[].
3607         * gold.h: Remove HAVE_REMAP code.
3608         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3609         exists.  Rename mremap to gold_mremap.  If mmap is not available
3610         don't do anything.
3611         * configure, config.in: Rebuild.
3612
3613 2011-04-11  Ian Lance Taylor  <iant@google.com>
3614
3615         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3616         initialize local variable v.
3617
3618 2011-04-11  Cary Coutant  <ccoutant@google.com>
3619
3620         * archive.cc (Archive::include_member): Adjust call to
3621         report_object.
3622         (Add_archive_symbols::run): Track argument serial numbers.
3623         (Lib_group::include_member): Likewise.
3624         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3625         * archive.h (Incremental_archive_entry::Archive_member):
3626         Initialize arg_serial_.
3627         (Archive_member::arg_serial_): New data member.
3628         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3629         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3630         incremental link.
3631         (Sized_dynobj::do_for_all_local_got_entries): New function.
3632         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3633         function.
3634         * fileread.cc (get_mtime): New function.
3635         * fileread.h (get_mtime): New function.
3636         * gold.cc (queue_initial_tasks): Check for incremental update.
3637         (process_incremental_input): New function.
3638         (queue_middle_tasks): Don't force valid target for incremental
3639         update.
3640         * incremental-dump.cc (find_input_containing_global): Adjust
3641         size of symbol info entry.
3642         (dump_incremental_inputs): Dump argument serial number and
3643         in_system_directory flag; bias shndx by 1; print symbol names
3644         when dumping per-file symbol lists; use new symbol info readers.
3645         * incremental.cc
3646         (Output_section_incremental_inputs:update_data_size): New function.
3647         (Sized_incremental_binary::setup_readers): Setup input readers
3648         for each input file; build maps for files added from libraries
3649         and scripts.
3650         (Sized_incremental_binary::check_input_args): New function.
3651         (Sized_incremental_binary::do_check_inputs): Build map of argument
3652         serial numbers to input arguments.
3653         (Sized_incremental_binary::do_file_has_changed): Rename
3654         do_file_is_unchanged to this; compare file modification times.
3655         (Sized_incremental_binary::do_init_layout): New function.
3656         (Sized_incremental_binary::do_reserve_layout): New function.
3657         (Sized_incremental_binary::do_get_input_reader): Remove.
3658         (Sized_incremental_binary::get_symtab_view): New function.
3659         (Incremental_checker::can_incrementally_link_output_file): Remove.
3660         (Incremental_inputs::report_command_line): Exclude --debug options.
3661         (Incremental_inputs::report_archive_begin): Add parameter; track
3662         argument serial numbers; don't put input file entry for archive
3663         before archive members.
3664         (Incremental_inputs::report_archive_end): Put input file entry
3665         for archive after archive members.
3666         (Incremental_inputs::report_object): Add parameter; track argument
3667         serial numbers and in_system_directory flag.
3668         (Incremental_inputs::report_script): Add parameter; track argument
3669         serial numbers.
3670         (Output_section_incremental_inputs::set_final_data_size): Adjust
3671         size of symbol info entry; check for forwarding symbols.
3672         (Output_section_incremental_inputs::write_input_files): Write
3673         in_system_directory flag and argument serial number.
3674         (Output_section_incremental_inputs::write_info_blocks): Map section
3675         indices between incremental info and original input file; store
3676         input section index for each symbol.
3677         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3678         change operator() to visit().
3679         (class Global_got_offset_visitor): Likewise.
3680         (class Global_symbol_visitor_got_plt):
3681         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3682         classes.
3683         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3684         (Sized_incr_relobj::do_read_symbols): New function.
3685         (Sized_incr_relobj::do_layout): New function.
3686         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3687         (Sized_incr_relobj::do_add_symbols): New function.
3688         (Sized_incr_relobj::do_should_include_member): New function.
3689         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3690         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3691         (Sized_incr_relobj::do_section_size): New function.
3692         (Sized_incr_relobj::do_section_name): New function.
3693         (Sized_incr_relobj::do_section_contents): New function.
3694         (Sized_incr_relobj::do_section_flags): New function.
3695         (Sized_incr_relobj::do_section_entsize): New function.
3696         (Sized_incr_relobj::do_section_address): New function.
3697         (Sized_incr_relobj::do_section_type): New function.
3698         (Sized_incr_relobj::do_section_link): New function.
3699         (Sized_incr_relobj::do_section_info): New function.
3700         (Sized_incr_relobj::do_section_addralign): New function.
3701         (Sized_incr_relobj::do_initialize_xindex): New function.
3702         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3703         (Sized_incr_relobj::do_read_relocs): New function.
3704         (Sized_incr_relobj::do_gc_process_relocs): New function.
3705         (Sized_incr_relobj::do_scan_relocs): New function.
3706         (Sized_incr_relobj::do_count_local_symbols): New function.
3707         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3708         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3709         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3710         (Sized_incr_relobj::do_relocate): New function.
3711         (Sized_incr_relobj::do_set_section_offset): New function.
3712         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3713         (Sized_incr_dynobj::do_read_symbols): New function.
3714         (Sized_incr_dynobj::do_layout): New function.
3715         (Sized_incr_dynobj::do_add_symbols): New function.
3716         (Sized_incr_dynobj::do_should_include_member): New function.
3717         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3718         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3719         (Sized_incr_dynobj::do_section_size): New function.
3720         (Sized_incr_dynobj::do_section_name): New function.
3721         (Sized_incr_dynobj::do_section_contents): New function.
3722         (Sized_incr_dynobj::do_section_flags): New function.
3723         (Sized_incr_dynobj::do_section_entsize): New function.
3724         (Sized_incr_dynobj::do_section_address): New function.
3725         (Sized_incr_dynobj::do_section_type): New function.
3726         (Sized_incr_dynobj::do_section_link): New function.
3727         (Sized_incr_dynobj::do_section_info): New function.
3728         (Sized_incr_dynobj::do_section_addralign): New function.
3729         (Sized_incr_dynobj::do_initialize_xindex): New function.
3730         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3731         (make_sized_incremental_object): New function.
3732         (Incremental_library::copy_unused_symbols): New function.
3733         (Incremental_library::do_for_all_unused_symbols): New function.
3734         * incremental.h (enum Incremental_input_flags): New type.
3735         (class Incremental_checker): Remove.
3736         (Incremental_input_entry::Incremental_input_entry): Add argument
3737         serial number.
3738         (Incremental_input_entry::arg_serial): New function.
3739         (Incremental_input_entry::set_is_in_system_directory): New function.
3740         (Incremental_input_entry::is_in_system_directory): New function.
3741         (Incremental_input_entry::arg_serial_): New data member.
3742         (Incremental_input_entry::is_in_system_directory_): New data member.
3743         (class Script_info): Move here from script.h.
3744         (Script_info::Script_info): Add filename parameter.
3745         (Script_info::filename): New function.
3746         (Script_info::filename_): New data member.
3747         (Incremental_script_entry::Incremental_script_entry): Add argument
3748         serial number.
3749         (Incremental_object_entry::Incremental_object_entry): Likewise.
3750         (Incremental_object_entry::add_input_section): Build list of input
3751         sections with map to original shndx.
3752         (Incremental_object_entry::get_input_section_index): New function.
3753         (Incremental_object_entry::shndx_): New data member.
3754         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3755         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3756         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3757         serial number.
3758         (Incremental_inputs::report_archive_begin): Likewise.
3759         (Incremental_inputs::report_object): Likewise.
3760         (Incremental_inputs::report_script): Likewise.
3761         (class Incremental_global_symbol_reader): New class.
3762         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3763         and store flags and input file type.
3764         (Incremental_input_entry_reader::arg_serial): New function.
3765         (Incremental_input_entry_reader::type): Extract type from flags.
3766         (Incremental_input_entry_reader::is_in_system_directory): New function.
3767         (Incremental_input_entry_reader::get_input_section_count): Call
3768         accessor function for type.
3769         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3770         function for type; adjust size of global symbol entry.
3771         (Incremental_input_entry_reader::get_global_symbol_count): Call
3772         accessor function for type.
3773         (Incremental_input_entry_reader::get_object_count): Likewise.
3774         (Incremental_input_entry_reader::get_object_offset): Likewise.
3775         (Incremental_input_entry_reader::get_member_count): Likewise.
3776         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3777         (Incremental_input_entry_reader::get_member_offset): Likewise.
3778         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3779         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3780         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3781         (Incremental_input_entry_reader::get_global_symbol_reader): New
3782         function.
3783         (Incremental_input_entry_reader::get_output_symbol_index): New
3784         function.
3785         (Incremental_input_entry_reader::type_): Remove.
3786         (Incremental_input_entry_reader::flags_): New data member.
3787         (Incremental_inputs_reader::input_file_offset): New function.
3788         (Incremental_inputs_reader::input_file_index): New function.
3789         (Incremental_inputs_reader::input_file): Call input_file_offset.
3790         (Incremental_inputs_reader::input_file_at_offset): New function.
3791         (Incremental_relocs_reader::get_r_type): Reformat.
3792         (Incremental_relocs_reader::get_r_shndx): Reformat.
3793         (Incremental_relocs_reader::get_r_offset): Reformat.
3794         (Incremental_relocs_reader::data): New function.
3795         (Incremental_binary::Incremental_binary): Initialize new data members.
3796         (Incremental_binary::check_inputs): Add cmdline parameter.
3797         (Incremental_binary::file_is_unchanged): Remove.
3798         (Input_reader::arg_serial): New function.
3799         (Input_reader::get_unused_symbol_count): New function.
3800         (Input_reader::get_unused_symbol): New function.
3801         (Input_reader::do_arg_serial): New function.
3802         (Input_reader::do_get_unused_symbol_count): New function.
3803         (Input_reader::do_get_unused_symbol): New function.
3804         (Incremental_binary::input_file_count): New function.
3805         (Incremental_binary::get_input_reader): Change signature to use
3806         index instead of filename.
3807         (Incremental_binary::file_has_changed): New function.
3808         (Incremental_binary::get_input_argument): New function.
3809         (Incremental_binary::get_library): New function.
3810         (Incremental_binary::get_script_info): New function.
3811         (Incremental_binary::init_layout): New function.
3812         (Incremental_binary::reserve_layout): New function.
3813         (Incremental_binary::output_file): New function.
3814         (Incremental_binary::do_check_inputs): New function.
3815         (Incremental_binary::do_file_is_unchanged): Remove.
3816         (Incremental_binary::do_file_has_changed): New function.
3817         (Incremental_binary::do_init_layout): New function.
3818         (Incremental_binary::do_reserve_layout): New function.
3819         (Incremental_binary::do_input_file_count): New function.
3820         (Incremental_binary::do_get_input_reader): Change signature.
3821         (Incremental_binary::input_args_map_): New data member.
3822         (Incremental_binary::library_map_): New data member.
3823         (Incremental_binary::script_map_): New data member.
3824         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3825         new data members.
3826         (Sized_incremental_binary::output_section): New function.
3827         (Sized_incremental_binary::inputs_reader): Add const.
3828         (Sized_incremental_binary::symtab_reader): Add const.
3829         (Sized_incremental_binary::relocs_reader): Add const.
3830         (Sized_incremental_binary::got_plt_reader): Add const.
3831         (Sized_incremental_binary::get_symtab_view): New function.
3832         (Sized_incremental_binary::Inputs_reader): New typedef.
3833         (Sized_incremental_binary::Input_entry_reader): New typedef.
3834         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3835         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3836         (Sized_incremental_binary::do_file_has_changed): New function.
3837         (Sized_incremental_binary::do_init_layout): New function.
3838         (Sized_incremental_binary::do_reserve_layout): New function.
3839         (Sized_input_reader::Inputs_reader): Remove.
3840         (Sized_input_reader::Input_entry_reader): Remove.
3841         (Sized_input_reader::do_arg_serial): New function.
3842         (Sized_input_reader::do_get_unused_symbol_count): New function.
3843         (Sized_input_reader::do_get_unused_symbol): New function.
3844         (Sized_incremental_binary::do_input_file_count): New function.
3845         (Sized_incremental_binary::do_get_input_reader): Change signature;
3846         use index instead of filename.
3847         (Sized_incremental_binary::section_map_): New data member.
3848         (Sized_incremental_binary::input_entry_readers_): New data member.
3849         (class Sized_incr_relobj): New class.
3850         (class Sized_incr_dynobj): New class.
3851         (make_sized_incremental_object): New function.
3852         (class Incremental_library): New class.
3853         * layout.cc (Free_list::num_lists): New static data member.
3854         (Free_list::num_nodes): New static data member.
3855         (Free_list::num_removes): New static data member.
3856         (Free_list::num_remove_visits): New static data member.
3857         (Free_list::num_allocates): New static data member.
3858         (Free_list::num_allocate_visits): New static data member.
3859         (Free_list::init): New function.
3860         (Free_list::remove): New function.
3861         (Free_list::allocate): New function.
3862         (Free_list::dump): New function.
3863         (Free_list::print_stats): New function.
3864         (Layout_task_runner::run): Resize output file for incremental updates.
3865         (Layout::Layout): Initialize new data members.
3866         (Layout::set_incremental_base): New function.
3867         (Layout::init_fixed_output_section): New function.
3868         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3869         incremental updates.
3870         (Layout::create_gold_note): Do not create gold note section for
3871         incremental updates.
3872         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3873         for incremental updates.
3874         (Layout::set_section_offsets): For incremental updates, allocate space
3875         from free list.
3876         (Layout::create_symtab_sections): Layout with offsets relative to
3877         start of section; for incremental updates, allocate space from free
3878         list.
3879         (Layout::create_shdrs): For incremental updates, allocate space from
3880         free list.
3881         (Layout::finish_dynamic_section): For incremental updates, do not
3882         check --as-needed (fixed in subsequent patch).
3883         * layout.h (class Free_list): New class.
3884         (Layout::set_incremental_base): New function.
3885         (Layout::incremental_base): New function.
3886         (Layout::init_fixed_output_section): New function.
3887         (Layout::allocate): New function.
3888         (Layout::incremental_base_): New data member.
3889         (Layout::free_list_): New data member.
3890         * main.cc (main): Print Free_list statistics.
3891         * object.cc (Relobj::finalize_incremental_relocs): Add
3892         clear_counts parameter; clear counts only when clear_counts is set.
3893         (Sized_relobj::Sized_relobj): Initialize new base class.
3894         (Sized_relobj::do_layout): Don't report special sections.
3895         (Sized_relobj::do_for_all_local_got_entries): New function.
3896         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3897         symtab_off to all symbol table offsets.
3898         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3899         * object.h (class Got_offset_list): Move to top of file.
3900         (Object::Object): Allow case where input_file == NULL.
3901         (Object::~Object): Likewise.
3902         (Object::input_file): Assert that input_file != NULL.
3903         (Object::lock): Allow case where input_file == NULL.
3904         (Object::unlock): Likewise.
3905         (Object::is_locked): Likewise.
3906         (Object::token): Likewise.
3907         (Object::release): Likewise.
3908         (Object::is_incremental): New function.
3909         (Object::get_mtime): New function.
3910         (Object::for_all_local_got_entries): New function.
3911         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3912         (Object::set_is_in_system_directory): New function.
3913         (Object::is_in_system_directory): New function.
3914         (Object::do_is_incremental): New function.
3915         (Object::do_get_mtime): New function.
3916         (Object::do_for_all_local_got_entries): New function.
3917         (Object::is_in_system_directory_): New data member.
3918         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3919         (class Sized_relobj_base): New class.
3920         (class Sized_relobj): Derive from Sized_relobj_base.
3921         (class Sized_relobj::Symbols): Redeclare from base class.
3922         (class Sized_relobj::local_got_offset_list): Remove.
3923         (class Sized_relobj::Output_sections): Redeclare from base class.
3924         (class Sized_relobj::do_for_all_local_got_entries): New function.
3925         (class Sized_relobj::write_local_symbols): Add offset parameter.
3926         (class Sized_relobj::local_symbol_offset_): Update comment.
3927         (class Sized_relobj::local_dynsym_offset_): Update comment.
3928         * options.cc (Input_arguments::add_file): Remove const.
3929         * options.h (Input_file_argument::Input_file_argument):
3930         Initialize arg_serial_ (all constructors).
3931         (Input_file_argument::set_arg_serial): New function.
3932         (Input_file_argument::arg_serial): New function.
3933         (Input_file_argument::arg_serial_): New data member.
3934         (Input_arguments::Input_arguments): Initialize file_count_.
3935         (Input_arguments::add_file): Remove const.
3936         (Input_arguments::number_of_input_files): New function.
3937         (Input_arguments::file_count_): New data member.
3938         (Command_line::number_of_input_files): Call
3939         Input_arguments::number_of_input_files.
3940         * output.cc (Output_segment_headers::Output_segment_headers):
3941         Set current size.
3942         (Output_section::Input_section::current_data_size): New function.
3943         (Output_section::Output_section): Initialize new data members.
3944         (Output_section::add_input_section): Don't do merge sections for
3945         an incremental link; allocate space from free list for an
3946         incremental update.
3947         (Output_section::add_output_section_data): Allocate space from
3948         free list for an incremental update.
3949         (Output_section::update_data_size): New function.
3950         (Output_section::set_fixed_layout): New function.
3951         (Output_section::reserve): New function.
3952         (Output_segment::set_section_addresses): Remove const.
3953         (Output_segment::set_section_list_addresses): Remove const; allocate
3954         space from free list for an incremental update.
3955         (Output_segment::set_offset): Adjust size of RELRO segment for an
3956         incremental update.
3957         * output.h (Output_data::current_data_size): Move here from
3958         child classes.
3959         (Output_data::pre_finalize_data_size): New function.
3960         (Output_data::update_data_size): New function.
3961         (Output_section_headers::update_data_size): new function.
3962         (Output_section_data_build::current_data_size): Move to Output_data.
3963         (Output_data_strtab::update_data_size): New function.
3964         (Output_section::current_data_size): Move to Output_data.
3965         (Output_section::set_fixed_layout): New function.
3966         (Output_section::has_fixed_layout): New function.
3967         (Output_section::reserve): New function.
3968         (Output_section::update_data_size): New function.
3969         (Output_section::has_fixed_layout_): New data member.
3970         (Output_section::free_list_): New data member.
3971         (Output_segment::set_section_addresses): Remove const.
3972         (Output_segment::set_section_list_addresses): Remove const.
3973         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3974         New function.
3975         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3976         New function.
3977         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3978         parameter when calling Add_symbols constructor; store argument
3979         serial number for members of a lib group.
3980         (Add_symbols::locks): Allow case where token == NULL.
3981         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3982         (Read_member::~Read_member): New function.
3983         (Read_member::is_runnable): New function.
3984         (Read_member::locks): New function.
3985         (Read_member::run): New function.
3986         (Check_script::~Check_script): New function.
3987         (Check_script::is_runnable): New function.
3988         (Check_script::locks): New function.
3989         (Check_script::run): New function.
3990         (Check_library::~Check_library): New function.
3991         (Check_library::is_runnable): New function.
3992         (Check_library::locks): New function.
3993         (Check_library::run): New function.
3994         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3995         (Add_symbols::library_): New data member.
3996         (class Read_member): New class.
3997         (class Check_script): New class.
3998         (class Check_library): New class.
3999         * reloc.cc (Read_relocs::is_runnable): Allow case where
4000         token == NULL.
4001         (Read_relocs::locks): Likewise.
4002         (Scan_relocs::locks): Likewise.
4003         (Relocate_task::locks): Likewise.
4004         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4005         to clear counters.
4006         (Sized_relobj::incremental_relocs_scan): Fix comment.
4007         (Sized_relobj::do_relocate): Pass output file offset to
4008         write_local_symbols.
4009         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4010         from class declaration.
4011         * script.cc (read_input_script): Allocate Script_info; pass
4012         argument serial number to report_script.
4013         * script.h (class Script_info): Move to incremental.h.
4014         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4015         * symtab.h (Symbol_table::add_from_incrobj): New function.
4016         (Symbol_table::set_file_offset): New function.
4017
4018 2011-04-05  Cary Coutant  <ccoutant@google.com>
4019
4020         * incremental-dump.cc (dump_incremental_inputs): Change signature
4021         to take a Sized_incremental_binary; change caller.  Use readers
4022         in Sized_incremental_binary.
4023         * incremental.cc
4024         (Sized_incremental_binary::find_incremental_inputs_sections):
4025         Rename do_find_incremental_inputs_sections to this.
4026         (Sized_incremental_binary::setup_readers): New function.
4027         (Sized_incremental_binary::do_check_inputs): Check
4028         has_incremental_info_ flag; move setup code to setup_readers;
4029         use input readers.
4030         (Sized_incremental_binary::do_file_is_unchanged): New function.
4031         (Sized_incremental_binary::do_get_input_reader): New function.
4032         * incremental.h (class Incremental_binary): Move to end of file.
4033         (Incremental_binary::file_is_unchanged): New function.
4034         (Incremental_binary::do_file_is_unchanged): New function.
4035         (Incremental_binary::Input_reader): New class.
4036         (Incremental_binary::get_input_reader): New function.
4037         (class Sized_incremental_binary): Move to end of file.
4038         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4039         input section reader classes.
4040         (Sized_incremental_binary::has_incremental_info): New function.
4041         (Sized_incremental_binary::inputs_reader): New function.
4042         (Sized_incremental_binary::symtab_reader): New function.
4043         (Sized_incremental_binary::relocs_reader): New function.
4044         (Sized_incremental_binary::got_plt_reader): New function.
4045         (Sized_incremental_binary::do_file_is_unchanged): New function.
4046         (Sized_incremental_binary::Sized_input_reader): New class.
4047         (Sized_incremental_binary::get_input_reader): New function.
4048         (Sized_incremental_binary::find_incremental_inputs_sections):
4049         Rename do_find_incremental_inputs_sections to this.
4050         (Sized_incremental_binary::setup_readers): New function.
4051         (Sized_incremental_binary::has_incremental_info_): New data member.
4052         (Sized_incremental_binary::inputs_reader_): New data member.
4053         (Sized_incremental_binary::symtab_reader_): New data member.
4054         (Sized_incremental_binary::relocs_reader_): New data member.
4055         (Sized_incremental_binary::got_plt_reader_): New data member.
4056         (Sized_incremental_binary::current_input_file_): New data member.
4057
4058 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4059
4060         PR gold/12640
4061         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4062         violation.
4063
4064 2011-03-30  Cary Coutant  <ccoutant@google.com>
4065
4066         * archive.cc (Archive::include_member): Adjust call to report_object.
4067         (Add_archive_symbols::run): Add script_info to call to
4068         report_archive_begin.
4069         (Lib_group::include_member): Adjust call to report_object.
4070         (Add_lib_group_symbols::run): Adjust call to report_object.
4071         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4072         blocks.  Add object count for script input files.
4073         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4074         script_info parameter; change all callers.
4075         (Incremental_inputs::report_object): Add script_info parameter;
4076         change all callers.
4077         (Incremental_inputs::report_script): Store backpointer to
4078         incremental info entry.
4079         (Output_section_incremental_inputs::set_final_data_size): Record
4080         additional information for scripts.
4081         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4082         * incremental.h (Incremental_script_entry::add_object): New function.
4083         (Incremental_script_entry::get_object_count): New function.
4084         (Incremental_script_entry::get_object): New function.
4085         (Incremental_script_entry::objects_): New data member; adjust
4086         constructor.
4087         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4088         (Incremental_inputs::report_object): Add script_info parameter.
4089         (Incremental_inputs_reader::get_object_count): New function.
4090         (Incremental_inputs_reader::get_object_offset): New function.
4091         * options.cc (Input_arguments::add_file): Return reference to
4092         new input argument.
4093         * options.h (Input_argument::set_script_info): New function.
4094         (Input_argument::script_info): New function.
4095         (Input_argument::script_info_): New data member; adjust all
4096         constructors.
4097         (Input_file_group::add_file): Return reference to new input argument.
4098         (Input_file_lib::add_file): Likewise.
4099         (Input_arguments::add_file): Likewise.
4100         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4101         * script.cc (Parser_closure::Parser_closure): Add script_info
4102         parameter; adjust all callers.
4103         (Parser_closure::script_info): New function.
4104         (Parser_closure::script_info_): New data member.
4105         (read_input_script): Report scripts earlier to incremental info.
4106         (script_add_file): Set script_info in Input_argument.
4107         (script_add_library): Likewise.
4108         * script.h (Script_options::Script_info): Rewrite class.
4109
4110 2011-03-29  Cary Coutant  <ccoutant@google.com>
4111
4112         * archive.cc (Library_base::should_include_member): Move
4113         method here from class Archive.
4114         (Archive::Archive): Initialize base class.
4115         (Archive::should_include_member): Move to base class.
4116         (Archive::do_for_all_unused_symbols): New function.
4117         (Add_archive_symbols::run): Remove redundant access to
4118         incremental_inputs.
4119         (Lib_group::Lib_group): Initialize base class.
4120         (Lib_group::do_filename): New function.
4121         (Lib_group::include_member): Pass pointer to Lib_group to
4122         report_object.
4123         (Lib_group::do_for_all_unused_symbols): New function.
4124         (Add_lib_group_symbols::run): Report archive information for
4125         incremental links.
4126         * archive.h (class Library_base): New base class.
4127         (class Archive): Derive from Library_base.
4128         (Archive::filename): Move to base class.
4129         (Archive::set_incremental_info): Likewise.
4130         (Archive::incremental_info): Likewise.
4131         (Archive::Should_include): Likewise.
4132         (Archive::should_include_member): Likewise.
4133         (Archive::Armap_entry): Remove.
4134         (Archive::Unused_symbol_iterator): Remove.
4135         (Archive::unused_symbols_begin): Remove.
4136         (Archive::unused_symbols_end): Remove.
4137         (Archive::do_filename): New function.
4138         (Archive::do_get_mtime): New function.
4139         (Archive::do_for_all_unused_symbols): New function.
4140         (Archive::task_): Move to base class.
4141         (Archive::incremental_info_): Likewise.
4142         (class Lib_group): Derive from Library_base.
4143         (Lib_group::do_filename): New function.
4144         (Lib_group::do_get_mtime): New function.
4145         (Lib_group::do_for_all_unused_symbols): New function.
4146         (Lib_group::task_): Move to base class.
4147         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4148         function.
4149         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4150         function.
4151         * incremental.cc (Incremental_inputs::report_archive_begin):
4152         Use Library_base; call library's get_mtime; add incremental inputs
4153         entry before members.
4154         (class Unused_symbol_visitor): New class.
4155         (Incremental_inputs::report_archive_end): Use Library_base; use
4156         visitor class to record unused symbols; don't add incremental inputs
4157         entry after members.
4158         (Incremental_inputs::report_object): Use Library_base.
4159         * incremental.h
4160         (Incremental_archive_entry::Incremental_archive_entry): Remove
4161         unused Archive parameter.
4162         (Incremental_inputs::report_archive_begin): Use Library_base.
4163         (Incremental_inputs::report_archive_end): Likewise.
4164         (Incremental_inputs::report_object): Likewise.
4165         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4166         function.
4167         * object.h (Object::for_all_global_symbols): New function.
4168         (Object::do_for_all_global_symbols): New function.
4169         (Sized_relobj::do_for_all_global_symbols): New function.
4170         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4171         function.
4172         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4173         function.
4174
4175 2011-03-27  Ian Lance Taylor  <iant@google.com>
4176
4177         * archive.cc (Archive::interpret_header): Return -1 if something
4178         goes wrong.  Change callers accordingly.
4179
4180 2011-03-25  Cary Coutant  <ccoutant@google.com>
4181
4182         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4183         * testsuite/Makefile.in: Regenerate.
4184
4185 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4186
4187         * plugin.cc (get_view): New.
4188         (Plugin::load): Pass get_view to the plugin.
4189         (Plugin_manager::get_view): New.
4190
4191 2011-03-21  Ian Lance Taylor  <iant@google.com>
4192
4193         * testsuite/final_layout.sh: Rewrite to not use dc.
4194         * testsuite/relro_test.sh: Fail if dc is not present.
4195
4196 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4197
4198         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4199         Change == to -eq.
4200         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4201         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4202         Change == to -eq.
4203         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4204         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4205
4206 2011-03-14  Ian Lance Taylor  <iant@google.com>
4207
4208         * script-sections.cc (Sort_output_sections::script_compare):
4209         Rename from is_before, change return type.
4210         (Sort_output_sections::operator()): Adjust accordingly.
4211
4212 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4213
4214         PR gold/12572
4215         * testsuite/odr_violation2.cc: Add comment to make all error line
4216         numbers double digits.
4217         * testsuite/debug_msg.sh: Adjust expected errors.
4218
4219 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4220
4221         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4222         but mark earlier ones as non-canonical
4223         (offset_to_iterator): Update search target and example
4224         (do_addr2line): Return extra lines in a vector*
4225         (format_file_lineno): Extract from do_addr2line
4226         (one_addr2line): Add vector* out-param
4227         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4228         when a lineno entry appeared last for its instruction
4229         (Dwarf_line_info): Add vector* out-param
4230         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4231         * symtab.cc (Odr_violation_compare): Include the lineno in the
4232         comparison again.
4233         (linenos_from_loc): New. Combine the canonical line for an
4234         address with its other lines.
4235         (True_if_intersect): New. Helper functor to make
4236         std::set_intersection a query.
4237         (detect_odr_violations): Compare sets of lines instead of just
4238         one line for each function. This became less deterministic, but
4239         has fewer false positives.
4240         * symtab.h: Declarations.
4241         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4242         mix an optimized and non-optimized object in the same binary
4243         (odr_violation2.so): Same.
4244         * testsuite/Makefile.in: Regenerate from Makefile.am.
4245         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4246         * testsuite/debug_msg.sh: Update line numbers and add
4247         assertions.
4248         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4249         non-optimized context.
4250         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4251         isn't inlined, and use OdrDerived in an optimized context.
4252         * testsuite/odr_header1.h: Defines OdrDerived, where
4253         optimization will change the
4254         first-instruction-in-the-destructor's file and line number.
4255         * testsuite/odr_header2.h: Defines OdrBase.
4256
4257 2011-03-09  Ian Lance Taylor  <iant@google.com>
4258
4259         * fileread.cc (File_read::clear_views): Don't delete the whole
4260         file view.
4261
4262 2011-03-08  Ian Lance Taylor  <iant@google.com>
4263
4264         PR gold/12525
4265         * fileread.cc: #include <climits>.
4266         (GOLD_IOV_MAX): Define.
4267         (File_read::read_multiple): Limit number of entries by iov_max.
4268         * fileread.h (class File_read): Always set max_readv_entries to
4269         128.
4270
4271 2011-03-07  Ian Lance Taylor  <iant@google.com>
4272
4273         PR gold/12525
4274         * options.h (class General_options): Add -dy and -dn.
4275
4276 2011-03-02  Cary Coutant  <ccoutant@google.com>
4277
4278         * testsuite/script_test_9.t: Add TLS segment.
4279
4280 2011-03-02  Simon Baldwin  <simonb@google.com>
4281
4282         * configure.ac: Add check for gnu_indirect_function support in
4283         the toolchain building binutils.
4284         * configure: Rebuild.
4285
4286 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4287
4288         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4289         plugin only symbols.
4290         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4291         in plugin files as not needed in the symbol table.
4292
4293 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4294
4295         * output.cc (Output_section::add_input_section): Delay fill
4296         generation for section ordering.
4297
4298 2011-02-09  Ian Lance Taylor  <iant@google.com>
4299
4300         PR gold/12316
4301         * object.h (class Sized_relobj): Remove clear_local_symbols.
4302         * reloc.cc (Sized_relobj::do_relocate): Don't call
4303         clear_local_symbols.
4304
4305 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4306
4307         * plugin.cc (is_visible_from_outside): Return true for symbols
4308         in the -u option.
4309
4310 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4311
4312         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4313         filename.
4314
4315 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4316
4317         * icf.h (is_section_foldable_candidate): Change type of parameter
4318         to std::string.
4319         * icf.cc (Icf::find_identical_sections): Change type of local variable
4320         section_name to be std::string.
4321         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4322
4323 2011-01-25  Ian Lance Taylor  <iant@google.com>
4324
4325         * script.cc (script_add_extern): Rewrite to use
4326         add_symbol_reference.
4327
4328 2011-01-25  Doug Kwan  <dougkwan@google.com>
4329
4330         * icf.cc (get_section_contents): Always lock section's object.
4331
4332 2011-01-24  Ian Lance Taylor  <iant@google.com>
4333
4334         * options.h (class General_options): Accept
4335         --no-detect-odr-violations.
4336
4337 2011-01-24  Ian Lance Taylor  <iant@google.com>
4338
4339         * version.cc (version_string): Bump to 1.11.
4340
4341 2011-01-24  Ian Lance Taylor  <iant@google.com>
4342
4343         * plugin.cc (class Plugin_rescan): Define new class.
4344         (Plugin_manager::claim_file): Set any_claimed_.
4345         (Plugin_manager::save_archive): New function.
4346         (Plugin_manager::save_input_group): New function.
4347         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4348         necessary.
4349         (Plugin_manager::new_undefined_symbol): New function.
4350         (Plugin_manager::rescan): New function.
4351         (Plugin_manager::rescannable_defines): New function.
4352         (Plugin_manager::add_input_file): Set any_added_.
4353         * plugin.h (class Plugin_manager): define new fields rescannable_,
4354         undefined_symbols_, any_claimed_, and any_added_.  Declare
4355         Plugin_rescan as friend.  Declare new functions.
4356         (Plugin_manager::Rescannable): Define type.
4357         (Plugin_manager::Rescannable_list): Define type.
4358         (Plugin_manager::Undefined_symbol_list): Define type.
4359         (Plugin_manager::Plugin_manager): Initialize new fields.
4360         * archive.cc (Archive::defines_symbol): New function.
4361         (Add_archive_symbols::run): Pass archive to plugins if any.
4362         * archive.h (class Archive): Declare defines_symbol.
4363         * readsyms.cc (Input_group::~Input_group): New function.
4364         (Finish_group::run): Pass input_group to plugins if any.
4365         * readsyms.h (class Input_group): Declare destructor.
4366         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4367         any.
4368
4369 2011-01-10  Ian Lance Taylor  <iant@google.com>
4370
4371         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4372         section as relro.
4373         (Layout::set_segment_offsets): Reset increase_relro before calling
4374         set_section_addresses a second time.
4375
4376 2011-01-04  Cary Coutant  <ccoutant@google.com>
4377
4378         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4379         sections before NOBITS sections.
4380
4381 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4382
4383         * version.cc (print_version): Update copyright to 2011.
4384
4385 2010-12-23  Cary Coutant  <ccoutant@google.com>
4386
4387         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4388         of OS to this->add.  Add OD parameter to second form of the function.
4389
4390 2010-12-20  Ian Lance Taylor  <iant@google.com>
4391
4392         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4393         second of two consecutive entries with same offset.
4394
4395 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4396
4397         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4398         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4399         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4400         to avoid unneeded links against $(LDADD).
4401         * testsuite/Makefile.in: Regenerate.
4402
4403 2010-12-15  Ian Lance Taylor  <iant@google.com>
4404
4405         PR gold/12324
4406         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4407         for R_X86_64_32 and R_X86_64_PC32.
4408         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4409         ver_matching_def_pic.o.
4410         (ver_matching_def_pic.o): New target.
4411
4412 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4413
4414         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4415         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4416         Move definition before File_read::View member definitions.
4417         (File_read::View::~View): Initialize and hold lock before
4418         updating current_mapped_bytes.
4419
4420 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4421
4422         * dwarf_reader.cc: Remove outdated comment.
4423         * gold-threads.cc: Fix typo in error message.
4424         * archive.cc: Fix typos in comments.
4425         * archive.h: Likewise.
4426         * arm-reloc-property.cc: Likewise.
4427         * arm-reloc-property.h: Likewise.
4428         * arm-reloc.def: Likewise.
4429         * arm.cc: Likewise.
4430         * attributes.h: Likewise.
4431         * cref.cc: Likewise.
4432         * ehframe.cc: Likewise.
4433         * fileread.h: Likewise.
4434         * gold.h: Likewise.
4435         * i386.cc: Likewise.
4436         * icf.cc: Likewise.
4437         * incremental.h: Likewise.
4438         * int_encoding.cc: Likewise.
4439         * layout.h: Likewise.
4440         * main.cc: Likewise.
4441         * merge.h: Likewise.
4442         * object.cc: Likewise.
4443         * object.h: Likewise.
4444         * options.cc: Likewise.
4445         * readsyms.cc: Likewise.
4446         * reduced_debug_output.cc: Likewise.
4447         * reloc.cc: Likewise.
4448         * script-sections.cc: Likewise.
4449         * sparc.cc: Likewise.
4450         * symtab.h: Likewise.
4451         * target-reloc.h: Likewise.
4452         * target.cc: Likewise.
4453         * target.h: Likewise.
4454         * timer.cc: Likewise.
4455         * timer.h: Likewise.
4456         * x86_64.cc: Likewise.
4457
4458 2010-12-09  Cary Coutant  <ccoutant@google.com>
4459
4460         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4461         stack.
4462         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4463         parameter; change all callers.
4464         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4465         * options.h (warn_execstack): New option.
4466
4467 2010-12-07  Doug Kwan  <dougkwan@google.com>
4468
4469         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4470         like function call relocations.
4471
4472 2010-12-07  Ian Lance Taylor  <iant@google.com>
4473
4474         * archive.cc (Archive::get_elf_object_for_member): Permit
4475         punconfigured to be NULL.
4476         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4477         (Archive::include_member): Pass NULL to get_elf_object_for_member
4478         if we searched for the archive and this is the first included
4479         object.
4480
4481 2010-12-01  Ian Lance Taylor  <iant@google.com>
4482
4483         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4484         track_relocs_type_ field.
4485         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4486         Set track_relocs_type_.
4487         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4488         contents when using RELA relocs.
4489         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4490         reloc_map_.
4491         * reloc.cc (Track_relocs::next_addend): New function.
4492         * reloc.h (class Track_relocs): Declare next_addend.
4493
4494 2010-12-01  Ian Lance Taylor  <iant@google.com>
4495
4496         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4497         virtual destructor.
4498
4499 2010-12-01  Ian Lance Taylor  <iant@google.com>
4500
4501         * README: Update compilers known to work and fail.
4502
4503 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4504
4505         * configure.in: For --enable-gold, handle value `default' instead of
4506         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4507         not the default.
4508         * configure: Regenerate.
4509
4510 2010-11-18  Doug Kwan  <dougkwan@google.com>
4511
4512         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4513         and right_alignment to be zero.  Store result alignment only if it is
4514         greater than existing alignment.
4515
4516 2010-11-16  Cary Coutant  <ccoutant@google.com>
4517
4518         PR gold/12220
4519         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4520         Check for ".zdebug_line".
4521
4522 2010-11-16  Doug Kwan  <dougkwan@google.com>
4523             Cary Coutant  <ccoutant@google.com>
4524
4525         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4526         by reference; adjust all callers.
4527         * output.cc (Output_segment::set_section_addresses): Adjust references
4528         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4529         list is empty.
4530         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4531         end at page boundary.
4532
4533 2010-11-16  Cary Coutant  <ccoutant@google.com>
4534
4535         PR gold/12220
4536         * layout.cc (Layout::choose_output_section): Transform names of
4537         compressed sections even when using a script with a SECTIONS clause.
4538         (Layout::output_section_name): Remove code to transform
4539         compressed debug section names.
4540         * output.cc (Output_section::add_input_section): Use uncompressed
4541         section size when tracking input sections.
4542
4543 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4544
4545         * symtab.h (Symbol::NON_PIC_REF): Remove.
4546         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4547         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4548         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4549         (Symbol::use_plt_offset): Take a flags argument and pass it
4550         directly to needs_dynamic_reloc.  Restrict check for undefined
4551         weak symbols to function calls.
4552         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4553         (Target_arm::Scan::global): Use it.
4554         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4555         (Target_arm::Relocate::relocate): Likewise.
4556         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4557         parameter with an r_type parameter.  Use get_reference_flags
4558         to get the flags.
4559         (Target_arm::Relocate::relocate): Update accordingly.
4560         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4561         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4562         (Target_i386::Scan::global): Likewise.
4563         (Target_i386::Relocate::relocate): Likewise.
4564         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4565         parameter with an r_type parameter.  Use get_reference_flags
4566         to get the flags.
4567         (Target_i386::Relocate::relocate): Update accordingly.
4568         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4569         (Target_powerpc::Scan::global): Use it.
4570         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4571         (Target_powerpc::Relocate::relocate): Likewise.
4572         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4573         (Target_sparc::Scan::global): Use it.
4574         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4575         (Target_sparc::Relocate::relocate): Likewise.
4576         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4577         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4578         (Target_x86_64::Scan::global): Likewise.
4579         (Target_x86_64::Relocate::relocate): Likewise.
4580
4581 2010-11-08  Doug Kwan  <dougkwan@google.com>
4582             Cary Coutant  <ccoutant@google.com>
4583
4584         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4585         (Arm_exidx_merge_section::section_contents_): New data member.
4586         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4587         (Arm_input_section::~Arm_input_section): De-allocate memory.
4588         (Arm_input_section::original_contents_): New data member.
4589         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4590         in parameters instead of calling Object::section_contents without
4591         locking.
4592         (Arm_output_section::group_section): New parameter TASK.  Pass it
4593         to callees that need locking objects.
4594         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4595         to lock EXIDX input sections.  Fix a formatting issue.  Call
4596         Arm_exidx_merged_section::build_contents to create merged section
4597         contents.
4598         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4599         to lock object of stub table owner.
4600         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4601         TEXT_SIZE to initialize data member TEXT_SIZE_.
4602         (Arm_exidx_input_section::addralign): Fix typo in comment.
4603         (Arm_exidx_input_section::text_size): New method.
4604         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4605         that require locking objects.  Lock objects before scanning for stubs
4606         and updating local symbols.
4607         (Arm_input_section<big_endian>::init): Copy contents of original
4608         input section.
4609         (Arm_input_section<big_endian>::do_write): Use saved contents of
4610         original input section instead of calling Object::section_contents
4611         without locking.
4612         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4613         size without calling Object::section_size().
4614         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4615         for size.  Allocate a buffer for merged EXIDX entries.
4616         (Arm_exidx_merged_section::build_contents): New method.
4617         (Arm_exidx_merged_section::do_write): Move merge section contents
4618         building code to Arm_exidx_merged_section::build_contetns.  Write
4619         out contetns in buffer instead of building it on the fly.
4620         (Arm_relobj::make_exidx_input_section): Also pass text section size
4621         to Arm_exidx_input_section constructor.
4622         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4623         (Arm_dynobj::do_read_symbols): Fix memory leak.
4624         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4625         * target.h: (class Task): Add forward declaration.
4626         (Target::relax): Add new parameter TASK and pass it to
4627         Target::do_relax().
4628         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4629
4630 2010-11-05  Cary Coutant  <ccoutant@google.com>
4631
4632         PR gold/10708
4633         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4634         object when reading from the file.
4635         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4636         second layout pass.
4637         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4638         when reading section contents.
4639         (get_section_contents): Likewise.
4640         (icf::find_identical_sections): Likewise.
4641         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4642         object when reading from the file.
4643         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4644         the object when doing deferred section layout.
4645
4646 2010-11-03  Nick Clifton  <nickc@redhat.com>
4647
4648         PR gold/12001
4649         * script.h (class Symbol_assignment: name): New member.  Returns
4650         the name of the symbol.
4651         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4652         Returns true if the given symbol name is on the list of
4653         assignments wating to be processed.
4654         * archive.cc (should_incldue_member): If the symbol is undefined,
4655         check to see if it is on the list of symbols pending assignment.
4656
4657 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4658
4659         * script-sections.cc (Script_sections::find_memory_region): Check
4660         for a NULL output section pointer.
4661
4662 2010-10-29  Doug Kwan  <dougkwan@google.com>
4663
4664         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4665         Output_section::add_relaxed_input_section.
4666         * output.cc (Output_section::add_relaxed_input_section): Add new
4667         arguments LAYOUT and NAME.  Set section order index.
4668         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4669         Copy section order index.
4670         * output.h (Output_section::add_relaxed_input_section): Add new
4671         arguments LAYOUT and NAME.
4672
4673 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4674
4675         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4676         NATIVE_OR_CROSS_LINKER.
4677         * testsuite/Makefile.in: Regenerate.
4678
4679 2010-10-20  Doug Kwan  <dougkwan@google.com>
4680
4681         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4682         without SHF_LINK_ORDER flags.
4683         * layout.cc (Layout::choose_output_section): Do not filter
4684         SHF_LINK_ORDER flag in a relocatable link.
4685
4686 2010-10-17  Cary Coutant  <ccoutant@google.com>
4687
4688         * output.h (Output_segment::set_section_addresses): Change function
4689         signature.  Update all callers.
4690         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4691         sections.
4692         (Output_segment::set_section_addresses): Align after last TLS
4693         section.  Add padding before last relro section instead of after.
4694
4695 2010-10-17  Doug Kwan  <dougkwan@google.com>
4696
4697         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4698         GOT output section to be writable.
4699
4700 2010-10-14  Cary Coutant  <ccoutant@google.com>
4701
4702         * debug.h (DEBUG_INCREMENTAL): New flag.
4703         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4704         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4705         mode.
4706         * incremental.cc (report_command_line): Ignore all forms of
4707         --incremental.
4708         * layout.cc (Layout::Layout): Check parameters for incremental link
4709         mode.
4710         * options.cc (General_options::parse_incremental): New function.
4711         (General_options::parse_no_incremental): New function.
4712         (General_options::parse_incremental_full): New function.
4713         (General_options::parse_incremental_update): New function.
4714         (General_options::incremental_mode_): New data member.
4715         (General_options::finalize): Check incremental_mode_.
4716         * options.h (General_options): Update help text for --incremental.
4717         Add --no-incremental, --incremental-full, --incremental-update.
4718         (General_options::Incremental_mode): New enum type.
4719         (General_options::incremental_mode): New function.
4720         (General_options::incremental_mode_): New data member.
4721         * parameters.cc (Parameters::incremental_mode_): New data member.
4722         (Parameters::set_options): Set incremental_mode_.
4723         (Parameters::set_incremental_full): New function.
4724         (Parameters::incremental): New function.
4725         (Parameters::incremental_update): New function.
4726         (set_parameters_incremental_full): New function.
4727         * parameters.h (Parameters::set_incremental_full): New function.
4728         (Parameters::incremental): New function.
4729         (Parameters::incremental_update): New function.
4730         (Parameters::incremental_mode_): New data member.
4731         (set_parameters_incremental_full): New function.
4732         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4733         incremental link mode.
4734         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4735         (Sized_relobj::do_relocate_sections): Likewise.
4736         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4737         option.
4738         * testsuite/Makefile.in: Regenerate.
4739         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4740
4741 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4742
4743         * script-sections.h (class Script_sections): Make
4744         Sections_elements typedef public.
4745         * script-sections.cc (class Sort_output_sections): Add elements_
4746         field.  Add constructor which sets it; change all callers.
4747         (Sort_output_sections::is_before): New function.
4748         (Sort_output_sections::operator()): Call is_before.
4749         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4750         conditional.
4751         * testsuite/script_test_10.sh: New test. Test script section
4752         order.
4753         * testsuite/script_test_10.t: Likewise.
4754         * testsuite/script_test_10.s: Likewise.
4755         * testsuite/Makefile.am: Wrap the cross linker tests and the
4756         common tests into NATIVE_OR_CROSS_LINKER.
4757         (check_SCRIPTS): Add script_test_10.sh.
4758         (check_DATA): Add script_test_10.stdout.
4759         (script_test_10.o, script_test_10): New targets.
4760         (script_test_10.stdout): New target.
4761         * configure, testsuite/Makefile.in: Regenerate.
4762
4763 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4764
4765         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4766         error for the deprecated relocations.
4767         (Target_arm::Scan::global): Likewise.
4768         (Target_arm::Relocate::relocate): Likewise.
4769
4770 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4771
4772         * fileread.cc (Input_file::find_file): Initialize *found_name
4773         and *namep when using the fallback search for case 4.
4774
4775 2010-10-11  Cary Coutant  <ccoutant@google.com>
4776
4777         * options.h (class General_options): Redefine -z lazy as an alias for
4778         the negation of -z now.
4779
4780 2010-10-11  Ian Lance Taylor  <iant@google.com>
4781
4782         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4783         binding.
4784
4785 2010-10-06  Nick Clifton  <nickc@redhat.com>
4786
4787         * script-sections.cc(class Memory_region): Remove
4788         current_lma_offset_ field.  Rename current_vma_offset_ to
4789         current_offset_.  Add last_section_ field.
4790         (Memory_region::get_current_vma_address): Rename to
4791         get_current_address.
4792         (Memory_region::get_current_lma_address): Delete.
4793         (Memory_region::increment_vma_offset): Rename to
4794         increment_offset.
4795         (Memory_region::increment_lma_offset): Delete.
4796         (Memory_region::attributes_compatible): New method.  Returns
4797         true if the provided section is compatible with the region.
4798         (Memory_region::get_last_section): New method.  Returns the last
4799         section to use the region.
4800         (Memory_region::set_last_section): New method.  Stores the last
4801         section to use the region.
4802         (Script_sections::block_in_region): New method.  Returns true if
4803         a block of memory is contained within a region.
4804         (Script_sections::find_memory_region): New method.  Locates a
4805         memory region to be used to set a VMA or LMA address.
4806         (Output_section_definition::set_section_addresses): Add code to
4807         check for addresses set by memory regions.
4808         (Output_segment::set_section_addresses): Remove memory region
4809         walking code.
4810         (Script_sections::create_segment): Add a warning if a header
4811         segment is created outside of any region.
4812         * script-sections.h (class Script_sections): Add prototypes for
4813         find_memory_region and block_in_region methods.
4814         * testsuite/memory_test.s: Use .long instead of .word.
4815         * testsuite/memory_test.t: Add some more output sections.
4816         * testsuite/memory_test.sh: Update expected output.
4817
4818 2010-10-02  Doug Kwan  <dougkwan@google.com>
4819
4820         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4821         defintion to symtab.h
4822         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4823         declaration to defintion.
4824
4825 2010-10-01  Nick Clifton  <nickc@redhat.com>
4826
4827         * expression.cc (eval): Replace dummy argument with NULL.
4828         (eval_maybe_dot): Check for a NULL result section pointer.
4829         (Symbol_expression::value): Likewise.
4830         (Dot_expression::value): Likewise.
4831         (BINARY_EXPRESSION): Likewise.
4832         (Max_expression::value): Likewise.
4833         (Min_expression::value): Likewise.
4834         (Absolute_expression::value): Likewise.
4835         (Addr_expression::value_from_output_section): Likewise.
4836         (Loaddddr_expression::value_from_output_section): Likewise.
4837         (Segment_start_expression::value): Likewise.
4838         * script-sections.cc
4839         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4840         argument with NULL.
4841         (Sections_elememt_dot_assignment::set_section_addresses):
4842         Likewise.
4843         (Output_data_expression::do_write_to_buffer): Likewise.
4844         (Output_section_definition::finalize_symbols): Likewise.
4845         (Output_section_definition::set_section_addresses): Likewise.
4846
4847 2010-09-30  Doug Kwan  <dougkwan@google.com>
4848
4849         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4850
4851 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4852
4853         * target.h (Target::can_icf_inline_merge_sections): New virtual
4854         function.
4855         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4856         virtual function.
4857         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4858         virtual function.
4859         * icf.cc (get_section_contents): Inline merge sections only when
4860         target allows it.
4861
4862 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4863
4864         * configure: Regenerate.
4865
4866 2010-09-17  Ian Lance Taylor  <iant@google.com>
4867
4868         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4869         * testsuite/Makefile.am (memory_test.o): New target.
4870         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4871         memory_test.t.
4872         * testsuite/Makefile.in: Rebuild.
4873
4874 2010-09-17  Doug Kwan  <dougkwan@google.com>
4875
4876         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4877         defintion if relocation uses GOT entries of the symbol.
4878         * testsuite/icf_safe_test.sh: Fix test.
4879         * testsuite/icf_safe_so_test.sh: Fix test.
4880
4881 2010-09-16  Cary Coutant  <ccoutant@google.com>
4882
4883         * script_sections.cc (class Memory_region): Remove "NULL" from
4884         vector initializations.
4885
4886 2010-09-15  Cary Coutant  <ccoutant@google.com>
4887
4888         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4889         Resolve forwarding symbols.
4890
4891 2010-09-15  Doug Kwan  <dougkwan@google.com>
4892
4893         * gold/testsuite/script_test_3.t: Add ARM special sections.
4894         * gold/testsuite/script_test_4.t: Same.
4895         * gold/testsuite/script_test_5.t: Same.
4896         * gold/testsuite/script_test_6.t: Same.
4897         * gold/testsuite/script_test_7.t: Same.
4898         * gold/testsuite/script_test_7.t: Same.
4899         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4900
4901 2010-09-14  Cary Coutant  <ccoutant@google.com>
4902
4903         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4904         (Target_x86_64::Relocate::relocate_tls): Replace check for
4905         saw_tls_block_reloc_ with test for executable section.
4906
4907 2010-09-12  Cary Coutant  <ccoutant@google.com>
4908
4909         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4910         position-independent executables to shared libraries need dynamic
4911         relocations.
4912         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4913         position-independent executables.
4914         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4915         * testsuite/Makefile.in: Regenerate.
4916
4917 2010-09-10  Nick Clifton  <nickc@redhat.com>
4918
4919         PR gold/11997
4920         * testsuite/memory_test.t: Discard any sections that are not
4921         needed.
4922
4923 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4924
4925         PR gold/11996
4926         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4927         "This::" to work around a bug in gcc 4.2.
4928
4929         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4930
4931 2010-09-09  Rafael Espindola  <espindola@google.com>
4932
4933         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4934         sections with different PF_X flags in the same segment.
4935         (Layout::find_first_load_seg): Search all segments to find the first
4936         one.
4937         * options.h (rosegment): New.
4938
4939 2010-09-08  Rafael Espindola  <espindola@google.com>
4940
4941         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4942
4943 2010-09-08  Doug Kwan  <dougkwan@google.com>
4944
4945         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4946         (Arm_relobj::do_relocate_sections): Add new parameter for output
4947         file to match the parent.
4948         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4949         of local symbols instead of input values.  Update code to track
4950         changes in gold::relocate_section.
4951         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4952         (Sized_relobj::compute_final_local_value_internal): New methods.
4953         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4954         body into private version of Sized_relobj::compute_final_local_value.
4955         Call the inline method.
4956         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4957         merged symbol value if there is one.
4958         (Symbol_value::has_output_value): New method defintiion.
4959         (Sized_relobj::Compute_final_local_value_status): New enum type.
4960         (Sized_relobj::compute_final_local_value): New methods.
4961         (Sized_relobj::compute_final_local_value_internal): New methods.
4962         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4963         and arm_cortex_a8.sh.
4964         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4965         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4966         New tests.
4967         * Makefile.in: Regenerate.
4968         * testsuite/arm_bl_out_of_range.s: Update test.
4969         * testsuite/thumb_bl_out_of_range.s: Ditto.
4970         * testsuite/thumb_blx_out_of_range.s: Ditto.
4971         * testsuite/arm_branch_out_of_range.sh: New file.
4972         * testsuite/arm_cortex_a8.sh: Ditto.
4973         * testsuite/arm_cortex_a8_b.s: Ditto.
4974         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4975         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4976         * testsuite/arm_cortex_a8_bl.s: Ditto.
4977         * testsuite/arm_cortex_a8_blx.s: Ditto.
4978         * testsuite/arm_cortex_a8_local.s: Ditto.
4979         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4980         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4981
4982 2010-09-08  Rafael Espindola  <espindola@google.com>
4983
4984         * Makefile.am (memory_test.stdout): Run readelf with -W.
4985         * Makefile.in: Regenerate.
4986         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4987         64 bit output.
4988
4989 2010-09-08  Rafael Espindola  <espindola@google.com>
4990
4991         * script-sections.cc (Script_sections::add_memory_region): Convert
4992         field precision to int.
4993         * script.cc (script_set_section_region, script_set_section_region):
4994         Convert field precision to int.
4995
4996 2010-09-08  Rafael Espindola  <espindola@google.com>
4997
4998         * arm.cc (do_finalize_sections): Create the __exidx_start and
4999         __exdix_end symbols even when the section is missing.
5000
5001 2010-09-08  Nick Clifton  <nickc@redhat.com>
5002
5003         * README: Remove claim that MEMORY is not supported.
5004         * expression.cc (script_exp_function_origin)
5005         (script_exp_function_length): Move from here to ...
5006         * script.cc: ... here.
5007         (script_set_section_region, script_add_memory)
5008         (script_parse_memory_attr, script_include_directive): New
5009         functions.
5010         * script-sections.cc
5011         (class Memory_region): New class.
5012         (class Output_section_definition): Add set_memory_region,
5013         set_section_vma, set_section_lma and get_section_name methods.
5014         (class Script_Sections): Add add_memory_region,
5015         find_memory_region, find_memory_region_origin,
5016         find_memory_region_length and set_memory_region methods.
5017         Have set_section_addresses method walk the list of set memory
5018         regions.
5019         Extend the print methos to display memory regions.
5020         * script-sections.h: Add prototypes for new methods.
5021         Add enum for MEMORY region attributes.
5022         * yyscript.y: Add support for parsing MEMORY regions.
5023         * script-c.h: Add prototypes for new functions.
5024         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5025         * testsuite/Makefile.in: Regenerate.
5026         * testsuite/memory_test.sh: New script.
5027         * testsuite/memory_test.s: New assembler source file.
5028         * testsuite/memory_test.t: New linker script.
5029
5030 2010-08-27  Doug Kwan  <dougkwan@google.com>
5031
5032         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5033         reference override an existing dynamic weak reference.
5034         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5035         * testsuite/Makefile.in: Regenerate.
5036         * testsuite/dyn_weak_ref.sh: New file.
5037         * testsuite/dyn_weak_ref_1.c: Ditto.
5038         * testsuite/dyn_weak_ref_2.c: Ditto.
5039
5040 2010-08-27  Ian Lance Taylor  <iant@google.com>
5041
5042         * incremental.h (class Incremental_input_entry): Add virtual
5043         destructor.
5044
5045 2010-08-27  Ian Lance Taylor  <iant@google.com>
5046
5047         * testsuite/start_lib_test_3.c: Mark t3 as used.
5048
5049 2010-08-27  Nick Clifton  <nickc@redhat.com>
5050
5051         * options.cc (version_script): Fix small typo in previous
5052         whitespace tidyup.
5053
5054 2010-08-25  Nick Clifton  <nickc@redhat.com>
5055
5056         * archive.cc: Formatting fixes: Remove whitespace between
5057         typename and following asterisk.  Remove whitespace between
5058         function name and opening parenthesis.
5059         * archive.h: Likewise.
5060         * arm.cc: Likewise.
5061         * attributes.cc: Likewise.
5062         * attributes.h: Likewise.
5063         * common.cc: Likewise.
5064         * copy-relocs.cc: Likewise.
5065         * dirsearch.h: Likewise.
5066         * dynobj.cc: Likewise.
5067         * ehframe.cc: Likewise.
5068         * ehframe.h: Likewise.
5069         * expression.cc: Likewise.
5070         * fileread.cc: Likewise.
5071         * fileread.h: Likewise.
5072         * gc.h: Likewise.
5073         * gold-threads.cc: Likewise.
5074         * gold.cc: Likewise.
5075         * i386.cc: Likewise.
5076         * icf.h: Likewise.
5077         * incremental-dump.cc: Likewise.
5078         * incremental.cc: Likewise.
5079         * layout.cc: Likewise.
5080         * layout.h: Likewise.
5081         * main.cc: Likewise.
5082         * merge.cc: Likewise.
5083         * merge.h: Likewise.
5084         * object.cc: Likewise.
5085         * object.h: Likewise.
5086         * options.cc: Likewise.
5087         * options.h: Likewise.
5088         * output.cc: Likewise.
5089         * output.h: Likewise.
5090         * plugin.cc: Likewise.
5091         * plugin.h: Likewise.
5092         * powerpc.cc: Likewise.
5093         * reloc.cc: Likewise.
5094         * script-c.h: Likewise.
5095         * script-sections.cc: Likewise.
5096         * script.cc: Likewise.
5097         * stringpool.cc: Likewise.
5098         * symtab.cc: Likewise.
5099         * symtab.h: Likewise.
5100         * target.cc: Likewise.
5101         * timer.cc: Likewise.
5102         * timer.h: Likewise.
5103         * version.cc: Likewise.
5104         * x86_64.cc: Likewise.
5105
5106 2010-08-24  Nick Clifton  <nickc@redhat.com>
5107
5108         PR 11899
5109         * layout.cc (segment_precedes): Sort segments by their physical
5110         addresses, if they have been set.
5111
5112 2010-08-23  Cary Coutant  <ccoutant@google.com>
5113
5114         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5115         symbols data.
5116         (Lib_group::include_member): Unlock object after deleting its
5117         symbols data.
5118         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5119         the bug fixed here.
5120
5121 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5122             Cary Coutant  <ccoutant@google.com>
5123
5124         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5125         constructor, and set_blocker.
5126         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5127         readsyms_blocker_.
5128         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5129         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5130         * testsuite/Makefile.am (start_lib_test): New test case.
5131         * testsuite/Makefile.in: Regenerate.
5132         * testsuite/start_lib_test_main.c: New file.
5133         * testsuite/start_lib_test_1.c: New file.
5134         * testsuite/start_lib_test_2.c: New file.
5135         * testsuite/start_lib_test_3.c: New file.
5136
5137 2010-08-19  Ian Lance Taylor  <iant@google.com>
5138
5139         * Makefile.in: Rebuild with automake 1.11.1.
5140         * aclocal.m4: Likewise.
5141         * testsuite/Makefile.in: Likewise.
5142
5143 2010-08-19  Ian Lance Taylor  <iant@google.com>
5144
5145         PR 10893
5146         * i386.cc (class Output_data_plt_i386): Update declarations.
5147         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5148         local_ifuncs_ fields.
5149         (Target_i386::do_plt_section_for_global): New function.
5150         (Target_i386::do_plt_section_for_local): New function.
5151         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5152         parameter; change all callers.  Initialize global_ifuncs_ and
5153         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5154         __rel_iplt_end.
5155         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5156         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5157         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5158         symbols.
5159         (Target_i386::make_plt_section): New function, broken out of
5160         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5161         (Target_i386::make_plt_entry): Call make_plt_section.
5162         (Target_i386::make_local_ifunc_plt_entry): New function.
5163         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5164         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5165         R_386_IRELATIVE to switch.
5166         (Target_i386::Scan::global): Likewise.
5167         (Target_i386::Relocate::relocate): Likewise.
5168         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5169         switch.
5170         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5171         (Target_x86_64::do_plt_section_for_global): New function.
5172         (Target_x86_64::do_plt_section_for_local): New function.
5173         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5174         parameter; change all callers.  If doing a static link define
5175         __rela_iplt_start and __rela_iplt_end.
5176         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5177         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5178         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5179         to point to .plt.
5180         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5181         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5182         switch.
5183         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5184         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5185         R_X86_64_IRELATIVE to switch.
5186         (Target_x86_64::Scan::global): Likewise.
5187         (Target_x86_64::Relocate::relocate): Likewise.
5188         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5189         switch.
5190         * target.h (class Target): Add plt_section_for_global and
5191         plt_section_for_local functions.  Add do_plt_section_for_global
5192         and do_plt_section_for_local virtual functions.
5193         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5194         clarifying comments.
5195         (Symbol::use_plt_offset): Handle IFUNC symbol.
5196         * object.cc (Sized_relobj::Sized_relobj): Initialize
5197         local_plt_offsets_.
5198         (Sized_relobj::local_has_plt_offset): New function.
5199         (Sized_relobj::local_plt_offset): New function.
5200         (Sized_relobj::set_local_plt_offset): New function.
5201         (Sized_relobj::do_count): Handle IFUNC symbol.
5202         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5203         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5204         is_ifunc_symbol functions.
5205         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5206         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5207         local_plt_offsets_ field.
5208         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5209         * output.h (class Output_section_data): Add non-const
5210         output_section function.
5211         (class Output_data_got): Update declarations.
5212         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5213         Add use_plt_offset parameter to global and local constructors.
5214         Change all callers.  Change local_sym_index_ field to 31 bits.
5215         Change GSYM_CODE and CONSTANT_CODE accordingly.
5216         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5217         doing a static link don't set sh_link field.
5218         (Output_data_got::Got_entry::write): Use PLT offset if
5219         appropriate.
5220         (Output_data_got::add_global_plt): New function.
5221         (Output_data_got::add_local_plt): New function.
5222         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5223         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5224         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5225         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5226         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5227         IFUNC conditional.
5228         * testsuite/ifunc-sel.h: New file.
5229         * testsuite/ifuncmain1.c: New file.
5230         * testsuite/ifuncmain1vis.c: New file.
5231         * testsuite/ifuncmod1.c: New file.
5232         * testsuite/ifuncdep2.c: New file.
5233         * testsuite/ifuncmain2.c: New file.
5234         * testsuite/ifuncmain3.c: New file.
5235         * testsuite/ifuncmod3.c: New file.
5236         * testsuite/ifuncmain4.c: New file.
5237         * testsuite/ifuncmain5.c: New file.
5238         * testsuite/ifuncmod5.c: New file.
5239         * testsuite/ifuncmain6pie.c: New file.
5240         * testsuite/ifuncmod6.c: New file.
5241         * testsuite/ifuncmain7.c: New file.
5242         * configure, testsuite/Makefile.in: Rebuild.
5243
5244 2010-08-18  Ian Lance Taylor  <iant@google.com>
5245
5246         * incremental.cc
5247         (Output_section_incremental_inputs::write_input_files): Add cast
5248         to avoid signed/unsigned comparison warning.
5249         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5250
5251 2010-08-12  Cary Coutant  <ccoutant@google.com>
5252
5253         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5254
5255 2010-08-13  Ian Lance Taylor  <iant@google.com>
5256
5257         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5258
5259 2010-08-12  Cary Coutant  <ccoutant@google.com>
5260             Doug Kwan  <dougkwan@google.com>
5261
5262         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5263         defintion overrides non-weak undef, remember that the original undef
5264         is not weak.
5265         * symtab.cc (Symbol_table::sized_write_global): For undef without
5266         an original weak binding, set binding to global in output.
5267         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5268         * testsuite/Makefile.in: Regenerate.
5269         * testsuite/strong_ref_weak_def.sh: New file.
5270         * testsuite/strong_ref_weak_def_1.c: Ditto.
5271         * testsuite/strong_ref_weak_def_2.c: Ditto.
5272
5273 2010-08-12  Cary Coutant  <ccoutant@google.com>
5274
5275         * testsuite/incremental_test.sh: Rewrite.
5276         * testsuite/incremental_test_1.c: Rewrite.
5277         * testsuite/incremental_test_2.c: Rewrite.
5278
5279 2010-08-12  Cary Coutant  <ccoutant@google.com>
5280
5281         * arm.cc (Target_arm::got_size): Add const.
5282         (Target_arm::got_entry_count): New function.
5283         (Target_arm::plt_entry_count): New function.
5284         (Target_arm::first_plt_entry_offset): New function.
5285         (Target_arm::plt_entry_size): New function.
5286         (Output_data_plt_arm::entry_count): New function.
5287         (Output_data_plt_arm::first_plt_entry_offset): New function.
5288         (Output_data_plt_arm::get_plt_entry_size): New function.
5289         * i386.cc (Target_i386::got_size): Add const.
5290         (Target_i386::got_entry_count): New function.
5291         (Target_i386::plt_entry_count): New function.
5292         (Target_i386::first_plt_entry_offset): New function.
5293         (Target_i386::plt_entry_size): New function.
5294         (Output_data_plt_i386::entry_count): New function.
5295         (Output_data_plt_i386::first_plt_entry_offset): New function.
5296         (Output_data_plt_i386::get_plt_entry_size): New function.
5297         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5298         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5299         * incremental.cc: Include target.h.
5300         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5301         parameter.  Adjust all callers.  Find incremental_got_plt section.
5302         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5303         section.
5304         (Output_section_incremental_inputs::set_final_data_size): Calculate
5305         size of incremental_got_plt section.
5306         (Output_section_incremental_inputs::do_write): Write the
5307         incremental_got_plt section.
5308         (Got_plt_view_info): New struct.
5309         (Local_got_offset_visitor): New class.
5310         (Global_got_offset_visitor): New class.
5311         (Global_symbol_visitor_got_plt): New class.
5312         (Output_section_incremental_inputs::write_got_plt): New function.
5313         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5314         Add parameter.  Adjust all callers.
5315         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5316         (Incremental_inputs::got_plt_section): New function.
5317         (Incremental_inputs::got_plt_section_): New data member.
5318         (Incremental_got_plt_reader): New class.
5319         * layout.cc (Layout::create_incremental_info_sections): Add the
5320         incremental_got_plt section.
5321         * object.h (Got_offset_list::get_list): New function.
5322         (Got offset_list::for_all_got_offsets): New function.
5323         (Sized_relobj::local_got_offset_list): New function.
5324         * powerpc.cc (Target_powerpc::got_size): Add const.
5325         (Target_powerpc::got_entry_count): New function.
5326         (Target_powerpc::plt_entry_count): New function.
5327         (Target_powerpc::first_plt_entry_offset): New function.
5328         (Target_powerpc::plt_entry_size): New function.
5329         (Output_data_plt_powerpc::entry_count): New function.
5330         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5331         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5332         * sparc.cc (Target_sparc::got_size): Add const.
5333         (Target_sparc::got_entry_count): New function.
5334         (Target_sparc::plt_entry_count): New function.
5335         (Target_sparc::first_plt_entry_offset): New function.
5336         (Target_sparc::plt_entry_size): New function.
5337         (Output_data_plt_sparc::entry_count): New function.
5338         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5339         (Output_data_plt_sparc::get_plt_entry_size): New function.
5340         * symtab.h (Symbol::got_offset_list): New function.
5341         (Symbol_table::for_all_symbols): New function.
5342         * target.h (Sized_target::got_entry_count): New function.
5343         (Sized_target::plt_entry_count): New function.
5344         (Sized_target::plt_entry_size): New function.
5345         * x86_64.cc (Target_x86_64::got_size): Add const.
5346         (Target_x86_64::got_entry_count): New function.
5347         (Target_x86_64::plt_entry_count): New function.
5348         (Target_x86_64::first_plt_entry_offset): New function.
5349         (Target_x86_64::plt_entry_size): New function.
5350         (Output_data_plt_x86_64::entry_count): New function.
5351         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5352         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5353
5354 2010-08-12  Cary Coutant  <ccoutant@google.com>
5355
5356         * archive.cc: Include incremental.h.
5357         (Archive::Archive): Initialize incremental_info_.
5358         (Archive::include_member): Record archive members in incremental info.
5359         (Add_archive_symbols::run): Record begin and end of an archive in
5360         incremental info.
5361         (Lib_group::include_member): Record objects in incremental info.
5362         * archive.h (Incremental_archive_entry): Forward declaration.
5363         (Archive::set_incremental_info): New member function.
5364         (Archive::incremental_info): New member function.
5365         (Archive::Unused_symbol_iterator): New class.
5366         (Archive::unused_symbols_begin): New member function.
5367         (Archive::unused_symbols_end): New member function.
5368         (Archive::incremental_info_): New data member.
5369         * incremental-dump.cc (find_input_containing_global): New function.
5370         (dump_incremental_inputs): Dump new incremental info sections.
5371         * incremental.cc: Include symtab.h.
5372         (Output_section_incremental_inputs): New class.
5373         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5374         new incremental info sections.
5375         (Sized_incremental_binary::do_check_inputs): Likewise.
5376         (Incremental_inputs::report_archive): Remove.
5377         (Incremental_inputs::report_archive_begin): New function.
5378         (Incremental_inputs::report_archive_end): New function.
5379         (Incremental_inputs::report_object): New function.
5380         (Incremental_inputs::finalize_inputs): Remove.
5381         (Incremental_inputs::report_input_section): New function.
5382         (Incremental_inputs::report_script): Rewrite.
5383         (Incremental_inputs::finalize): Do nothing but finalize string table.
5384         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5385         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5386         (Incremental_inputs::create_data_sections): New function.
5387         (Incremental_inputs::relocs_entsize): New function.
5388         (Output_section_incremental_inputs::set_final_data_size): New function.
5389         (Output_section_incremental_inputs::do_write): New function.
5390         (Output_section_incremental_inputs::write_header): New function.
5391         (Output_section_incremental_inputs::write_input_files): New function.
5392         (Output_section_incremental_inputs::write_info_blocks): New function.
5393         (Output_section_incremental_inputs::write_symtab): New function.
5394         * incremental.h (Incremental_script_entry): Forward declaration.
5395         (Incremental_object_entry): Forward declaration.
5396         (Incremental_archive_entry): Forward declaration.
5397         (Incremental_inputs): Forward declaration.
5398         (Incremental_inputs_header_data): Remove.
5399         (Incremental_inputs_header): Remove.
5400         (Incremental_inputs_header_write): Remove.
5401         (Incremental_inputs_entry_data): Remove.
5402         (Incremental_inputs_entry): Remove.
5403         (Incremental_inputs_entry_write): Remove.
5404         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5405         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5406         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5407         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5408         Likewise.
5409         (Incremental_input_entry): New class.
5410         (Incremental_script_entry): New class.
5411         (Incremental_object_entry): New class.
5412         (Incremental_archive_entry): New class.
5413         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5414         (Incremental_inputs::report_inputs): Remove.
5415         (Incremental_inputs::report_archive): Remove.
5416         (Incremental_inputs::report_archive_begin): New function.
5417         (Incremental_inputs::report_archive_end): New function.
5418         (Incremental_inputs::report_object): Change prototype.
5419         (Incremental_inputs::report_input_section): New function.
5420         (Incremental_inputs::report_script): Change prototype.
5421         (Incremental_inputs::get_reloc_count): New function.
5422         (Incremental_inputs::set_reloc_count): New function.
5423         (Incremental_inputs::create_data_sections): New function.
5424         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5425         (Incremental_inputs::inputs_section): New function.
5426         (Incremental_inputs::symtab_section): New function.
5427         (Incremental_inputs::relocs_section): New function.
5428         (Incremental_inputs::get_stringpool): Add const.
5429         (Incremental_inputs::command_line): Add const.
5430         (Incremental_inputs::inputs): Remove.
5431         (Incremental_inputs::command_line_key): New function.
5432         (Incremental_inputs::input_file_count): New function.
5433         (Incremental_inputs::input_files): New function.
5434         (Incremental_inputs::relocs_entsize): New function.
5435         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5436         (Incremental_inputs::finalize_inputs): Remove.
5437         (Incremental_inputs::Input_info): Remove.
5438         (Incremental_inputs::lock_): Remove.
5439         (Incremental_inputs::inputs_): Change type.
5440         (Incremental_inputs::inputs_map_): Remove.
5441         (Incremental_inputs::current_object_entry_): New data member.
5442         (Incremental_inputs::inputs_section_): New data member.
5443         (Incremental_inputs::symtab_section_): New data member.
5444         (Incremental_inputs::relocs_section_): New data member.
5445         (Incremental_inputs::reloc_count_): New data member.
5446         (Incremental_inputs_reader): New class.
5447         (Incremental_symtab_reader): New class.
5448         (Incremental_relocs_reader): New class.
5449         * layout.cc (Layout::finalize): Move finalization of incremental info
5450         and creation of incremental info sections to follow finalization of
5451         symbol table.  Set offsets for postprocessing sections.
5452         (Layout::create_incremental_info_sections): Call
5453         Incremental_inputs::create_data_sections.  Add incremental symtab
5454         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5455         sections to layout after input sections.
5456         * layout.h (struct Timespec): Forward declaration.
5457         (Layout::incremental_inputs): Add const.
5458         (Layout::create_incremental_info_sections): Add parameter.
5459         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5460         * object.cc: Include incremental.h.
5461         (Relobj::finalize_incremental_relocs): New function.
5462         (Sized_relobj::do_layout): Record input sections in incremental info.
5463         * object.h (Object::output_section): New function.
5464         (Object::output_section_offset): Moved from Relobj.
5465         (Object::get_incremental_reloc_base): New function.
5466         (Object::get_incremental_reloc_count): New function.
5467         (Object::do_output_section): New function.
5468         (Object::do_output_section_offset): Moved from Relobj.
5469         (Object::do_get_incremental_reloc_base): New function.
5470         (Object::do_get_incremental_reloc_count): New function.
5471         (Object::Object): Initialize new data members.
5472         (Relobj::output_section): Renamed do_output_section and moved to
5473         protected.
5474         (Relobj::output_section_offset): Moved to Object.
5475         (Relobj::do_get_incremental_reloc_base): New function.
5476         (Relobj::do_get_incremental_reloc_count): New function.
5477         (Relobj::allocate_incremental_reloc_counts): New function.
5478         (Relobj::count_incremental_reloc): New function.
5479         (Relobj::finalize_incremental_relocs): New function.
5480         (Relobj::next_incremental_reloc_index): New function.
5481         (Relobj::reloc_counts_): New data member.
5482         (Relobj::reloc_bases_): New data member.
5483         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5484         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5485         (Sized_relobj::incremental_relocs_scan): New function.
5486         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5487         (Sized_relobj::incremental_relocs_write): New function.
5488         (Sized_relobj::incremental_relocs_write_reltype): New function.
5489         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5490         incremental link.
5491         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5492         archives and object files elsewhere.
5493         (Add_symbols::run): Report object files here.
5494         (Finish_group::run): Report end of archive at end of group.
5495         * reloc.cc: Include layout.h, incremental.h.
5496         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5497         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5498         (Sized_relobj::incremental_relocs_scan): New function.
5499         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5500         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5501         (Sized_relobj::incremental_relocs_write): New function.
5502         (Sized_relobj::incremental_relocs_write_reltype): New function.
5503         * script.cc (read_input_script): Rewrite test for incremental link.
5504         Change call to Incremental_inputs::report_script.
5505         * symtab.h (Symbol_table::first_global_index): New function.
5506         (Symbol_table::output_count): New function.
5507
5508 2010-08-12  Doug Kwan  <dougkwan@google.com>
5509
5510         * arm.cc (Target_arm::merge_object_attributes): Check command line
5511         options --no-wchar-size-warning and --no-enum-size-warning.
5512         * options.h (General_options): Add ld-compatible options
5513         --no-enum-size-warning and --no-wchar-size-warning.
5514
5515 2010-08-04  Ian Lance Taylor  <iant@google.com>
5516
5517         * x86_64.cc (Target_x86_64::Scan::local): Use
5518         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5519         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5520         (Target_x86_64::Scan::global): Likewise.
5521         (Target_x86_64::Relocate::relocate): Likewise.
5522         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5523         Likewise.
5524
5525 2010-08-03  Cary Coutant  <ccoutant@google.com>
5526
5527         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5528         to reserve space in merged_strings vector. Keep total input size
5529         for stats.
5530         (Output_merge_string::do_print_merge_stats): Print total input size.
5531         * merge.h (Output_merge_string): Add input_size_ field.
5532         * stringpool.cc (Stringpool_template::string_length): Move
5533         implementations out of Stringpool_template class and place in
5534         stringpool.h.
5535         * stringpool.h (string_length): Move out of Stringpool_template.
5536
5537 2010-08-03  Ian Lance Taylor  <iant@google.com>
5538
5539         PR 11712
5540         * layout.cc (relaxation_loop_body): If address of load segment is
5541         set, adjust address to include headers if possible.
5542
5543 2010-08-03  Ian Lance Taylor  <iant@google.com>
5544
5545         * version.cc (version_string): Bump to 1.10.
5546
5547 2010-08-03  Ian Lance Taylor  <iant@google.com>
5548
5549         PR 11805
5550         * layout.h (enum Output_section_order): Define.
5551         (class Layout): Update declarations.
5552         * layout.cc (Layout::get_output_section): Add order parameter.
5553         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5554         is_first_non_relro parameters.  Change all callers.
5555         (Layout::choose_output_section): Likewise.
5556         (Layout::add_output_section_data): Likewise.
5557         (Layout::make_output_section): Likewise.  Set order.
5558         (Layout::default_section_order): New function.
5559         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5560         * output.cc (Output_section::Output_section): Initialize order_.
5561         Don't initialize deleted fields.
5562         (Output_segment::Output_segment): Don't initialize deleted
5563         fields.
5564         (Output_segment::add_output_section_to_load): New function
5565         replacing add_output_section.  Change all callers to call this or
5566         add_output_section_to_nonload.
5567         (Output_segment::add_output_section_to_nonload): New function.
5568         (Output_segment::remove_output_section): Rewrite.
5569         (Output_segment::add_initial_output_data): Likewise.
5570         (Output_segment::has_any_data_sections): Likewise.
5571         (Output_segment::is_first_section_relro): Likewise.
5572         (Output_segment::maximum_alignment): Likewise.
5573         (Output_segment::has_dynamic_reloc): New function replacing
5574         dynamic_reloc_count.  Change all callers.
5575         (Output_segment::has_dynamic_reloc_list): New function replacing
5576         dynamic_reloc_count_list.  Change all callers.
5577         (Output_segment::set_section_addresses): Rewrite.
5578         (Output_segment::set_offset): Rewrite.
5579         (Output_segment::find_first_and_last_list): Remove.
5580         (Output_segment::set_tls_offsets): Rewrite.
5581         (Output_segment::first_section_load_address): Likewise.
5582         (Output_segment::output_section_count): Likewise.
5583         (Output_segment::section_with_lowest_load_address): Likewise.
5584         (Output_segment::write_section_headers): Likewise.
5585         (Output_segment::print_sections_to_map): Likewise.
5586         * output.h (class Output_data): Remove dynamic_reloc_count_
5587         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5588         (Output_data::add_dynamic_reloc): Rewrite.
5589         (Output_data::has_dynamic_reloc): New function.
5590         (Output_data::dynamic_reloc_count): Remove.
5591         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5592         is_last_relro_, is_first_non_relro_, is_interp_,
5593         is_dynamic_linker_section_ fields.  Add order and set_order
5594         functions.  Remove is_relro_local, set_is_relro_local,
5595         is_last_relro, set_is_last_relro, is_first_non_relro,
5596         set_is_first_non_relro functions, is_interp, set_is_interp,
5597         is_dynamic_linker_section, and set_is_dynamic_linker_section
5598         functions.
5599         (class Output_segment): Change Output_data_list from std::list to
5600         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5601         output_bss_ fields.  Update declarations.
5602
5603 2010-08-02  Ian Lance Taylor  <iant@google.com>
5604
5605         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5606         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5607         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5608
5609 2010-08-02  Ian Lance Taylor  <iant@google.com>
5610
5611         PR 11855
5612         * script.cc (Script_options::Script_options): Initialize
5613         symbol_definitions_ and symbol_references_.
5614         (Script_options::add_symbol_assignment): Update
5615         symbol_definitions_ and symbol_references_.
5616         (Script_options::add_symbol_reference): New function.
5617         (script_symbol): New function.
5618         * script.h (class Script_options): Add symbol_definitions_ and
5619         symbol_references_ fields.
5620         (Script_options::referenced_const_iterator): New type.
5621         (Script_options::referenced_begin): New function.
5622         (Script_options::referenced_end): New function.
5623         (Script_options::is_referenced): New function.
5624         (Script_options::any_unreferenced): New function.
5625         * script-c.h (script_symbol): Declare.
5626         * yyscript.y (exp): Call script_symbol.
5627         * symtab.cc: Include "script.h".
5628         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5629         Change all callers.  Check symbols referenced by scripts.
5630         (Symbol_table::add_undefined_symbols_from_command_line): Add
5631         layout parameter.  Change all callers.
5632         (Symbol_table::do_add_undefined_symbols_from_command_line):
5633         Likewise.  Break out loop body.  Check symbols referenced by
5634         scripts.
5635         (Symbol_table::add_undefined_symbol_from_command_line): New
5636         function broken out of
5637         do_add_undefined_symbols_from_command_line.
5638         * symtab.h (class Symbol_table): Update declarations.
5639         * archive.cc: Include "layout.h".
5640         (Archive::should_include_member): Add layout parameter.  Change
5641         all callers.  Check for symbol mentioned in expression.
5642         * archive.h (class Archive): Update declaration.
5643         * object.cc (Sized_relobj::do_should_include_member): Add layout
5644         parameter.
5645         * object.h (Object::should_include_member): Add layout parameter.
5646         Change all callers.
5647         (Object::do_should_include_member): Add layout parameter.
5648         (class Sized_relobj): Update declaration.
5649         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5650         parameter.
5651         * dynobj.h (class Sized_dynobj): Update declaration.
5652         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5653         layout parameter.
5654         * plugin.h (class Sized_pluginobj): Update declaration.
5655
5656 2010-08-02  Ian Lance Taylor  <iant@google.com>
5657
5658         PR 11866
5659         * output.cc (Output_segment::set_offset): Search for the first and
5660         last sections rather than assuming that the list is in order.
5661         (Output_segment::find_first_and_last_list): New function.
5662         * output.h (class Output_segment): Update declarations.
5663         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5664         (relro_strip_test_SOURCES): New variable.
5665         (relro_strip_test_DEPENDENCIES): New variable.
5666         (relro_strip_test_LDFLAGS): New variable.
5667         (relro_strip_test_LDADD): New variable.
5668         (relro_strip_test.so): New target.
5669
5670 2010-08-02  Ian Lance Taylor  <iant@google.com>
5671
5672         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5673         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5674         (Target_i386::got_tlsdesc_section): New function.
5675         (Target_i386::got_section): Create space for GOT entries for
5676         TLSDESC relocations.
5677         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5678         R_386_TLS_GOTDESC.
5679         (Target_i386::Scan::global): Likewise.
5680         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5681         using TLSDESC GOT.
5682         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5683         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5684         (Target_x86_64::got_tlsdesc_section): New function.
5685         (Target_x86_64::got_section): Create space for GOT entries for
5686         TLSDESC relocations.
5687         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5688         R_386_TLS_GOTDESC.
5689         (Target_x86_64::Scan::global): Likewise.
5690         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5691         using TLSDESC GOT.
5692
5693 2010-08-02  Ian Lance Taylor  <iant@google.com>
5694
5695         * testsuite/final_layout.sh: Use dc to convert from hex to
5696         decimal.
5697
5698 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5699
5700         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5701         paramter to the call to gold::gc_process_relocs.
5702         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5703         paramter to the call to gold::gc_process_relocs.
5704         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5705         parameter to the call to gold::gc_process_relocs.
5706         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5707         template parameter to the call to gold::gc_process_relocs.
5708         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5709         paramter to the call to gold::gc_process_relocs.
5710         * gc.h (get_embedded_addend_size): New function.
5711         (gc_process_relocs): Save the size of the reloc for use by ICF.
5712         * icf.cc (get_section_contents): Get the addend from the text section
5713         for SHT_REL relocation sections.
5714         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5715         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5716         * int_encoding.h (read_from_pointer): New overloaded function.
5717         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5718         * testsuite/icf_sht_rel_addend_test.sh: New file.
5719         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5720         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5721
5722 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5723
5724         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5725         * Makefile.in: Regenerate.
5726         * testsuite/Makefile.in: Regenerate.
5727
5728 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5729
5730         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5731         * gold/testsuite/debug_msg.cc: Likewise.
5732         * gold/testsuite/odr_violation1.cc
5733         * gold/testsuite/odr_violation2.cc
5734
5735 2010-07-21  Cary Coutant  <ccoutant@google.com>
5736
5737         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5738         string, and length fields.
5739         (Output_merge_string::Merged_strings_list): New type.
5740         (Output_merge_string::Merged_strings_lists): New typedef.
5741         (Output_merge_string): Replace merged_strings_ with
5742         merged_strings_lists_.
5743         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5744         Merged_strings_list per input object and section.  Don't store pointer
5745         to the string.  Don't store length with each merged string entry.
5746         (Output_merge_string::finalize_merged_data): Loop over list of merged
5747         strings lists.  Recompute length of each merged string.
5748
5749 2010-07-15  Cary Coutant  <ccoutant@google.com>
5750
5751         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5752         here.
5753
5754 2010-07-14  Ian Lance Taylor  <iant@google.com>
5755
5756         * descriptors.cc (Descriptors::open): Report correct name in error
5757         message.
5758
5759 2010-07-13  Doug Kwan  <dougkwan@google.com>
5760
5761         * arm.cc (Arm_input_section::Arm_input_section): For a
5762         SHT_ARM_EXIDX section, always keeps the input sections.
5763         (Arm_input_section::set_exidx_section_link): New method.
5764         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5765         has_errors_ to false.
5766         (Arm_exidx_input_section::has_errors,
5767         Arm_exidx_input_section::set_has_errors): New methods.
5768         (Arm_exidx_input_section::has_errors_): New data member.
5769         (Arm_relobj::get_exidx_shndx_list): New method.
5770         (Arm_output_section::append_text_sections_to_list): Do not skip
5771         section without SHF_EXECINSTR.
5772         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5773         errors.
5774         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5775         section header.  Make error messages more verbose.  Check for
5776         a non-executable section linked to an EXIDX section.
5777         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5778         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5779         check that there is no deferred EXIDX section if we exit early.
5780         Instead of not making an EXIDX section in case of an error, make one
5781         and set the has_errors flag of it.
5782         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5783         in a relocatable link.
5784         (Target_arm::do_relax): Look for the EXIDX output section instead of
5785         assuming that it is called .ARM.exidx.
5786         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5787         section list.  Do not check for SHF_EXECINSTR section flags but
5788         skip any input section with errors.
5789         * output.cc (Output_section::Output_section): Initialize
5790         always_keeps_input_sections_ to false.
5791         (Output_section::add_input_section): Check for
5792         always_keeps_input_sections_.
5793         *  output.h (Output_section::always_keeps_input_sections,
5794         Output_section::set_always_keeps_input_sections): New methods.
5795         (Output_section::always_keeps_input_sections): New data member.
5796
5797 2010-07-13  Rafael Espindola  <espindola@google.com>
5798
5799         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5800         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5801
5802 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5803             Ian Lance Taylor  <iant@google.com>
5804
5805         * output.h (Output_section_lookup_maps::add_merge_section):
5806         Correct check of whether value was inserted.
5807         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5808         (Output_section_lookup_maps::add_relaxed_input_section):
5809         Likewise.
5810         * arm.cc (Target_arm::got_section): Remove used local os.
5811         * i386.cc (Target_i386::got_section): Likewise.
5812         * x86_64.cc (Target_x86_64::got_section): Likewise.
5813         * sparc.cc (Target_sparc::got_section): Likewise.
5814         (Target_sparc::relocate): Remove unused local have_got_offset.
5815         * powerpc.cc (Target_powerpc::relocate): Likewise.
5816
5817 2010-07-13  Ian Lance Taylor  <iant@google.com>
5818
5819         * compressed_output.cc (zlib_decompress): Fix signature in
5820         !HAVE_ZLIB_H case.
5821
5822         * archive.cc (Archive::include_member): Unlock an external member
5823         of a thin archive.  Don't bother to delete an object we know is
5824         NULL.
5825
5826 2010-07-12  Cary Coutant  <ccoutant@google.com>
5827
5828         * compressed_output.cc (zlib_decompress): New function.
5829         (get_uncompressed_size): New function.
5830         (decompress_input_section): New function.
5831         * compressed_output.h (get_uncompressed_size): New function.
5832         (decompress_input_section): New function.
5833         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5834         Handle compressed debug sections.
5835         * layout.cc (is_compressed_debug_section): New function.
5836         (Layout::output_section_name): Map compressed section names to
5837         canonical names.
5838         * layout.h (is_compressed_debug_section): New function.
5839         (is_debug_info_section): Recognize compressed debug sections.
5840         * merge.cc: Include compressed_output.h.
5841         (Output_merge_data::do_add_input_section): Handle compressed
5842         debug sections.
5843         (Output_merge_string::do_add_input_section): Handle compressed
5844         debug sections.
5845         * object.cc: Include compressed_output.h.
5846         (Sized_relobj::Sized_relobj): Initialize new data members.
5847         (build_compressed_section_map): New function.
5848         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5849         * object.h (Object::section_is_compressed): New method.
5850         (Object::do_section_is_compressed): New method.
5851         (Sized_relobj::Compressed_section_map): New type.
5852         (Sized_relobj::do_section_is_compressed): New method.
5853         (Sized_relobj::compressed_sections_): New data member.
5854         * output.cc (Output_section::add_input_section): Handle compressed
5855         debug sections.
5856         * reloc.cc: Include compressed_output.h.
5857         (Sized_relobj::write_sections): Handle compressed debug sections.
5858
5859 2010-07-08  Cary Coutant  <ccoutant@google.com>
5860
5861         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5862         weak when resolving to a dynamic def.
5863         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5864         for weak undef/dynamic def cases. Adjust callers.
5865         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5866         undef_binding_weak_.
5867         (Symbol_table::sized_write_globals): Adjust symbol binding.
5868         (Symbol_table::sized_write_symbol): Add binding parameter.
5869         * symtab.h (Symbol::set_undef_binding): New method.
5870         (Symbol::is_undef_binding_weak): New method.
5871         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5872         (Symbol_table::should_override): Add new parameter.
5873         (Symbol_table::sized_write_symbol): Add new parameter.
5874
5875         * testsuite/weak_undef_file1.cc: Add new test case.
5876         * testsuite/weak_undef_file2.cc: Fix header comment.
5877         * testsuite/weak_undef_test.cc: Add new test case.
5878
5879 2010-06-29  Doug Kwan  <dougkwan@google.com>
5880
5881         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5882         Initialize USE_SYMBOL_.
5883         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5884         definition.
5885         (Arm_reloc_property::uses_symbol_): New data member declaration.
5886         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5887         uses symbol value and symbol is undefined but not weakly undefined.
5888
5889 2010-06-28  Rafael Espindola  <espindola@google.com>
5890
5891         * plugin.cc (Plugin::load): Use dlerror.
5892
5893 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5894
5895         * symtab.cc (detect_odr_violations): When reporting an ODR
5896         violation, report an object where the symbol is defined.
5897
5898 2010-06-25  Doug Kwan  <dougkwan@google.com>
5899
5900         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5901         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5902         definition.
5903         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5904         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5905         target hook to detect function points.
5906         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5907         * icf.h (Icf::check_section_for_function_pointers): Change type of
5908         parameter SECTION_NAME to const reference to std::string.  Use
5909         target hook to determine if section may have unsafe pointers.
5910         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5911         method definition.
5912
5913 2010-06-21  Rafael Espindola  <espindola@google.com>
5914
5915         * fileread.cc (Input_file::find_fie): New
5916         (Input_file::open): Use Input_file::find_fie.
5917         * fileread.h (Input_file::find_fie): New
5918         * plugin.cc (set_extra_library_path): New.
5919         (Plugin::load): Add set_extra_library_path to the transfer vector.
5920         (Plugin_manager::set_extra_library_path): New.
5921         (Plugin_manager::add_input_file): Use the extra search path if set.
5922         (set_extra_library_path(): New.
5923         * plugin.h (Plugin_manager): Add set_extra_library_path and
5924         extra_search_path_.
5925
5926 2010-06-19  Cary Coutant  <ccoutant@google.com>
5927
5928         * layout.cc (gdb_sections): Add .debug_types.
5929         (lines_only_debug_sections): Likewise.
5930
5931 2010-06-18  Rafael Espindola  <espindola@google.com>
5932
5933         * plugin.cc (add_input_file,add_input_library)
5934         (Plugin_manager::add_input_file): Make filename arguments const.
5935         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5936         const.
5937
5938 2010-06-16  Doug Kwan  <dougkwan@google.com>
5939
5940         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5941         .ARM.attributes section if we have not merged any input
5942         attributes sections.
5943
5944 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5945
5946         * arm.cc: Allow combining objects with no EABI version
5947         information.
5948
5949 2010-06-15  Rafael Espindola  <espindola@google.com>
5950
5951         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5952
5953 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5954
5955         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5956         (struct iovec): Correct !HAVE_READV definition.
5957
5958 2010-06-10  Cary Coutant  <ccoutant@google.com>
5959
5960         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5961         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5962         reloc sections.
5963         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5964
5965         PR 11683
5966         * symtab.h (Symbol::is_placeholder): New member function.
5967         * target-reloc.h (relocate_section): Check for placeholder symbols.
5968
5969         * testsuite/Makefile.am (plugin_test_8): New test.
5970         (plugin_test_9): New test.
5971         * testsuite/Makefile.in: Regenerate.
5972
5973 2010-06-09  Nick Clifton  <nickc@redhat.com>
5974
5975         * yyscript.y (input_list_element): Allow strings prefixed with
5976         the '-' character.  Treat these as libraries.
5977         * script.cc (script_add_library): New function.  Adds a library
5978         specified by "-l<name>" found in an input script.
5979         * script-c.h: Add prototype for script_add_library.
5980
5981 2010-06-07  Doug Kwan  <dougkwan@google.com>
5982
5983         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5984         Restrict stub-group size to be within long conditional branch
5985         range when working around cortex-A8 erratum.
5986
5987 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5988
5989         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5990         #ifdef typo.
5991
5992 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5993
5994         PR gold/11658
5995         * output.cc
5996         (Output_section::Input_section_sort_entry::compare_section_ordering):
5997         Change to return non-zero correctly.
5998         (Output_section::Input_section_sort_section_order_index_compare
5999         ::operator()): Change to fix ambiguity in comparisons.
6000
6001 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6002
6003         * gold.h (is_wildcard_string): New function.
6004         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6005         (Layout::layout_eh_frame): Ditto.
6006         (Layout::find_section_order_index): New method.
6007         (Layout::read_layout_from_file): New method.
6008         * layout.h (Layout::find_section_order_index): New method.
6009         (Layout::read_layout_from_file): New method.
6010         (Layout::input_section_position_): New private member.
6011         (Layout::input_section_glob_): New private member.
6012         * main.cc (main): Call read_layout_from_file here.
6013         * options.h (--section-ordering-file): New option.
6014         * output.cc (Output_section::input_section_order_specified_): New
6015         member.
6016         (Output_section::Output_section): Initialize new member.
6017         (Output_section::add_input_section): Add new parameter.
6018         Keep input sections when --section-ordering-file is used.
6019         (Output_section::set_final_data_size): Sort input sections when
6020         section ordering file is specified.
6021         (Output_section::Input_section_sort_entry): Add new parameter.
6022         Check sorting type.
6023         (Output_section::Input_section_sort_entry::compare_section_ordering):
6024         New method.
6025         (Output_section::Input_section_sort_compare::operator()): Change to
6026         consider section_order_index.
6027         (Output_section::Input_section_sort_init_fini_compare::operator()):
6028         Change to consider section_order_index.
6029         (Output_section::Input_section_sort_section_order_index_compare
6030         ::operator()): New method.
6031         (Output_section::sort_attached_input_sections): Change to sort
6032         according to section order when specified.
6033         (Output_section::add_input_section<32, true>): Add new parameter.
6034         (Output_section::add_input_section<64, true>): Add new parameter.
6035         (Output_section::add_input_section<32, false>): Add new parameter.
6036         (Output_section::add_input_section<64, false>): Add new parameter.
6037         * output.h (Output_section::add_input_section): Add new parameter.
6038         (Output_section::input_section_order_specified): New
6039         method.
6040         (Output_section::set_input_section_order_specified): New method.
6041         (Input_section::Input_section): Initialize section_order_index_.
6042         (Input_section::section_order_index): New method.
6043         (Input_section::set_section_order_index): New method.
6044         (Input_section::section_order_index_): New member.
6045         (Input_section::Input_section_sort_section_order_index_compare): New
6046         struct.
6047         (Output_section::input_section_order_specified_): New member.
6048         * script-sections.cc (is_wildcard_string): Delete and move modified
6049         method to gold.h.
6050         (Output_section_element_input::Output_section_element_input): Modify
6051         call to is_wildcard_string.
6052         (Output_section_element_input::Input_section_pattern
6053         ::Input_section_pattern): Ditto.
6054         (Output_section_element_input::Output_section_element_input): Ditto.
6055         * testsuite/Makefile.am (final_layout): New test case.
6056         * testsuite/Makefile.in: Regenerate.
6057         * testsuite/final_layout.cc: New file.
6058         * testsuite/final_layout.sh: New file.
6059
6060 2010-06-01  Rafael Espindola  <espindola@google.com>
6061
6062         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6063
6064 2010-06-01  Rafael Espindola  <espindola@google.com>
6065
6066         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6067         visibility of symbols.
6068
6069 2010-05-27  Doug Kwan  <dougkwan@google.com>
6070
6071         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6072         from start of output section instead of address for a local symbol
6073         in a merged or relaxed section when doing a relocatable link.
6074
6075 2010-05-26  Rafael Espindola  <espindola@google.com>
6076
6077         PR 11604
6078         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6079         adding sections the garbage collector removed.
6080         * gold/testsuite/Makefile.am: Add test.
6081         * gold/testsuite/Makefile.in: Regenerate.
6082         * gold/testsuite/plugin_test_7.sh: New.
6083         * gold/testsuite/plugin_test_7_1.c: New.
6084         * gold/testsuite/plugin_test_7_2.c: New.
6085
6086 2010-05-26  Rafael Espindola  <espindola@google.com>
6087
6088         * script-sections.cc (Output_section_definition::set_section_addresses):
6089         Check for --section-start.
6090
6091 2010-05-26  Doug Kwan  <dougkwan@google.com>
6092
6093         * arm.cc (Arm_scan_relocatable_relocs): New class.
6094         (Target_arm::relocate_special_relocatable): New method.
6095         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6096         (Arm_relocate_functions::thumb_branch_common): Same.
6097         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6098         instead of Default_scan_relocatable_relocs.
6099         * target-reloc.h (relocate_for_relocatable): Let target handle
6100         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6101         * target.h (Sized_target::relocate_special_relocatable): New method.
6102
6103 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6104
6105         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6106
6107 2010-05-23  Doug Kwan  <dougkwan@google.com>
6108
6109         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6110         instead of a cast.
6111         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6112         with a direct branch, not a conditional branch, to a stub.
6113         * merge.cc (Output_merge_base::record_input_section): New method
6114         defintion.
6115         (Output_merge_data::do_add_input_section): Record input section if
6116         keeps-input-sections flag is set.
6117         (Output_merge_string::do_add_input_section): Ditto.
6118         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6119         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6120         INPUT_SECTIONS_.
6121         (Output_merge_base::keeps_input_sections,
6122         Output_merge_base::set_keeps_input_sections,
6123         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6124         method definitions.
6125         (Output_merge_base::Input_sections): New type declaration.
6126         (Output_merge_base::input_sections_begin,
6127         Output_merge_base::input_sections_end,
6128         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6129         (Output_merge_base::bool keeps_input_sections_,
6130         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6131         Output_merge_base::input_sections_): New data members.
6132         (Output_merge_data::do_set_keeps_input_sections): New method
6133         defintion.
6134         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6135         * output.cc (Output_section::Input_section::relobj): Move method
6136         defintion from class declaration to here and handle merge sections.
6137         (Output_section::Input_section::shndx): Ditto.
6138         (Output_section::Output_section): Remove initializations of removed
6139         data members and initialize new data member LOOKUP_MAPS_.
6140         (Output_section::add_input_section): Set keeps-input-sections flag
6141         for a newly created merge output section as appropriate.  Adjust code
6142         to use Output_section_lookup_maps class.
6143         (Output_section::add_relaxed_input_section): Adjst code for lookup
6144         maps code refactoring.
6145         (Output_section::add_merge_input_section): Add a new parameter
6146         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6147         class.  If adding input section to a newly created merge output
6148         section fails, remove the new merge section.
6149         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6150         Adjust code for use of the Output_section_lookup_maps class.
6151         (Output_section::find_merge_section): Ditto.
6152         (Output_section::build_lookup_maps): New method defintion.
6153         (Output_section::find_relaxed_input_section): Adjust code to use
6154         Output_section_lookup_maps class.
6155         (Output_section::get_input_sections): Export merge sections.  Adjust
6156         code to use Output_section_lookup_maps class.
6157         (Output_section:::add_script_input_section): Adjust code to use
6158         Output_section_lookup_maps class.  Update lookup maps for merge
6159         sections also.
6160         (Output_section::discard_states): Use Output_section_lookup_maps.
6161         (Output_section::restore_states): Same.
6162         * output.h (Merge_section_properties): Move class defintion out of
6163         Output_section.
6164         (Output_section_lookup_maps): New class.
6165         (Output_section::Input_section::is_merge_section): New method
6166         defintion.
6167         (Output_section::Input_section::relobj): Move defintion out of class
6168         defintion.  Declare method only.
6169         (Output_section::Input_section::shndx): Ditto.
6170         (Output_section::Input_section::output_merge_base): New method defintion.
6171         (Output_section::Input_section::u2_.pomb): New union field.
6172         (Output_section::Merge_section_by_properties_map,
6173         Output_section::Output_section_data_by_input_section_map,
6174         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6175         Remove types.
6176         (Output_section::add_merge_input_section): Add new parameter
6177         KEEPS_INPUT_SECTIONS.
6178         (Output_section::build_lookup_maps): New method declaration.
6179         (Output_section::merge_section_map_,
6180         Output_section::merge_section_by_properties_map_,
6181         Output_section::relaxed_input_section_map_,
6182         Output_section::is_relaxed_input_section_map_valid_): Remove data
6183         members.
6184         (Output_section::lookup_maps_): New data member.
6185
6186 2010-05-21  Doug Kwan  <dougkwan@google.com>
6187
6188         PR gold/11619
6189         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6190         avoid a compilation error.
6191
6192 2010-05-19  Rafael Espindola  <espindola@google.com>
6193
6194         * script-sections.cc (Output_section_definition::allocate_to_segment):
6195         Update the phdrs_list even when the output section is NULL.
6196         * testsuite/Makefile.am: Add test.
6197         * testsuite/Makefile.in: Regenerate.
6198         * testsuite/script_test_9.cc: New.
6199         * testsuite/script_test_9.sh: New.
6200         * testsuite/script_test_9.t: New.
6201
6202 2010-05-19  Doug Kwan  <dougkwan@google.com>
6203
6204         * arm.cc (Arm_input_section::original_size): New method.
6205         (Arm_input_section::do_addralign): Add a cast.
6206         (Arm_input_section::do_output_offset): Remove static cast.
6207         (Arm_input_section::original_addralign,
6208          Arm_input_section::original_size_): Change type to uint32_t.
6209         (Arm_input_section::init): Add safe casts for section alignment
6210         and size.
6211         (Arm_input_section::set_final_data_size): Do not set address and
6212         offset of stub table.
6213         (Arm_output_section::fix_exidx_coverage): Change use of of
6214         Output_section::Simple_input_section to that of
6215         Output_section::Input_section.
6216         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6217         except for the first pass.
6218         * output.cc (Output_section::get_input_sections): Change type of
6219         input_sections to std::list<Input_section>.
6220         (Output_section::add_script_input_section): Rename from
6221         Output_section::add_simple_input_section.  Change type of SIS
6222         parameter from Simple_input_section to Input_section.
6223         * output.h (Output_section::Simple_input_section): Remove class.
6224         (Output_section::Input_section): Change class visibility to public.
6225         (Output_section::Input_section::addralign): Use stored alignments
6226         for special input sections if set.
6227         (Output_section::Input_section::set_addralign): New method.
6228         (Output_section::get_input_sections): Change parameter type from
6229         list of Simple_input_section to list of Input_section.
6230         (Output_section::add_script_input_section): Rename from
6231         Output_section::add_simple_input_section. Change first parameter's
6232         type from Simple_input_section to Input_section and remove the
6233         second and third parameters.
6234         * script-sections.cc (Input_section::Input_section_list): Change
6235         type to list of Output_section::Input_section/
6236         (Input_section_info::Input_section_info): Change parameter type of
6237         INPUT_SECTION to Output_section::Input_section.
6238         (Input_section_info::input_section): Change return type.
6239         (Input_section_info::input_section_): Change type to
6240         Output_section::Input_section.
6241         (Output_section_element_input::set_section_addresses): Adjust code
6242         to use Output_section::Input_section instead of
6243         Output_section::Simple_input_section.  Adjust code for renaming
6244         of Output_section::add_simple_input_section.
6245         (Orphan_output_section::set_section_addresses): Ditto.
6246
6247 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6248
6249         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6250         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6251
6252 2010-05-18  Rafael Espindola  <espindola@google.com>
6253
6254         * options.cc (General_options::finalize): Handle -nostdlib.
6255         * options.h (nostdlib): New option.
6256         * script.cc (script_add_search_dir): Handle -nostdlib.
6257
6258 2010-05-12  Doug Kwan  <dougkwan@google.com>
6259
6260         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6261         attributes section only if there no attributes section after merging.
6262         (Target_arm::merge_object_attributes): Move value of
6263         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6264         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6265         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6266         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6267         and arm_attr_merge_7.stdout.
6268         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6269         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6270         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6271         arm_attr_merge_7b.o): New rules.
6272         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6273         arm_attr_merge_7
6274         * testsuite/Makefile.in: Regenerate.
6275         * testsuite/arm_attr_merge.sh: New file.
6276         * testsuite/arm_attr_merge_[67][ab].s: Same.
6277
6278 2010-05-05  Nick Clifton  <nickc@redhat.com>
6279
6280         * po/es.po: Updated Spanish translation.
6281
6282 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6283
6284         * Makefile.am (install-exec-local): Properly install gold as
6285         default cross linker.
6286         * Makefile.in: Regenerated.
6287
6288 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6289             Nick Clifton  <nickc@redhat.com>
6290
6291         * configure.ac (install_as_default): Define and set to false
6292         unless --enable-gold or --enable-gold=both/gold has been
6293         specified.
6294         * configure: Regenerate.
6295
6296         * Makefile.am (install-exec-local): Install the executable as
6297         'ld.gold'.  If install_as_default is true then also install it as
6298         'ld'.
6299         * Makefile.in: Regenerated.
6300
6301 2010-04-24  Ian Lance Taylor  <iant@google.com>
6302
6303         * layout.cc (Layout::layout_reloc): In relocatable link don't
6304         combine reloc sections for grouped sections.
6305
6306 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6307
6308         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6309         sections that are not ordinary to icf.
6310         * icf.cc (get_section_contents): Handle relocation pointing to section
6311         with no object or shndx information.
6312         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6313         * testsuite/Makefile.in: Regenerate.
6314         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6315         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6316
6317 2010-04-22  Ian Lance Taylor  <iant@google.com>
6318
6319         * expression.cc (Expression::Expression_eval_info): Add
6320         result_alignment_pointer field.
6321         (Expression::eval_with_dot): Add result_alignment_pointer
6322         parameter.  Change all callers.
6323         (Expression::eval_maybe_dot): Likewise.
6324         (class Binary_expression): Add alignment_pointer parameter to
6325         left_value and right_value.  Change all callers.
6326         (BINARY_EXPRESSION): Set result alignment.
6327         (class Trinary_expression): Add alignment_pointer parameter to
6328         arg2_value and arg3_value.  Change all callers.
6329         (Trinary_cond::value): Set result alignment.
6330         (Max_expression::value, Min_expression::value): Likewise.
6331         (Align_expression::value): Likewise.
6332         * script-sections.cc (class Sections_element): Add dot_alignment
6333         parameter to set_section_addresses virtual function.  Update
6334         instantiations.
6335         (class Output_section_element): Likewise.
6336         (Script_sections::create_segments): Add dot_alignment parameter.
6337         Change all callers.
6338         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6339         (Script_sections::set_phdrs_clause_addresses): Likewise.
6340         * script-sections.h: Update declarations.
6341         * script.h: Update declarations.
6342         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6343         min_p_align.
6344         * testsuite/script_test_3.t: Set large alignment.
6345         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6346         segment has expected alignment.
6347
6348 2010-04-22  Nick Clifton  <nickc@redhat.com>
6349
6350         * po/gold.pot: Updated by the Translation project.
6351         * po/vi.po: Updated Vietnamese translation.
6352
6353 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6354
6355         * testsuite/Makefile.am (check_PROGRAMS): Add
6356         icf_virtual_function_folding_test.
6357         * testsuite/Makefile.in: Regenerated.
6358
6359 2010-04-15  Andrew Haley  <aph@redhat.com>
6360
6361         * options.h (merge_exidx_entries): New option.
6362         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6363         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6364         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6365         (Target_arm::merge_exidx_entries): New function.
6366         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6367         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6368         to Arm_exidx_fixup constructor.
6369         Add new arg, merge_exidx_entries.
6370         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6371         Arm_output_section::fix_exidx_coverage.
6372
6373 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6374
6375         * icf.cc (get_section_contents): Check for preemptible functions.
6376         Ignore addend when appropriate.
6377         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6378         section folded.
6379         (add_from_relobj): Check for section folded.
6380         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6381         * symtab.h (should_add_dynsym_entry): Add new parameter.
6382         * target-reloc.h (scan_relocs): Check for section folded.
6383         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6384         Check reloc types for function pointers in shared objects.
6385         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6386         case.
6387         (icf_preemptible_functions_test): New test case.
6388         (icf_string_merge_test): New test case.
6389         * testsuite.Makefile.in: Regenerate.
6390         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6391         bar_glob.  Refactor code.
6392         * testsuite/icf_preemptible_functions_test.cc: New file.
6393         * testsuite/icf_preemptible_functions_test.sh: New file.
6394         * testsuite/icf_string_merge_test.cc: New file.
6395         * testsuite/icf_string_merge_test.sh: New file.
6396         * testsuite/icf_virtual_function_folding_test.cc: New file.
6397         * testsuite/icf_virtual_function_folding_test.sh: New file.
6398
6399 2010-04-14  Doug Kwan  <dougkwan@google.com>
6400
6401         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6402         for local symbol recounting if we remove a section due to ICF.
6403         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6404         there are no regular objects in input.
6405
6406 2010-04-13  Doug Kwan  <dougkwan@google.com>
6407
6408         * arm.cc (Arm_input_section::set_final_data_size): Compute
6409         accurate final data size instead of using current data size.
6410
6411 2010-04-09  Doug Kwan  <dougkwan@google.com>
6412
6413         * layout.cc (Layout::choose_output_section): Handle script section
6414         types.
6415         (Layout::make_output_section_for_script): Add section type parameter.
6416         Handle script section types.
6417         * layout.h (Layout::make_output_section_for_script): Add section
6418         type parameter.
6419         * output.cc (Output_section::Output_section): Initialize data member
6420         is_noload_.
6421         (Output_section::do_reset_address_and_file_offset): Do not set address
6422         to 0 if section is a NOLOAD section.
6423         * output.h (Output_section::is_noload): New method.
6424         (Output_section::set_is_noload): Ditto.
6425         (Output_section::is_noload_): New data member.
6426         * script-c.h (Script_section_type): New enum type.
6427         (struct Parser_output_section_header): Add new file section_type.
6428         * script-sections.cc (Sections_element::output_section_name): Add
6429         parameter for returning script section type.
6430         (Output_section_definition::output_section_name): Ditto.
6431         (Output_section_definition::section_type)P; New method.
6432         (Output_section_definiton::script_section_type_name): Ditto.
6433         (Output_section_definition::script_section_type_): New data member.
6434         (Output_section_definition::Output_section_definition): Initialize
6435         data member Output_section_definition::script_section_type_.
6436         (Output_section_definition::create_sections): Pass script section type
6437         to Layout::make_output_section_for_script.
6438         (Output_section_definition::output_section_name): Return script
6439         section type to caller.
6440         (Output_section_definition::set_section_address): Do not advance
6441         dot value and load address if section type is NOLOAD.  Set address
6442         of NOLOAD sections regardless of section flags.
6443         (Output_section_definition::print): Print section type if it is
6444         not SCRIPT_SECTION_TYPE_NONE.
6445         (Output_section_definition::section_type): New method.
6446         (Output_section_definition::script_section_type_name): Ditto.
6447         (Script_sections::output_section_name): Add new parameter
6448         PSECTION_TYPE for returning script section type.  Pass it to
6449         section elements.  Handle discard sections.
6450         (Sort_output_sections::operator()): Handle NOLOAD sections.
6451         * script-sections.h (Script_sections::Section_type): New enum type.
6452         (Script_sections::output_section_name): Add a new parameter for
6453         returning script section type.
6454         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6455         INFO and NOLOAD.
6456         * yyscript.y (union): Add new field SECTION_TYPE.
6457         (COPY, DSECT, INFO, NOLOAD): New tokens.
6458         (opt_address_and_section_type): Change type to output_section_header.
6459         (section_type): New non-terminal
6460         (section_header): Handle section type.
6461         (opt_address_and_section_type): Return section type value.
6462
6463 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6464
6465         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6466         * testsuite/plugin_common_test_2.c (foo): Likewise.
6467
6468 2010-04-08  Doug Kwan  <dougkwan@google.com>
6469
6470         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6471         Output_merge_data.
6472         * output.cc (Output_section::add_merge_input_section): Simplify
6473         code and return status of Output_merge_base::add_input_section.
6474         Update merge section map only if Output_merge_base::add_input_section
6475         returns true.
6476
6477 2010-04-07  Doug Kwan  <dougkwan@google.com>
6478
6479         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6480         if section is marked as containing instructions but has no mapping
6481         symbols.
6482         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6483         correct section index.
6484         (Arm_relobj::find_linked_text_section): Ditto.
6485
6486 2010-04-07  Cary Coutant  <ccoutant@google.com>
6487
6488         * archive.cc (include_member): Destroy Read_symbols_data object before
6489         releasing file.
6490         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6491         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6492         (Read_symbols_data::~Read_symbols_data) New destructor.
6493         (Section_relocs::Section_relocs) New constructor.
6494         (Section_relocs::~Section_relocs) New destructor.
6495         (Read_relocs_data::Read_relocs_data) New constructor.
6496         (Read_relocs_data::~Read_relocs_data) New destructor.
6497         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6498         pointers to NULL after deleting.
6499
6500 2010-04-07  Doug Kwan  <dougkwan@google.com>
6501
6502         * arm.cc: Replace "endianity" with "endianness" in comments.
6503         (Arm_exidx_cantunwind): Ditto.
6504         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6505         (Arm_relobj::merge_flags_and_attributes): New method.
6506         (Arm_relobj::merge_flags_and_attributes_): New data member.
6507         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6508         (Arm_relobj::scan_sections_for_stubs): Ditto.
6509         (Arm_relobj::do_read_symbols): Check to see if we really want to
6510         merge processor-specific flags and attributes.  Exit early if
6511         an object is empty except for section names and the undefined symbol.
6512         (Target_arm::do_finalize_sections): Move check for ELF format to
6513         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6514         attributes from a regular object only when we have determined that
6515         it is aapropriate.  Do not create an .ARM.attributes section in
6516         output if there is no regular input object.
6517         (Target_arm::merge_processor_specific_flags): Check
6518         --warn-mismatch before printing any error.
6519         (Target_arm::merge_object_attributes): Ditto.
6520         * gold.cc (queue_middle_tasks): Handle the case in which there is
6521         no regular object in input.
6522         * options.cc (General_options::parse_EB): New method.
6523         (General_options::parse_EL): Same.
6524         (General_options::General_options): Initialize endianness_.
6525         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6526         New options.
6527         (General_options::Endianness): New enum.
6528         (General_options::endianness): New method.
6529         (General_options::endianness_): New data member.
6530         * parameters.cc (Parameters::set_options): Check target endianness.
6531         (Parameters::set_target_once): Ditto.
6532         (Parameters::check_target_endianness): New method.
6533         (parameters_force_valid_target): If either -EL or -EB is specified,
6534         use it to define endianness of default target.
6535         * parameters.h (Parameters::check_target_endianness): New method
6536         declaration.
6537         * target.h (class Target): Change "endianity" to "endianness"
6538         in comments.
6539
6540 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6541
6542         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6543         * configure: Regenerate.
6544         * Makefile.in: Regenerate.
6545         * testsuite/Makefile.in: Regenerate.
6546
6547 2010-04-06  Cary Coutant  <ccoutant@google.com>
6548
6549         gcc PR lto/42757
6550         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6551         prevailing definitions of common symbols.
6552         * testsuite/plugin_test_6.sh: New test case.
6553         * testsuite/plugin_common_test_1.c: New test case.
6554         * testsuite/plugin_common_test_2.c: New test case.
6555         * testsuite/Makefile.am (plugin_test_6): New test case.
6556         * testsuite/Makefile.in: Regenerate.
6557
6558 2010-04-06  Nick Clifton  <nickc@redhat.com>
6559
6560         * po/vi.po: New Vietnamese translation.
6561
6562 2010-03-30  Doug Kwan  <dougkwan@google.com>
6563
6564         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6565
6566 2010-03-25  Doug Kwan  <dougkwan@google.com>
6567
6568         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6569         to avoid a conversion warning on a 32-bit host.
6570
6571 2010-03-24  Ian Lance Taylor  <iant@google.com>
6572
6573         * testsuite/script_test_3.t: Add a TLS segment.
6574         * testsuite/Makefile.am (check_PROGRAMS): Add
6575         tls_phdrs_script_test.
6576         (tls_phdrs_script_test_SOURCES): Define.
6577         (tls_phdrs_script_test_DEPENDENCIES): Define.
6578         (tls_phdrs_script_test_LDFLAGS): Define.
6579         (tls_phdrs_script_test_LDADD): Define.
6580         * testsuite/Makefile.in: Rebuild.
6581
6582 2010-03-23  Cary Coutant  <ccoutant@google.com>
6583
6584         * fileread.cc (find_or_make_view): Fix comment.
6585
6586 2010-03-23  Ian Lance Taylor  <iant@google.com>
6587
6588         * script-sections.cc (class Orphan_section_placement): Define
6589         PLACE_TLS and PLACE_TLS_BSS.
6590         (Orphan_section_placement::Orphan_section_placement): Initialize
6591         new places.
6592         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6593         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6594         (tls_script_test_SOURCES): Define.
6595         (tls_script_test_DEPENDENCIES): Define.
6596         (tls_script_test_LDFLAGS): Define.
6597         (tls_script_test_LDADD): Define.
6598         * testsuite/Makefile.in: Rebuild.
6599
6600 2010-03-22  Doug Kwan  <dougkwan@google.com>
6601
6602         * arm.cc (Arm_relocate_functions::abs8,
6603         Arm_relocate_functions::abs16): Use correct check for overflow
6604         specified in the ARM ELF specs.
6605         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6606         target of a BLX instruction specially.
6607         (Reloc_stub::stub_type_for_reloc): Ditto.
6608         (Relocate::relocate): Use symbolic names instead of numeric relocation
6609         codes to report error.
6610         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6611         workaround.
6612         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6613         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6614         thumb2_blx_out_of_range.stdout
6615         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6616         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6617         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6618         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6619         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6620         thumb2_blx_in_range, thumb2_blx_in_range.o,
6621         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6622         thumb2_blx_out_of_range.o): New rules.
6623         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6624         thumb2_blx_in_range and thumb2_blx_out_of_range.
6625         * testsuite/Makefile.in: Regenerate.
6626         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6627         * testsuite/thumb_blx_in_range.s: New file.
6628         * testsuite/thumb_blx_out_of_range.s: New file.
6629
6630 2010-03-22  Rafael Espindola  <espindola@google.com>
6631
6632         * archive.cc (Should_include): Move to archive.h.
6633         (should_include_member): Make it a member of Archive.
6634         (Lib_group): New.
6635         (Add_lib_group_symbols): New.
6636         * archive.h: Include options.h.
6637         (Archive_member): Moved from Archive.
6638         (Should_include): Moved from archive.cc.
6639         (Lib_group): New.
6640         (Add_lib_group_symbols): New.
6641         * dynobj.cc (do_should_include_member): New.
6642         * dynobj.h (do_should_include_member): New.
6643         * gold.cc (queue_initial_tasks): Update call to queue.
6644         * main.cc (main): Print lib group stats.
6645         * object.cc (do_should_include_member): New.
6646         * object.h: Include archive.h.
6647         (Object::should_include_member): New.
6648         (Object::do_should_include_member): New.
6649         (Sized_relobj::do_should_include_member): New.
6650         * options.cc (General_options::parse_start_lib): New.
6651         (General_options::parse_end_lib): New.
6652         (Input_arguments::add_file): Handle lib groups.
6653         (Input_arguments::start_group): Check we are not in a lib.
6654         (Input_arguments::start_lib): New.
6655         (Input_arguments::end_lib): New.
6656         * options.h (General_options): Add start_lib and end_lib.
6657         (Input_argument::lib_): New.
6658         (Input_argument::lib): New.
6659         (Input_argument::is_lib): New.
6660         (Input_file_lib): New.
6661         (Input_arguments::in_lib_): New.
6662         (Input_arguments::in_lib): New.
6663         (Input_arguments::start_lib): New.
6664         (Input_arguments::end_lib_): New.
6665         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6666         in unused members as preempted.
6667         (Sized_pluginobj::do_should_include_member): New.
6668         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6669         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6670         return the blocker.
6671         (Read_symbols::do_whole_lib_group): New.
6672         (Read_symbols::do_lib_group): New.
6673         (Read_symbols::do_read_symbols): Handle lib groups.
6674         (Read_symbols::get_name): Handle lib groups.
6675         * readsyms.h (Read_symbols): Add an archive member pointer.
6676         (Read_symbols::do_whole_lib_group): New.
6677         (Read_symbols::do_lib_group): New.
6678         (Read_symbols::member_): New.
6679         * script.cc (read_input_script): Update call to queue_soon.
6680
6681 2010-03-19  Doug Kwan  <dougkwan@google.com>
6682
6683         * arm.cc (Stub_table::Stub_table): Initialize new data members
6684         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6685         (Stub_table::add_reloc_stub): Assign stub offset and update
6686         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6687         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6688         New data members.
6689         (Stub_table::update_data_size_and_addralign): Use
6690         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6691         instead of going over all reloc stubs.
6692         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6693         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6694         Stringpool_template::offset_ to size of Stringpool_char.
6695         (Stringpool_template::new_key_offset): Remove code to initialize
6696         Stringpool_template::offset_.
6697         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6698         Stringpool_template::offset_ to zero.
6699
6700 2010-03-15  Doug Kwan  <dougkwan@google.com>
6701
6702         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6703         offset_.
6704         (Stringpool_template::new_key_offset): New method.
6705         (Stringpool_template::add_string): Assign offsets when adding new
6706         strings.
6707         (Stringpool_template::set_string_offsets): Do not set string offsets
6708         when not optimizing.
6709         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6710         member size_.
6711         (Chunked_vector::clear): Clear size_.
6712         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6713         (Chunked_vector::size): Return size_.
6714         (Chunked_vector::push_back): Use size_ to find insert position.
6715         (Chunked_vector::size_): New data member.
6716         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6717         (Stringpool_template::new_key_offset): New method declaration.
6718         (Stringpool_template::offset_): New data member.
6719
6720 2010-03-15   Rafael Espindola  <espindola@google.com>
6721
6722         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6723         Add_symbols' constructor.
6724         * readsyms.h (Add_symbols): Remove the input_group member.
6725
6726 2010-03-10  Ian Lance Taylor  <iant@google.com>
6727
6728         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6729         target to ask whether a reference to a symbol requires a stack
6730         split.
6731         * target.h (Target::is_call_to_non_split): New function.
6732         (Target::do_is_call_to_non_split): Declare virtual function.
6733         * target.cc: Include "symtab.h".
6734         (Target::do_is_call_to_non_split): New function.
6735         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6736
6737 2010-03-10  Cary Coutant  <ccoutant@google.com>
6738
6739         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6740         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6741         (File_read::open[2]): Add whole_file_view_ to list of views.
6742         (File_read::make_view): Remove test of whole_file_view_.
6743         (File_read::find_or_make_view): Create whole_file_view_ if
6744         necessary.
6745         (File_read::clear_views): Replace bool parameter with enum;
6746         adjust all callers.  Don't delete views with permanent data;
6747         do delete cached views and views from archives if
6748         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6749         if clearing the corresponding view.
6750         * fileread.h (File_read::Clear_views_mode): New enum.
6751         (File_read::View::is_permanent_view): New method.
6752         (File_read::clear_views): Replace bool parameter
6753         with enum; adjust all callers.
6754         * options.h (General_options): Change keep_files_mapped option;
6755         add map_whole_files.
6756         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6757         releasing the file.
6758         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6759         the file.
6760
6761 2010-03-10  David S. Miller  <davem@davemloft.net>
6762
6763         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6764
6765 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6766
6767         * icf.cc (get_section_contents): Add '@' marker after processing the
6768         merge reloc.
6769
6770 2010-03-08  Doug Kwan  <dougkwan@google.com>
6771
6772         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6773         due to a conversion warning.
6774         (Arm_relobj::update_output_local_symbol_count): Check for local
6775         symbol with unset output index.
6776
6777 2010-03-05  Ian Lance Taylor  <iant@google.com>
6778
6779         * options.h (class General_options): Add --spare-dynamic-tags.
6780         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6781         --spare-dynamic-tags.
6782
6783 2010-03-05  Ian Lance Taylor  <iant@google.com>
6784
6785         * incremental.cc: Include "libiberty.h".
6786
6787 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6788
6789         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6790         function, is_info_ member.
6791         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6792         (Versions::Versions): Update caller.
6793         (Versions::define_base_version): Likewise.
6794         (Versions::add_def): Likewise.
6795
6796 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6797
6798         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6799         (Scan::possible_function_pointer_reloc): New function.
6800         (Scan::local_reloc_may_be_function_pointer): Change to call
6801         possible_function_pointer_reloc.
6802         (Scan::global_reloc_may_be_function_pointer): Ditto.
6803         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6804         relocations in ".data.rel.ro._ZTV" section.
6805         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6806         * testsuite/icf_safe_so_test.cc: Ditto.
6807         * testsuite/icf_safe_test.cc: Ditto.
6808         * testsuite/icf_safe_test.sh: Ditto.
6809
6810 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6811             Ian Lance Taylor  <iant@google.com>
6812
6813         * target-reloc.h (relocate_section): Check the symbol table index
6814         for -1U before setting the local symbol index.
6815         (scan_relocatable_relocs): If copying the relocation, record that
6816         the local symbol is required.
6817         * object.h (Symbol_value::is_output_symtab_index_set): New
6818         function.
6819         (Symbol_value::may_be_discarded_from_output_symtab): New
6820         function.
6821         (Symbol_value::has_output_symtab_entry): New function.
6822         (Symbol_value::needs_output_symtab_entry): Remove.
6823         (Symbol_value::output_symtab_index): Make sure the symbol index is
6824         set.
6825         (Symbol_value::set_output_symtab_index): Make sure the symbol
6826         index is not set.  Make sure the new index is valid.
6827         (Symbol_value::set_must_have_output_symtab_entry): New function.
6828         (Symbol_value::has_output_dynsym_entry): New function.
6829         (Symbol_value::set_output_dynsym_index): Make sure the new index
6830         is valid.
6831         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6832         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6833         local symbol if permitted.
6834         (Sized_relobj::do_finalize_local_symbols): Call
6835         is_output_symtab_index_set rather than needs_output_symtab_entry.
6836         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6837         rather than needs_output_symtab_entry.  Call
6838         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6839         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6840         is_output_symtab_index_set rather than needs_output_symtab_entry.
6841         * testsuite/discard_locals_relocatable_test.c: New file.
6842         * testsuite/discard_locals_test.sh: Test -r.
6843         * testsuite/Makefile.am (check_DATA): Add
6844         discard_locals_relocatable_test1.syms,
6845         discard_local_relocatable_test2.syms.
6846         (MOSTLYCLEANFILES): Likewise.  Also add
6847         discard_locals_relocatable_test1.lout and
6848         discard_locals_relocatable_test2.out.
6849         (discard_locals_relocatable_test1.syms): New target.
6850         (discard_locals_relocatable_test.o): New target.
6851         (discard_locals_relocatable_test1.out): New target.
6852         (discard_locals_relocatable_test2.syms): New target.
6853         (discard_locals_relocatable_test2.out): New target.
6854         (various): Add missing ../ld-new dependencies.
6855         * testsuite/Makefile.in: Rebuild.
6856
6857 2010-03-03  Nick Clifton  <nickc@redhat.com>
6858
6859         * po/fi.po: New Finnish translation.
6860
6861 2010-03-01  Doug Kwan  <dougkwan@google.com>
6862
6863         * layout.cc (Layout::Layout): Force section types of .init_array*,
6864         .preinit_array* and .fini_array* sections.
6865         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6866         Fix check of return value of std::string::find.().
6867         (Output_section::Input_section_sort_compare::operator()): Remove
6868         comment about .init_array.
6869         (Output_section::Input_section_sort_init_fini_compare::operator()):
6870         New method.
6871         (Output_section::sort_attached_input_sections): Handle .init_array
6872         and .fini_array specially.
6873         * output.h (Output_section::Inut_section_sort_compare): Update
6874         comment.
6875         (Output_section::Input_section_sort_init_fini_compare): New struct.
6876
6877 2010-02-26  Doug Kwan  <dougkwan@google.com>
6878
6879         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6880         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6881         * testsuite/debug_msg.sh: Avoid matching source line number for
6882         use of global variable undef_int.
6883
6884 2010-02-26  Doug Kwan  <dougkwan@google.com>
6885
6886         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6887         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6888         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6889         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6890         * options.cc (General_options::General_options): Initialize member
6891         fix_v4bx_.
6892         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6893         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6894         and rm_no_fix_v4bx.stdout
6895         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6896         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6897         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6898         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6899         and arm_no_fix_v4bx.
6900         * Makefile.in: Regenerate.
6901         * testsuite/arm_fix_v4bx.s: New file.
6902         * testsuite/arm_fix_v4bx.sh: Ditto.
6903
6904 2010-02-24  Doug Kwan  <dougkwan@google.com>
6905
6906         * arm.cc (Target_arm::got_section): Make the .got section the first
6907         non RELRO section in the data segment.
6908         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6909         suffixes of section names.
6910
6911 2010-02-24  Doug Kwan  <dougkwan@google.com>
6912
6913         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6914         flags and attributes merging if an input file is a binary file.
6915         * fileread.cc (Input_file::open): Record format of original file.
6916         * fileread.h (Input_file::Format): New enum type.
6917         (Input_file::Input_file): Initialize data member format_.
6918         (Input_file::format): New method definition.
6919         (Input_file::format_):: New data member.
6920
6921 2010-02-24  Doug Kwan  <dougkwan@google.com>
6922
6923         * arm.cc (Arm_output_data_got): New class.
6924         (ARM_TCB_SIZE): New constant
6925         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6926         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6927         If user uses a script with a SECTIONS clause, issue only a warning
6928         for a misplaced EXIDX input section.  Otherwise, issue an error.
6929         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6930         garbage collection.
6931         (Target_arm::got_mode_index_entry): Handle static linking.
6932         (Target_arm::Scan::local): Ditto.
6933         (Target_arm::Scan::global): Ditto.
6934         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6935         all incorrectly implemented relocations.
6936         (Target_arm::fix_exidx_coverage): Pass layout to
6937         Arm_output_section::fix_exidx_coverage.
6938         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6939         from ".ARM.exidx." and ".ARM.extab.".
6940
6941 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6942
6943         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6944         section if it does not already exist.
6945         * attributes.cc (Attributes_section_data::Attributes_section_data):
6946         Don't crash if size is zero.
6947
6948 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6949             Ian Lance Taylor  <iant@google.com>
6950
6951         * gold.cc (queue_middle_tasks): If no input files were opened,
6952         exit.
6953         * workqueue.h (Task_function::Task_function): Assert that there is
6954         a blocker.
6955
6956 2010-02-22  Doug Kwan  <dougkwan@google.com>
6957
6958         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6959         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6960         types to avoid warnings due to different uint64_t implementations
6961         on different hosts.
6962
6963 2010-02-21  Doug Kwan  <dougkwan@google.com>
6964
6965         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6966         handling of the maximum backward branch offset.
6967         (Arm_relocate_functions::thumb_branch_common): Ditto.
6968         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6969         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6970         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6971         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6972         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6973         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6974         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6975         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6976         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6977         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6978         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6979         thumb2_bl_out_of_range.o): New rules.
6980         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6981         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6982         thumb2_bl_out_of_range
6983         * testsuite/Makefile.in: Regenerate.
6984         * testsuite/arm_bl_in_range.s: New file.
6985         * testsuite/arm_bl_out_of_range.s: Ditto.
6986         * testsuite/arm_branch_in_range.sh: Ditto.
6987         * testsuite/arm_branch_range.t: Ditto.
6988         * testsuite/thumb2_branch_range.t: Ditto.
6989         * testsuite/thumb_bl_in_range.s: Ditto.
6990         * testsuite/thumb_bl_out_of_range.s: Ditto.
6991         * testsuite/thumb_branch_range.t: Ditto.
6992
6993 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6994
6995         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6996         Add reloc offset information.
6997         * icf.cc (get_section_contents): Change iterators to point to the new
6998         vectors. Add reloc offset information to the contents.
6999         * icf.h (Icf::Sections_reachable_info): New typedef.
7000         (Icf::Sections_reachable_list): New typedef.
7001         (Icf::Offset_info): New typedef.
7002         (Icf::Reloc_info): New struct typedef.
7003         (Icf::Reloc_info_list): New typedef.
7004         (Icf::symbol_reloc_list): Delete method.
7005         (Icf::addend_reloc_list): Delete method.
7006         (Icf::section_reloc_list): Delete method.
7007         (Icf::reloc_info_list): New method.
7008         (Icf::reloc_info_list_): New member.
7009
7010 2010-02-19  Doug Kwan  <dougkwan@google.com>
7011
7012         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7013         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7014         * arm.cc (Arm_relocation_functions): New forward declaration.
7015         (Target_arm::Target_arm): Initialize new data members
7016         got_mod_index_offset_ and tls_base_symbol_defined_.
7017         (Target_arm::Relocate::relocate_tls): New method.
7018         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7019          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7020         New methods.
7021         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7022         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7023         (Target_arm::got_mod_index_offset_,
7024         Target_arm::tls_base_symbol_defined_): New data members.
7025         (Target_arm::Scan::local, Target::Scan::global,
7026         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7027         relocations.
7028
7029 2010-02-18  Doug Kwan  <dougkwan@google.com>
7030
7031         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7032         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7033         text section as a parameter becuase some broken tools may not set
7034         the link in section header.
7035         (Target_arm::has_got_section): New method.
7036         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7037         without any mapping symbol as data only.  Remove warning.
7038         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7039         link in its section header, try to discover the link by inspecting the
7040         REL31 relocation at the beginning of the section.
7041         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7042         in error message.
7043         (Target_arm::Scan::global): Treat any reference to the symbol
7044         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7045
7046 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7047
7048         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7049         (Scan::global_reloc_may_be_function_pointer): New function.
7050         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7051         (Scan::global_reloc_may_be_function_pointer): New function.
7052         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7053         (Scan::global_reloc_may_be_function_pointer): New function.
7054         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7055         (Scan::global_reloc_may_be_function_pointer): New function.
7056         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7057         (Scan::global_reloc_may_be_function_pointer): New function.
7058         (Scan::possible_function_pointer_reloc): New function.
7059         (Target_x86_64::can_check_for_function_pointers): New function.
7060         * gc.h (gc_process_relocs): Scan relocation types to determine if
7061         function pointers were taken for targets that support it.
7062         * icf.cc (Icf::find_identical_sections): Include functions for
7063         folding in safe ICF whose pointer is not taken.
7064         * icf.h (Secn_fptr_taken_set): New typedef.
7065         (fptr_section_id_): New member.
7066         (section_has_function_pointers): New function.
7067         (set_section_has_function_pointers): New function.
7068         (check_section_for_function_pointers): New function.
7069         * options.h: Fix comment for safe ICF option.
7070         * target.h (can_check_for_function_pointers): New function.
7071         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7072         Modify icf_safe_test for X86-64.
7073         * testsuite/Makefile.in: Regenerate.
7074         * testsuite/icf_safe_so_test.cc: New file.
7075         * testsuite/icf_safe_so_test.sh: New file.
7076         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7077         (main): Change to take pointer to function kept_func_3.
7078         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7079         folding is done correctly for X86-64.
7080
7081 2010-02-12  David S. Miller  <davem@davemloft.net>
7082
7083         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7084         is_symbolless parameter.
7085         (Output_reloc<SHT_REL>::is_symbolless): New.
7086         (Output_reloc<SHT_REL>::is_symbolless_): New.
7087         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7088         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7089         (Output_reloc<SHT_RELA>::is_symbolless): New.
7090         (Output_data_reloc::add_global): Handle is_symbolless.
7091         (Output_data_reloc::add_global_relative): Likewise.
7092         (Output_data_reloc::add_local): Likewise.
7093         (Output_data_reloc::add_local_relative): Likewise.
7094         (Output_data_reloc::add_symbolless_global_addend): New.
7095         (Output_data_reloc::add_symbolless_local_addend): New.
7096         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7097         is_symbolless.
7098         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7099         instead of ->is_relative_
7100         (Output_reloc::write): Likewise.
7101         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7102         (Output_reloc::write_rel): Simplify.
7103
7104         * sparc.cc (Target_sparc::Scan::local): Use
7105         ->add_symbolless_local_addend as needed.
7106         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7107         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7108         based upon relocation offset.
7109
7110 2010-02-11  Doug Kwan  <dougkwan@google.com>
7111
7112         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7113         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7114         beginning of function.
7115         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7116         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7117         parameter is_32bit in calls to should_apply_static_reloc.
7118         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7119         (check_DATA): Add arm_abs_global.stdout.
7120         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7121         arm_abs_global.stdout): New rules.
7122         (MOSTLLYCLEANFILES): Add arm_abs_global
7123         * Makefile.in: Regenerate.
7124         * testsuite/arm_abs_global.s: New file.
7125         * testsuite/arm_abs_global.sh: Ditto.
7126         * testsuite/arm_abs_lib.s: Ditto.
7127
7128 2010-02-11  Ian Lance Taylor  <iant@google.com>
7129
7130         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7131         Read_relocs task.
7132         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7133         Allocate_commons_task first.
7134         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7135         task, rather than symtab_lock_.
7136         (Gc_process_relocs::~Gc_process_relocs): New function.
7137         (Gc_process_relocs::is_runnable): Check this_blocker_.
7138         (Gc_process_relocs::locks): Use next_blocker_ rather than
7139         blocker_.
7140         (Scan_relocs::~Scan_relocs): New function.
7141         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7142         symtab_lock_.
7143         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7144         next_blocker_.
7145         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7146         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7147         constructor accordingly.
7148         (class Gc_process_relocs): Likewise.
7149         (class Scan_relocs): Likewise.
7150         * common.h (class Allocate_commons_task): Remove symtab_lock_
7151         field, and corresponding constructor parameter.
7152         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7153         symtab_lock_.
7154         (Allocate_commons_task::locks): Likewise.
7155
7156 2010-02-11  Ian Lance Taylor  <iant@google.com>
7157
7158         * gold-threads.h (class Once): Define.
7159         (class Initialize_lock): Rewrite as child of Once.
7160         * gold-threads.cc (class Once_initialize): Define.
7161         (once_pointer_control): New static variable.
7162         (once_pointer, once_arg): New static variables.
7163         (c_run_once): New static function.
7164         (Once::Once, Once::run_once, Once::internal_run): New functions.
7165         (class Initialize_lock_once): Remove.
7166         (initialize_lock_control): Remove.
7167         (initialize_lock_pointer): Remove.
7168         (initialize_lock_once): Remove.
7169         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7170         (Initialize_lock::initialize): Rewrite.
7171         (Initialize_lock::do_run_once): New function.
7172         * archive.cc (Archive::interpret_header): Only clear name if it is
7173         not already empty.
7174         * fileread.cc: Include "gold-threads.h"
7175         (file_counts_lock): New static variable.
7176         (file_counts_initialize_lock): Likewise.
7177         (File_read::release): Only increment counts when using --stats.
7178         Use a lock around the increment.
7179         * parameters.cc (class Set_parameters_target_once): Define.
7180         (set_parameters_target_once): New static variable.
7181         (Parameters::Parameters): Move here from parameters.h.
7182         (Parameters::set_target): Rewrite.
7183         (Parameters::set_target_once): New function.
7184         (Parameters::clear_target): Move here and rewrite.
7185         * parameters.h (class Parameters): Update declarations.  Add
7186         set_parameters_target_once_ field.
7187         (Parameters::Parameters): Move to parameters.cc.
7188         (Parameters::clear_target): Likewise.
7189         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7190         task.
7191         (Start_group::~Start_group): New function.
7192         (Start_group::is_runnable): New function.
7193         (Start_group::locks, Start_group::run): New functions.
7194         (Finish_group::run): Change saw_undefined to size_t.
7195         * readsyms.h (class Start_group): Define.
7196         (class Finish_group): Change saw_undefined_ field to size_t.
7197         (Finish_group::Finish_group): Remove saw_undefined and
7198         this_blocker parameters.  Change all callers.
7199         (Finish_group::set_saw_undefined): New function.
7200         (Finish_group::set_blocker): New function.
7201         * symtab.h (class Symbol_table): Change saw_undefined to return
7202         size_t.  Change saw_undefined_ field to size_t.
7203         * target-select.cc (Set_target_once::do_run_once): New function.
7204         (Target_selector::Target_selector): Initialize set_target_once_
7205         field.  Don't initialize lock_ and initialize_lock_ fields.
7206         (Target_selector::instantiate_target): Rewrite.
7207         (Target_selector::set_target): New function.
7208         * target-select.h (class Set_target_once): Define.
7209         (class Target_selector): Update declarations.  Make
7210         Set_target_once a friend.  Remove lock_ and initialize_lock_
7211         fields.  Add set_target_once_ field.
7212
7213 2010-02-10  Ian Lance Taylor  <iant@google.com>
7214
7215         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7216         queueing any tasks.
7217         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7218         (queue_middle_tasks): Add all blockers before queueing any tasks.
7219         (queue_final_tasks): Likewise.
7220         * token.h (Task_token::add_blockers): New function.
7221         * object.h (Input_objects::number_of_relobjs): New function.
7222
7223 2010-02-10  Ian Lance Taylor  <iant@google.com>
7224
7225         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7226         shared, not if not position independent.
7227         * x86_64.cc (Relocate::relocate_tls): Likewise.
7228         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7229         (tls_pie_pic_test): New target.
7230         * testsuite/Makefile.in: Rebuild.
7231
7232         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7233         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7234         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7235         * testsuite/Makefile.in: Rebuild.
7236
7237 2010-02-09  David S. Miller  <davem@davemloft.net>
7238
7239         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7240         R_SPARC_RELATIVE using ->add_local_relative().
7241         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7242
7243         * output.h (Output_data_dynamic::add_section_size): New method
7244         that takes two Output_data objects.
7245         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7246         entry param.  Handle it in initializers.
7247         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7248         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7249         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7250         arg.
7251         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7252         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7253         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7254         for dynrel_includes_plt.
7255         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7256         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7257         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7258         before .rela.plt
7259         (Target_sparc::do_finalize_sections): Update to pass true for
7260         dynrel_includes_plt.
7261         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7262         output before .rela.plt
7263         (Target_powerpc::do_finalize_sections): Update to pass true for
7264         dynrel_includes_plt when 32-bit.
7265
7266 2010-02-08  Doug Kwan  <dougkwan@google.com>
7267
7268         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7269         method.
7270         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7271         Arm_relobj::scan_section_for_cortex_a8_stubs,
7272         Arm_relobj::do_relocation_section): Instead of calling
7273         Output_section::output_address, use faster
7274         Arm_relobj::simple_input_section_output_address.
7275
7276 2010-02-08  David S. Miller  <davem@davemloft.net>
7277
7278         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7279         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7280         relocation helper function.
7281
7282         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7283         just like R_SPARC_GOT{10,13,22}.
7284         (Target_sparc::Scan::local): Likewise.
7285         (Target_sparc::Relocate:relocate): Likewise.
7286
7287 2010-02-06  Ian Lance Taylor  <iant@google.com>
7288
7289         * configure.ac: Rewrite targetobjs duplicate removal code to use
7290         only shell constructs.
7291         * configure: Rebuild.
7292
7293 2010-02-05  Doug Kwan  <dougkwan@google.com>
7294
7295         PR 11247
7296         * arm.cc (Arm_relobj::section_is_scannable): New method.
7297         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7298         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7299
7300 2010-02-04  Doug Kwan  <dougkwan@google.com>
7301
7302         PR 11247
7303         * arm-reloc-property.cc (cstdio): Include.
7304         * configure.ac (targetobjs): Remove duplicates.
7305         * configure: Regenerate.
7306         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7307         big and little endian version for a given address size.
7308
7309 2010-02-03  Doug Kwan  <dougkwan@google.com>
7310
7311         * arm-reloc-property.cc
7312         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7313         definition.
7314         * arm-reloc-property.h
7315         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7316         New method definition.
7317         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7318         declaration.
7319         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7320         overflow to N.
7321         (GOT_PREL): Change implemented to Y.
7322         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7323         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7324         (Arm_relocate_functions::movw_abs_nc): Remove method.
7325         (Arm_relocate_functions::movt_abs): Ditto.
7326         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7327         (Arm_relocate_functions::thm_movt_abs): Ditto.
7328         (Arm_relocate_functions::movw_rel_nc): Ditto.
7329         (Arm_relocate_functions::movw_rel): Ditto.
7330         (Arm_relocate_functions::movt_rel): Ditto.
7331         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7332         (Arm_relocate_functions:thm_movw_rel): Ditto.
7333         (Arm_relocate_functions:thm_movt_rel): Ditto.
7334         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7335         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7336         New method definitions.
7337         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7338         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7339         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7340         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7341         (Target_arm::Relocate::relocate): Check for non-static or
7342         unimplemented relocation code and exit early.  Change calls to
7343         Target_arm::reloc_uses_thumb_bit and
7344         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7345         instead.  Refactor code to handle similar relocations to increase
7346         code sharing.  Remove check for unsupported relocation code in switch
7347         statement.
7348         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7349         relocation property table to find out size.  Change error message to
7350         print out the name of a relocation code instead of the numeric value.
7351         (Target_arm::scan_reloc_for_stub): Use relocation property table
7352         instead of calling Target_arm::reloc_uses_thumb_bit().
7353
7354 2010-02-02  Doug Kwan  <dougkwan@google.com>
7355
7356         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7357         types of relaxed input section.
7358
7359 2010-02-02  Doug Kwan  <dougkwan@google.com>
7360
7361         * Makefile.am (HFILES): Add arm-reloc-property.h.
7362         (DEFFILES): New.
7363         (TARGETSOURCES): Add arm-reloc-property.cc
7364         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7365         (libgold_a_SOURCES): $(DEFFILES)
7366         * Makefile.in: Regenerate.
7367         * arm-reloc-property.cc: New file.
7368         * arm-reloc-property.h: New file.
7369         * arm-reloc.def: New file.
7370         * arm.cc: Update comments.
7371         (arm-reloc-property.h): New included header.
7372         (arm_reloc_property_table): New global variable.
7373         (Target_arm::do_select_as_default_target): New method definition.
7374         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7375         arm-reloc-property to targ_extra_obj.
7376         * parameters.cc (set_parameters_target): Call
7377         Target::select_as_default_target().
7378         * target.h (Target::select_as_default_target): New method definition.
7379         (Target::do_select_as_default_target): Same.
7380
7381 2010-02-01  Doug Kwan  <dougkwan@google.com>
7382
7383         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7384         first_output_text_section_.
7385         (Arm_exidx_fixup::first_output_text_section): New method definition.
7386         (Arm_exidx_fixup::first_output_text_section_): New data member.
7387         (Arm_exidx_fixup::process_exidx_section): Record the first text
7388         output section seen.
7389         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7390         and entsize in output section header.
7391
7392 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7393
7394         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7395         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7396         (Arm_relocate_functions::thm_alu11): New Method.
7397         (Arm_relocate_functions::thm_pc8): New Method.
7398         (Arm_relocate_functions::thm_pc12): New Method.
7399         (Target_arm::Scan::local): Handle the relocations.
7400         (Target_arm::Scan::global): Likewise.
7401         (Target_arm::Relocate::relocate): Likewise.
7402         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7403
7404 2010-01-29  Doug Kwan  <dougkwan@google.com>
7405
7406         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7407         of relocation types as ld.
7408
7409 2010-01-29  Doug Kwan  <dougkwan@google.com>
7410
7411         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7412         to public.
7413         (Arm_relocate_functions::thumb_branch_common): Ditto.
7414         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7415         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7416         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7417         Arm_relocate_functions::jump24): Remove.
7418         (Target_arm::Relocate::relocate): Adjust code to call
7419         Arm_relocation_functions::arm_branch_common and
7420         Arm_relocation_functions::thumb_branch_common instead of their removed
7421         wrappers.  Merge switch-cases together to reduce source code size.
7422
7423 2010-01-29  Doug Kwan  <dougkwan@google.com>
7424
7425         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7426         output_local_symbol_count_needs_update_.
7427         (Arm_relobj::output_local_symbol_count_needs_update,
7428          Arm_relobj::set_output_local_symbol_count_needs_update,
7429          Arm_relobj::update_output_local_symbol_count): New methods.
7430         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7431         member.
7432         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7433         of pointed function as in a R_ARM_PREL31 relocation.
7434         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7435         for output local symbol count updating.
7436         (Target_arm::do_relax): Update output local symbol counts in objects
7437         if necessary.
7438         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7439
7440 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7441
7442         * arm.cc: Added support for the ARM relocations:
7443         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7444         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7445         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7446         movw_prel_nc).
7447         (Arm_relocate_functions::movw_rel): New method.
7448         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7449         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7450         thm_movw_prel_nc).
7451         (Arm_relocate_functions::thm_movw_rel): New method.
7452         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7453         thm_movt_prel).
7454         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7455         relocations.
7456         (Target_arm::Scan::global): Likewise.
7457         (Target_arm::Relocate::relocate): Likewise.
7458         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7459         Likewise.
7460
7461 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7462
7463         * arm.cc: Added support for ARM group relocations.
7464         (Target_arm::reloc_needs_sym_origin): New method.
7465         (Arm_relocate_functions::calc_grp_kn): New method.
7466         (Arm_relocate_functions::calc_grp_residual): New method.
7467         (Arm_relocate_functions::calc_grp_gn): New method.
7468         (Arm_relocate_functions::arm_grp_alu): New Method.
7469         (Arm_relocate_functions::arm_grp_ldr): New Method.
7470         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7471         (Arm_relocate_functions::arm_grp_ldc): New Method.
7472         (Target_arm::Scan::local): Handle the ARM group relocations.
7473         (Target_arm::Scan::global): Likewise.
7474         (Target_arm::Relocate::relocate): Likewise.
7475         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7476         Likewise.
7477
7478 2010-01-26  Doug Kwan  <dougkwan@google.com>
7479
7480         * arm.cc (set): Include.
7481         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7482         pointer type.
7483         (Arm_output_section::Text_section_list): New type.
7484         (Arm_output_section::append_text_sections_to_list): New method.
7485         (Arm_output_section::fix_exidx_coverage): Ditto.
7486         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7487         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7488         Relobj::set_section_offset() instead of
7489         Sized_relobj::invalidate_section_offset().
7490         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7491         parameter for section headers. Ignore relocation sections for
7492         unallocated sections and EXIDX sections.
7493         (Target_arm::fix_exidx_coverage): New method.
7494         (Target_arm::output_section_address_less_than): New type.
7495         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7496         linked text section instead of the EXIDX section.
7497         (Arm_output_section::create_stub_group): Add an assertion to check
7498         that this is not an EXIDX output section.
7499         (Arm_output_section::append_text_sections_to_list): New method.
7500         (Arm_output_section::fix_exidx_coverage): Ditto.
7501         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7502         Arm_relobj::section_needs_reloc_stub_scanning.
7503         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7504         first pass.
7505         (Target_arm::fix_exidx_coverage): New method.
7506         * object.h (Relobj::set_output_section): New method.
7507         (Sized_relobj::invalidate_section_offset): Remove method.
7508         (Sized_relobj::do_invalidate_section_offset): Remove method.
7509         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7510
7511 2010-01-25  Doug Kwan  <dougkwan@google.com>
7512
7513         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7514         Fix warning due to signed and unsigned comparison on a 32-bit host.
7515
7516 2010-01-22  Doug Kwan  <dougkwan@google.com>
7517
7518         * arm.cc (Target_arm::do_relax): Record an output section for section
7519         offset adjustment it contains any stub table that has changed.
7520         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7521         offsets in an output section if necessary.
7522         * output.cc (Output_section::Output_section): Initialize
7523         section_offsets_need_adjustments_.
7524         (Output_section::add_input_section_for_script): Renamed to
7525         Output_section::add_simple_input_section.
7526         (Output_section::save_states): Add a comment.
7527         (Output_section::discard_states): New method defintion.
7528         (Output_section::adjust_section_offsets): Same.
7529         * output.h (Output_section::add_input_section_for_script): Renamed to
7530         Output_section::add_simple_input_section.
7531         (Output_section::discard_states): New method declaration.
7532         (Output_section::adjust_section_offsets): Same.
7533         (Output_section::section_offsets_need_adjustment,
7534         Output_section::set_section_offsets_need_adjustment): New method
7535         definitions.
7536         (Output_section::section_offsets_need_adjustment_): New data member.
7537         * script-sections.cc
7538         (Output_section_element_input::set_section_address): Adjust code for
7539         renaming of Output_section::add_input_section_for_script.
7540         (Orphan_output_section::set_section_address): Same.
7541
7542 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7543
7544         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7545         Fix_v4bx enum values .
7546         * gold/options.h (General_options): New option definitions.
7547         (General_options::fix_v4bx): New method.
7548         (General_options::Fix_v4bx): New enum.
7549         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7550         (General_options::parse_fix_v4bx_interworking): New method.
7551
7552 2010-01-22  Doug Kwan  <dougkwan@google.com>
7553
7554         * arm.cc (Arm_exidx_fixup): New class.
7555
7556 2010-01-21  Doug Kwan  <dougkwan@google.com>
7557
7558         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7559         classes.
7560         (Arm_exidx_section_offset_map): New type.
7561
7562 2010-01-21  Doug Kwan  <dougkwan@google.com>
7563
7564         * arm.cc (Arm_exidx_input_section): New class.
7565         (Arm_relobj::exidx_input_section_by_link,
7566         Arm_relobj::exidx_input_section_by_shndx,
7567         Arm_relobj::make_exidx_input_section): New methods.
7568         (read_arm_attributes_section): Remove.
7569         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7570         information about them.
7571         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7572         to here.
7573
7574 2010-01-20  Doug Kwan  <dougkwan@google.com>
7575
7576         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7577         Input_section_specifier to Section_id.
7578         (Target_arm::new_arm_input_section: Adjust code for change of key
7579         type.
7580         (Target_arm::find_arm_input_section): Ditto.
7581         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7582         (Section_id): Remove.
7583         (Garbage_collection::Section_id_hash): Remove.
7584         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7585         (Section_id): Remove.
7586         (Icf::Section_id_hash): Remove.
7587         * object.h (Section_id, Const_section_id, Section_id_hash,
7588         Const_section_id_hash): New type definitions.
7589         * output.cc (Output_section::add_relaxed_input_section): Change to
7590         use Const_section_id instead of Input_section_specifier as key type.
7591         (Output_section::add_merge_input_section): Ditto.
7592         (Output_section::build_relaxation_map): Change to use Section_id
7593         instead of Input_section_specifier as key type.
7594         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7595         Ditto.
7596         (Output_section::convert_input_sections_to_relaxed_sections): Change
7597         to use Const_section_id instead of Input_section_specifier as key type.
7598         (Output_section::find_merge_section): Ditto.
7599         (Output_section::find_relaxed_input_section): Ditto.
7600         * output.h (Input_section_specifier): Remove class.
7601         (Output_section::Output_section_data_by_input_section_map): Change
7602         key type to Const_section_id.
7603         (Output_section::Output_relaxed_input_section_by_input_section_map):
7604         Ditto.
7605         (Output_section::Relaxation_map): Change key type to Section_id.
7606
7607 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7608
7609         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7610         (class Arm_v4bx_stub): New class.
7611         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7612         (Stub_factory::make_arm_v4bx_stub): New method.
7613         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7614         (Stub_table::empty): Handle v4bx stubs.
7615         (Stub_table::add_arm_v4bx_stub): New method.
7616         (Stub_table::find_arm_v4bx_stub): New method.
7617         (Arm_relocate_functions::v4bx): New method.
7618         (Target_arm::fix_v4bx): New method.
7619         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7620         (Stub_table::relocate_stubs): Likewise.
7621         (Stub_table::do_write): Likewise.
7622         (Stub_table::update_data_size_and_addralign): Likewise.
7623         (Stub_table::finalize_stubs):  Likewise.
7624         (Target_arm::Scan::local): Likewise.
7625         (Target_arm::Scan::global): Likewise.
7626         (Target_arm::do_finalize_sections): Likewise.
7627         (Target_arm::Relocate::relocate): Likewise.
7628         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7629         Likewise.
7630         (Target_arm::scan_reloc_for_stub): Likewise.
7631         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7632
7633 2010-01-19  Ian Lance Taylor  <iant@google.com>
7634
7635         * output.cc (Output_section_headers::do_sized_write): Write large
7636         segment count to sh_info field.
7637         (Output_file_header::do_sized_write): For large segment count,
7638         write PN_XNUM to e_phnum field.
7639
7640 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7641
7642         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7643         (Arm_relocate_functions::thm_jump8): New function.
7644         (Arm_relocate_functions::thm_jump11): New function.
7645         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7646         R_ARM_THM_JUMP11.
7647         (Target_arm::Scan::global): Likewise.
7648         (Target_arm::Relocate::relocate): Likewise.
7649         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7650         Likewise.
7651
7652 2010-01-14  Doug Kwan  <dougkwan@google.com>
7653
7654         * arm.cc (map, utility): Include headers.
7655         (Target_arm::apply_cortex_a8_workaround): New method.
7656         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7657         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7658         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7659         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7660         the --[no-]fix-cortex-a8 command line options.
7661         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7662         (Target_arm::relocate_stub): Use addend in instruction template.
7663         * options.h (DEFINE_bool): Set the user-set flag.
7664         (General_options): Add --[no-]-fix-cortex options.
7665         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7666         : Update fast look-up map after conversion.
7667
7668 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7669
7670         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7671         in the first pass of do_layout.
7672
7673 2010-01-13  Doug Kwan  <dougkwan@google.com>
7674
7675         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7676         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7677         apparent compiler problem of not folding static constant integral
7678         data members of elfcpp::Elf_sizes<32>.
7679
7680 2010-01-13  Doug Kwan  <dougkwan@google.com>
7681
7682         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7683         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7684         Arm_relobj::scan_section_for_cortex_a8_erratum,
7685         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7686         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7687         sections to scan for relocation stubs into a new method
7688         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7689         relocation and Cortex-A8 stub scanning.
7690         (Target_arm::do_relax): Force stubs to be after stubbed sections
7691         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7692         the beginning of a new relaxation pass.  Update a comment.
7693         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7694
7695 2010-01-12  Ian Lance Taylor  <iant@google.com>
7696
7697         * target-reloc.h (visibility_error): New inline function.
7698         (relocate_section): Call visibility_error.
7699         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7700         (MOSTLYCLEANFILES): Likewise.
7701         (protected_4_pic.o, protected_3.err): New targets.
7702         * testsuite/protected_4.cc: New file.
7703
7704 2010-01-12  Doug Kwan  <dougkwan@google.com>
7705
7706         * arm.cc (Cortex_a8_reloc): New class.
7707         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7708         and cortex_a8_relocs_info_.
7709         (Target_arm::fix_cortex_a8): New method definition.
7710         (Target_arm::Cortex_a8_relocs_info): New type.
7711         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7712         New data member declarations.
7713         (Target_arm::scan_reloc_for_stub): Record information about
7714         relocations for THUMB branches that might be exempted from the
7715         Cortex-A8 workaround.
7716         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7717         at the beginning of a relaxation pass.
7718
7719 2010-01-12  Doug Kwan  <dougkwan@google.com>
7720
7721         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7722         (Arm_relobj::Mapping_symbol_position,
7723          Arm_reloj::Mapping_symbol_position_less,
7724          Arm_relobj::Mapping_symbols_info): New types.
7725         (Target_arm::is_mapping_symbol_name): New method definition.
7726         (Arm_relobj::do_count_local_symbols): Save information about mapping
7727         symbols.
7728
7729 2010-01-11  Doug Kwan  <dougkwan@google.com>
7730
7731         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7732         Arm_relocate_functions::thumb32_branch_upper,
7733         Arm_relocate_functions::thumb32_branch_lower,
7734         Arm_relocate_functions::thumb32_cond_branch_offset,
7735         Arm_relocate_functions::thumb32_cond_branch_upper,
7736         Arm_relocate_functions::thumb32_cond_branch_lower,
7737         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7738         branch offset encoding.
7739         (Arm_relocate_functions::thumb_branch_common): Use new branch
7740         offset encoding methods to avoid code duplication.
7741         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7742         (Stub_addend_reader::operator()): Use new branch encoding method
7743         to avoid code duplication.
7744
7745 2010-01-11  Doug Kwan  <dougkwan@google.com>
7746
7747         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7748         (Target_arm::do_finalize_sections): Define special EXIDX section
7749         symbols only if referenced.
7750         * gc.h (Garbage_collection::add_reference): New method.
7751         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7752         code duplication.
7753
7754 2010-01-11  Ian Lance Taylor  <iant@google.com>
7755
7756         * script.cc (Version_script_info::build_expression_list_lookup):
7757         Change complaing about duplicate wildcard match from error to
7758         warning.
7759
7760         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7761         of 2009-12-30.
7762         (Version_script_info::Version_script_info): Initialize globs_,
7763         default_version_, default_is_global_, and exact_.  Don't
7764         initialize globals_ or locals_.
7765         (Version_script_info::build_lookup_tables): Build local symbols
7766         first.
7767         (Version_script_info::unquote): New function.
7768         (Version_script_info::add_exact_match): New function.
7769         (Version_script_info::build_expression_list_lookup): Remove lookup
7770         parameter.  Add is_global parameter.  Change all callers.  Handle
7771         wildcard pattern specially.  Unquote pattern.  Call
7772         add_exact_match.
7773         (Version_script_info::get_name_to_match): New function.
7774         (Version_script_info::get_symbol_version): New function.
7775         (Version_script_info::get_symbol_version_helper): Remove.
7776         (Version_script_info::check_unmatched_names): Call unquote.
7777         * script.h (class Version_script_info): Change get_symbol_version
7778         to be non-inline and add is_global parameter; change all callers.
7779         Rewrite symbol_is_local.  Update declarations.  Define struct
7780         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7781         Remove globals_ and locals_ members.  Add exact_, globs_,
7782         default_version_, is_global_.
7783         (Version_script_info::Glob): Remove pattern, add expression and
7784         is_global.  Update constructor.  Change all callers.
7785         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7786         default version.
7787         (Versions::symbol_section_contents): If a symbol is undefined, or
7788         defined in a dynamic object, set the version index to
7789         VER_NDX_LOCAL.
7790         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7791         symbol_is_local.
7792         (Symbol_table::add_from_pluginobj): Likewise.
7793         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7794
7795 2010-01-11  Doug Kwan  <dougkwan@google.com>
7796
7797         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7798         (incremental_dump_LDADD): Add linking option for libintl.
7799         * Makefile.in: Regenerate.
7800
7801 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7802
7803         PR gold/11144
7804         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7805         instead of -Ds.
7806         * testsuite/Makefile.in: Regenerated.
7807
7808 2010-01-10  Doug Kwan  <dougkwan@google.com>
7809
7810         * options.h (DEFINE_var): Use parentheses around argument varname__
7811         in macro body to avoid any unintended subsequent substitutions.
7812
7813 2010-01-10  Ian Lance Taylor  <iant@google.com>
7814
7815         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7816         candidates before doing symbol resolution.
7817
7818         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7819         ODR candidates if only one is weak.
7820
7821 2010-01-08  Ian Lance Taylor  <iant@google.com>
7822
7823         * script.cc (Version_script_info::build_expression_list_lookup):
7824         Don't warn about ambiguous version, just record the ambiguity.
7825         (Version_script_info::get_symbol_version_helper): Give error if
7826         version is ambiguous.
7827
7828 2010-01-08  Doug Kwan  <dougkwan@google.com>
7829
7830         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7831         prev_data_size_ and prev_addralign_.  Remove initializer for
7832         deleted data member has_been_changed_.
7833         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7834         to determine if the table is empty.
7835         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7836         Remove.
7837         (Stub_table::add_reloc_stub): Define method in class definition
7838         instead of just declaring it there.
7839         (Stub_table::add_cortex_a8_stub): New method definition.
7840         (Stub_table::update_data_size_and_addralign): Ditto.
7841         (Stub_table::finalize_stubs): Ditto.
7842         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7843         (Stub_table::do_addralign_): Return address alignment in the
7844         (Stub_table::do_reset_address_and_file_offset): Define method in
7845         class definition instead of declaring it there.  Set current data
7846         size to be the data size of the previous pass.
7847         (Stub_table::set_final_data_size): Use current data size as the
7848         final data size.
7849         (Stub_table::relocate_stub): Change parameter type of stub from
7850         Reloc_stub pointer to Stub pointer.
7851         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7852         (Stub_table::Cortex_a8_stub_list): New typedef.
7853         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7854          Stub_table::prev_addralign_): New data member.
7855         (Arm_relobj::Arm_relobj): Initialize data member
7856         section_has_cortex_a8_workaround_.
7857         (Arm_relobj::section_has_cortex_a8_workaround,
7858          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7859          definitions.
7860         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7861         declarations.
7862         (Target_arm::relocate_stub): Change parameter type of stub from
7863         Reloc_stub pointer to Stub pointer.
7864         (Insn_template::size, Insn_template::alignment): Handle
7865         THUMB16_SPECIAL_TYPE.
7866         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7867          Stub_table::update_data_size_and_addralign,
7868          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7869         definitions.
7870         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7871         (Stub_table::do_write): Ditto.
7872         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7873
7874 2010-01-08  Ian Lance Taylor  <iant@google.com>
7875
7876         PR 11108
7877         * symtab.h (class Symbol): Remove fields is_target_special_ and
7878         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7879         (Symbol::is_defined_in_discarded_section): New function.
7880         (Symbol::set_is_defined_in_discarded_section): New function.
7881         (Symbol::has_plt_offset): Rewrite.
7882         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7883         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7884         Don't initialize is_target_special_ or has_plt_offset_.
7885         Initialize is_defined_in_discarded_section_.
7886         (Symbol_table::add_from_relobj): If appropriate, set
7887         is_defined_in_discarded_section.
7888         * resolve.cc (Symbol::override_base_with_special): Don't test
7889         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7890         * target-reloc.h (relocate_section): Do special handling for
7891         symbols defined in discarded sections for global symbols as well
7892         as local symbols.
7893
7894 2010-01-08  Ian Lance Taylor  <iant@google.com>
7895
7896         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7897         the SHT_SYMTAB case.
7898
7899 2010-01-08  Ian Lance Taylor  <iant@google.com>
7900
7901         * object.cc (Sized_relobj::do_layout): Don't get confused if
7902         layout_eh_frame returns NULL.
7903
7904 2010-01-08  Ian Lance Taylor  <iant@google.com>
7905
7906         PR 11084
7907         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7908         dynamic symbol table, use the normal symbol table.
7909         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7910         symbol table.
7911
7912 2010-01-08  Ian Lance Taylor  <iant@google.com>
7913
7914         PR 11072
7915         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7916         sections.
7917
7918 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7919
7920         * version.cc (print_version): Change to "Copyright 2010".
7921
7922 2010-01-08  Ian Lance Taylor  <iant@google.com>
7923
7924         PR 10287
7925         PR 11063
7926         * i386.cc (class Target_i386): Change return type of plt_section
7927         to be non-const.
7928         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7929         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7930         tls_desc_rel_ field.
7931         (Output_data_plt_i386::rel_tls_desc): New function.
7932         (Target_i386::rel_tls_desc_section): New function.
7933         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7934         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7935         R_386_TLS_DESC reloc in rel_tls_desc_section.
7936         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7937         Define struct Tlsdesc_info.
7938         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7939         (Target_x86_64::do_reloc_symbol_index): New function.
7940         (Target_x86_64::add_tlsdesc_info): New function.
7941         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7942         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7943         tlsdesc_rel_ field.
7944         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7945         all callers.
7946         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7947         (Target_x86_64::rela_tlsdesc_section): New function.
7948         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7949         handling.
7950         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7951         (Target_x86_64::do_reloc_addend): New function.
7952         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7953         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7954         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7955         (Output_reloc::type): New function.
7956         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7957         (Output_reloc::is_target_specific): New function.
7958         (Output_reloc::target_arg): New function.
7959         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7960         absolute relocs and target specific relocs.
7961         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7962         add_target_specific.
7963         (class Output_data_reloc) [SHT_RELA]: Likewise.
7964         * output.cc (Output_reloc::Output_reloc): Add four new versions
7965         for absolute relocs and target specific relocs.
7966         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7967         (Output_reloc::get_symbol_index): Likewise.
7968         (Output_reloc::local_section_offset): Check that local_sym_index_
7969         is not TARGET_CODE or 0.
7970         (Output_reloc::symbol_value): Likewise.
7971         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7972         reloc.
7973         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7974         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7975         functions.
7976         * layout.cc (add_target_dynamic_tags): Use output section for
7977         DT_PLTRELSZ and DT_JMPREL.
7978
7979 2010-01-07  Ian Lance Taylor  <iant@google.com>
7980
7981         PR 11061
7982         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7983         function.
7984         (class Output_data_reloc_generic): Define.
7985         (class Output_data_reloc_base): Change base class to
7986         Output_data_reloc_generic.  Change add() method to call
7987         bump_relative_reloc_count for a relative reloc.  Remove
7988         sort_relocs_ field.
7989         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7990         to sort_relocs().
7991         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7992         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7993         appropriate.
7994         * layout.h (class Layout): Update declaration.
7995
7996 2010-01-07  Ian Lance Taylor  <iant@google.com>
7997
7998         * output.h (class Output_data): Add const version of
7999         output_section and do_output_section.
8000         (class Output_section_data): Add const version of
8001         do_output_section.
8002         (class Output_section): Likewise.
8003         * layout.cc (Layout::add_target_dynamic_tags): New function.
8004         * layout.h (class Layout): Update declarations.
8005         * arm.cc (Target_arm::do_finalize_sections): Use
8006         add_target_dynamic_tags.
8007         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8008         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8009         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8010         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8011
8012 2010-01-07  Ian Lance Taylor  <iant@google.com>
8013
8014         PR 11042
8015         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8016         object as needed.
8017
8018 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8019             Ian Lance Taylor  <iant@google.com>
8020
8021         PR 11019
8022         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8023         Xindex::read_symtab_xindex.
8024
8025 2010-01-07  Doug Kwan  <dougkwan@google.com>
8026
8027         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8028         (Insn_template::thumb16_bcond_insn): New method declaration.
8029         (Insn_template): Fix spelling.
8030         (Stub::thumb16_special): New method declaration.
8031         (Stub::do_write): Define virtual method which was previously pure
8032         virtual.
8033         (Stub::do_thumb16_special): New method declaration.
8034         (Stub::do_fixed_endian_write): New template member.
8035         (Reloc_stub::do_write): Remove.
8036         (Reloc_stub::do_fixed_endian_write): Remove.
8037         (Cortex_a8_stub): New class definition.
8038         (Stub_factory::make_cortex_a8_stub): New method definition.
8039         (Stub_factory::Stub_factory): Add missing static storage class
8040         qualifier for elf32_arm_stub_a8_veneer_blx.
8041
8042 2010-01-07  Ian Lance Taylor  <iant@google.com>
8043
8044         PR 10980
8045         * options.h (class General_options): Add --warn-unresolved-symbols
8046         and --error-unresolved-symbols.
8047         * errors.cc (Errors::undefined_symbol): Implement
8048         --warn-unresolved-symbols.
8049
8050         * options.h (class General_options): Add -z text and -z textoff.
8051         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8052
8053 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8054
8055         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8056         (Garbage_collection::cident_sections): New function.
8057         (Garbage_collection::add_cident_section): New function.
8058         (Garbage_collection::cident_sections_): New member.
8059         (gc_process_relocs): Add references to sections whose names are C
8060         identifiers.
8061         * gold.h (cident_section_start_prefix): New constant.
8062         (cident_section_stop_prefix): New constant.
8063         (is_cident): New function.
8064         * layout.cc (Layout::define_section_symbols): Replace string constants
8065         with the newly defined constants.
8066         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8067         C identifiers.
8068         * testsuite/Makefile.am: Add gc_orphan_section_test.
8069         * testsuite/Makefile.in: Regenerate.
8070         * testsuite/gc_orphan_section_test.cc: New file.
8071         * testsuite/gc_orphan_section_test.sh: New file.
8072
8073 2010-01-06  Ian Lance Taylor  <iant@google.com>
8074
8075         PR 10980
8076         * options.h (class General_options): Add --warn-shared-textrel.
8077         * layout.cc (Layout::finish_dynamic_section): Implement
8078         --warn-shared-textrel.
8079
8080         PR 10980
8081         * options.h (class General_options): Add --warn-multiple-gp.
8082
8083 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8084
8085         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8086         $(THREADSLIB) and $(LIBDL).
8087         * Makefile.in: Rebuild.
8088
8089 2010-01-06  Ian Lance Taylor  <iant@google.com>
8090
8091         PR 10980
8092         * options.cc (General_options::parse_section_start): New function.
8093         (General_options::section_start): New function.
8094         (General_options::General_options): Initialize all members.
8095         * options.h: Include <map>
8096         (class General_options): Add --section-start.  Add section_starts_
8097         member.
8098         * layout.cc (Layout::attach_allocated_section_to_segment): If
8099         --section-start was used, set the address of the segment.  Remove
8100         local sort_sections.
8101         (Layout::relaxation_loop_body): If the address of the load segment
8102         has been set by --section-start, don't use it.
8103         * output.h (Output_segment::update_flags_for_output_section): New
8104         function.
8105         * output.cc (Output_segment::add_output_section): Call
8106         update_flags_for_output_section.
8107
8108 2010-01-05  Ian Lance Taylor  <iant@google.com>
8109
8110         PR 10980
8111         * options.h (class General_options): Add --undefined-version.
8112         * script.cc (struct Version_expression): Add was_matched_by_symbol
8113         field.
8114         (Version_script_info::matched_symbol): New function.
8115         (Version_script_info::get_symbol_version_helper): Call
8116         matched_symbol.
8117         (Version_script_info::check_unmatched_names): New function.
8118         * script.h (class Version_script_info): Update declarations.
8119         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8120
8121         * options.h (class General_options): Use DEFINE_bool_alias for
8122         allow_multiple_definition.
8123         * resolve.cc (Symbol_table::should_override): Don't test
8124         allow_multiple_definition.
8125
8126         PR 10980
8127         * options.h (class General_options): Add --cref.
8128         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8129         until after printing cref table.
8130         * cref.cc: Include "symtab.h".
8131         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8132         (Cref_table_compare::operator()): New function.
8133         (Cref_inputs::gather_cref): New function.
8134         (filecol): New static const.
8135         (Cref_inputs::print_cref): New function.
8136         (Cref::print_cref): New function.
8137         * cref.h: Include <cstdio>.
8138         (class Cref): Update declarations.
8139         * mapfile.h (Mapfile::file): New function.
8140         * object.h (class Object): Define Symbols.  Declare virtual
8141         do_get_global_symbols.
8142         (Object::get_global_symbols): New function.
8143         * object.cc (Input_objects::add_object): Pass object to cref_ if
8144         --cref.
8145         (Input_objects::archive_start): Likewise.
8146         (Input_objects::archive_stop): Likewise.
8147         (Input_objects::print_cref): New function.
8148         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8149         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8150         --cref.
8151         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8152         function.
8153         * plugin.h (class Sized_pluginobj): Update declarations.
8154
8155 2010-01-05  Ian Lance Taylor  <iant@google.com>
8156
8157         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8158         to is_default_version.  Rename insdef to insdefault.
8159         (Symbol_table::add_from_relobj): Rename def to is_default_version
8160         and local to is_forced_local.
8161         (Symbol_table::add_from_pluginobj): Likewise.
8162         (Symbol_table::add_from_dynobj): Likewise.
8163         (Symbol_table::define_special_symbol): Rename insdef to
8164         insdefault.
8165
8166 2010-01-04  Ian Lance Taylor  <iant@google.com>
8167
8168         PR 10980
8169         * options.h (class General_options): Add
8170         --allow-multiple-definition and -z muldefs.
8171         * resolve.cc (Symbol_table::should_override): Don't warn about a
8172         multiple symbol definition if --allow-multiple-definition or -z
8173         muldefs.
8174
8175         PR 10980
8176         * options.h (class General_options): Add --add-needed and
8177         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8178         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8179         error if --copy-dt-needed-entries aka --add-needed is used and
8180         would cause a change in behaviour.
8181
8182         PR 10980
8183         * options.h (class General_options): Add -G as a short version of
8184         --shared.  Add no-op options -assert, -g, and -i.
8185
8186 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8187
8188         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8189         check for .text or .gnu.linkonce.t sections.
8190         * icf.cc (Icf::find_identical_sections): Ditto.
8191         Change the detection for mangled function name within the section
8192         name.
8193         * icf.h (is_section_foldable_candidate): New function.
8194
8195 2009-12-30  Ian Lance Taylor  <iant@google.com>
8196
8197         PR 10980
8198         * options.h (class General_options): Permit two dashes with
8199         --retain-symbols-file.
8200
8201 2009-12-30  Ian Lance Taylor  <iant@google.com>
8202
8203         PR 10979
8204         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8205         don't put the file header and segment headers in the text
8206         segment.
8207
8208         PR 10979
8209         * common.cc (Sort_commons::operator()): Stabilize sort when both
8210         entries are NULL.
8211         (Symbol_table::do_allocate_commons_list): When allocating common
8212         symbols, skip a symbol which is no longer common.
8213         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8214         an object before checking its type.
8215         * testsuite/common_test_2.c: New file.
8216         * testsuite/common_test_3.c: New file.
8217         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8218         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8219         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8220         (common_test_2_pic.o, common_test_2.so): New targets.
8221         (common_test_3_pic.o, common_test_3.so): New targets.
8222         * testsuite/Makefile.in: Rebuild.
8223
8224         PR 10979
8225         * script.cc (read_input_script): If we see a new SECTIONS clause,
8226         and we have added an input section, give an error.
8227         * layout.h (class Layout): Add have_added_input_section function.
8228         Add have_added_input_section_ field.
8229         * layout.cc (Layout::Layout): Initialize
8230         have_added_input_section_.
8231         (Layout::layout): Set have_added_input_section_.
8232         (Layout::layout_eh_frame): Likewise.
8233
8234 2009-12-30  Ian Lance Taylor  <iant@google.com>
8235
8236         PR 10931
8237         * options.h (class General_options): Add --sort-common option.
8238         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8239         * common.cc (Sort_common): Add sort_order parameter to
8240         constructor.  Add sort_order_ field.
8241         (Sort_commons::operator): Check sort_order_.
8242         (Symbol_table::allocate_commons): Determine the sort order.
8243         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8244         Change all callers.
8245         (Symbol_table::do_allocate_commons_list): Likewise.
8246
8247 2009-12-30  Ian Lance Taylor  <iant@google.com>
8248
8249         PR 10916
8250         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8251         symbols from this object, don't change the visibility of an
8252         undefined symbol.
8253         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8254
8255 2009-12-30  Ian Lance Taylor  <iant@google.com>
8256
8257         PR 10861
8258         * script.h (class Version_script_info): Define Language enum.
8259         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8260         new fields globals_, locals_, and is_finalized_.
8261         * script.cc: Various formatting fixes.
8262         (class Parser_closure): Change language_stack_ from a vector of
8263         std::string to one of Version_script_info::Language.  Adjust all
8264         uses accordingly.
8265         (class Lazy_demangler): Remove.
8266         (struct Version_expression): Change language from std::string to
8267         Version_script_info::Language.
8268         (Version_script_info::Version_script_info): New function.
8269         (Version_script_info::~Version_script_info): Don't call clear.
8270         (Version_script_info::finalize): New function.
8271         (Version_script_info::build_lookup_tables): New function.
8272         (Version_script_info::build_expression_list_lookup): New
8273         function.
8274         (Version_script_info::get_symbol_version_helper): Rewrite to use
8275         lookup tables.
8276         (Version_script_info::print_expression_list): Adjust to use
8277         Version_script_info::Language.
8278         (script_push_lex_into_version_mode): Check that the version script
8279         has not been finalized.
8280         (version_script_push_lang): Change language string to
8281         Version_script_info::Language.
8282         * options.cc (Command_line::version_script): New function.
8283         * options.h (class General_options): Add finalize_dynamic_list
8284         function.  Change version_script from declaration to definition.
8285         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8286         * testsuite/version_script.map: Remove duplicate def of foo.
8287         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8288         version_script.map.
8289         * testsuite/Makefile.in: Rebuild.
8290
8291 2009-12-30  Ian Lance Taylor  <iant@google.com>
8292
8293         PR 10843
8294         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8295         if the input symbol index is 0, make the output symbol index 0.
8296
8297 2009-12-30  Ian Lance Taylor  <iant@google.com>
8298
8299         PR 10670
8300         * options.h (class General_options): Add -x/--discard-all.
8301         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8302         --discard-all.  If the local symbol needs a dynamic entry, check
8303         that before handling --discard-locals.
8304
8305 2009-12-30  Ian Lance Taylor  <iant@google.com>
8306
8307         PR 10450
8308         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8309         flags to PF_R.
8310         (Output_segment::add_output_section): Don't change the flags if
8311         the type is PT_TLS.
8312
8313         PR 10450
8314         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8315         GNU hash table if they need a dynamic value.  Otherwise, don't add
8316         them if they are defined in a dynamic object or are forced local.
8317
8318 2009-12-29  Ian Lance Taylor  <iant@google.com>
8319
8320         PR 10450
8321         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8322         .gnu.hash table for a 32-bit target.
8323
8324         PR 10450
8325         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8326         regular and a dynamic object only needs a dynamic symbol table
8327         entry if it is externally visible.
8328
8329         PR 10450
8330         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8331         constructor.  Add global_offset_table_ field.
8332         (Target_i386::got_section): Set global_offset_table_.
8333         (Target_i386::do_finalize_sections): Set global_offset_table_
8334         size.
8335         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8336         in constructor.  Add global_offset_table_ field.
8337         (Target_x86_64::got_section): Set global_offset_table_.
8338         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8339         size.
8340
8341         * layout.cc (Layout::Layout): Initialize increase_relro_.
8342         (Layout::get_output_section): Add is_relro, is_last_relro, and
8343         is_first_non_relro parameters.  Change all callers.
8344         (Layout::choose_output_section): Likewise.
8345         (Layout::add_output_section_data): Likewise.
8346         (Layout::make_output_section): Likewise.
8347         (Layout::set_segment_offsets): Clear increase_relro when using a
8348         linker script.
8349         * layout.h (class Layout): Add increase_relro method.  Add
8350         increase_relro_ field.  Update declarations.
8351         * output.cc (Output_section::Output_section): Initialize
8352         is_last_relro_ and is_first_non_relro_.
8353         (Output_segment::add_output_section): Group relro sections is
8354         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8355         (Output_segment::maximum_alignment): Remove relro handling.
8356         (Output_segment::set_section_addresses): Add increase_relro
8357         parameter.  Change all callers.  Add initial alignment to align
8358         relro sections on separate page.  Remove old relro handling.
8359         (Output_segment::set_section_list_addresses): Remove in_relro
8360         parameter.  Change all callers.
8361         (Output_segment::set_offset): Add increase parameter.  Change all
8362         callers.  Remove old relro handling.
8363         * output.h (class Output_section): Add new methods: is_last_relro,
8364         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8365         Add is_last_relro_ and is_first_non_relro_ fields.
8366         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8367         Create separate .got.plt section.  Call increase_relro.
8368         * x86_64.cc (Target_x86_64::got_section): Likewise.
8369         * testsuite/relro_script_test.t: Add .got.plt.
8370
8371         PR 10450
8372         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8373         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8374         (Layout::finalize): Call set_dynamic_symbol_size.
8375         (Layout::set_dynamic_symbol_size): New function.
8376         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8377         set_dynamic_symbol_size.
8378
8379         PR 10450
8380         * output.h (class Output_section): Add is_entsize_zero_ field.
8381         * output.cc (Output_section::Output_section): Initialize
8382         is_entsize_zero_.
8383         (Output_section::set_entsize): If two different entsizes are
8384         requested, force it to zero.
8385         (Output_section::add_input_section): Set flags for .debug_str
8386         before updating section flags.  Set entsize.
8387         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8388         and SHF_STRING if all input sections have those flags.
8389
8390 2009-12-29   Rafael Espindola  <espindola@google.com>
8391
8392         * main.cc (main): Fix the sys time reporting.
8393         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8394         reporting.
8395
8396 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8397
8398         * options.cc (General_options::parse_version): Allow -v to exit
8399         without an error if there is nothing to link.
8400
8401 2009-12-29  Ian Lance Taylor  <iant@google.com>
8402
8403         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8404         using a version of gcc before 4.1.
8405         * configure: Rebuild.
8406
8407 2009-12-28  Chris Demetriou  <cgd@google.com>
8408
8409         * attributes.cc (Output_attributes_section_data::do_write): Use
8410         std::vector::front rather than std::vector::data.
8411
8412 2009-12-28  Ian Lance Taylor  <iant@google.com>
8413
8414         * symtab.h (class Symbol_table): Add enum Defined.
8415         * resolve.cc (Symbol_table::should_override): Add defined
8416         parameter.  Change all callers.  Test whether object is NULL
8417         before calling a method on it.
8418         (Symbol_table::report_resolve_problem): Add defined parameter.
8419         Change all callers.
8420         (Symbol_table::should_override_with_special): Likewise.
8421         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8422         parameter.  Change all callers.
8423         (Symbol_table::do_define_in_output_data): Likewise.
8424         (Symbol_table::define_in_output_segment): Likewise.
8425         (Symbol_table::do_define_in_output_segment): Likewise.
8426         (Symbol_table::define_as_constant): Likewise.
8427         (Symbol_table::do_define_as_constant): Likewise.
8428         * script.h (class Symbol_assignment): Add is_defsym parameter to
8429         constructor; change all callers.
8430         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8431         parameter.  Change all callers.  Add is_defsym_ field.
8432         (class Parser_closure): Add parsing_defsym parameter to
8433         constructor; change all callers.  Add parsing_defsym accessor
8434         function.  Add parsing_defsym_ field.
8435
8436 2009-12-28  Ian Lance Taylor  <iant@google.com>
8437
8438         * gold.cc (queue_middle_tasks): Fix formatting.
8439         * object.cc (Relobj::is_section_name_included): Likewise.
8440
8441 2009-12-23  Ian Lance Taylor  <iant@google.com>
8442
8443         * i386.cc (Target_i386::do_calls_non_split): Recognize
8444         -fsplit-stack prologue for a function with a static chain.
8445         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8446         -fsplit-stack prologue when using %r11.
8447
8448 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8449
8450         * options.cc (General_options::parse_version): Make -v continue and do
8451         the link like GNU ld does.
8452
8453 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8454
8455         * Makefile.am (CCFILES): Add timer.cc.
8456         (HFILES): Add timer.h.
8457         * configure.ac: Check for sysconf and times.
8458         * main.cc: include timer.h.
8459         (main): Use Timer instead of get_run_time.
8460         * timer.cc: New.
8461         * timer.h: New.
8462         * workqueue.cc: include timer.h.
8463         (Workqueue::find_and_run_task):
8464         Report user, sys and wall time.
8465         * Makefile.in: Regenerate.
8466         * config.in: Regenerate.
8467         * configure: Regenerate.
8468
8469 2009-12-16  Doug Kwan  <dougkwan@google.com>
8470
8471         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8472         sections.
8473         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8474         relaxed input sections.
8475         * output.cc (Output_section::find_relaxed_input_section): Change
8476         return type to Output_relaxed_input_section pointer.  Adjust code
8477         for new type of relaxed_input_section_map_.
8478         * output.h (Output_section::find_relaxed_input_section): Change
8479         return type to Output_relaxed_input_section pointer.
8480         (Output_section::Output_relaxed_input_section_by_input_section_map):
8481         New type.
8482         (Output_section::relaxed_input_section_map_): Change type to
8483         Output_section::Output_relaxed_input_section_by_input_section_map.
8484         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8485         input section.
8486
8487 2009-12-15  Ian Lance Taylor  <iant@google.com>
8488
8489         * layout.cc (Layout::create_shstrtab): Only write out after input
8490         sections if we are compressing debug sections.
8491
8492 2009-12-15  Ian Lance Taylor  <iant@google.com>
8493
8494         * archive.cc (Archive::add_symbols): Only look up a symbol without
8495         a version if there is, in fact, a version.
8496
8497 2009-12-14  Ian Lance Taylor  <iant@google.com>
8498
8499         Revert -Wshadow changes, all changes from:
8500         2009-12-11  Doug Kwan  <dougkwan@google.com>
8501         2009-12-11  Nick Clifton  <nickc@redhat.com>
8502         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8503
8504 2009-12-11  Doug Kwan  <dougkwan@google.com>
8505
8506         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8507         due to -Wshadow.
8508         * attributes.cc (Object_attribute::size): Ditto.
8509         (Attributes_section_data::size): Ditto.
8510         (Attributes_section_data::Attributes_section_data): Ditto.
8511         (Output_attributes_section_data::do_write): Ditto.
8512         * attributes.h (Object_attribute::set_type): Ditto.
8513         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8514
8515 2009-12-11  Nick Clifton  <nickc@redhat.com>
8516
8517         * archive.cc: Fix shadowed variable warnings.
8518         * arm.cc: Likewise.
8519         * compressed_output.cc: Likewise.
8520         * compressed_output.h: Likewise.
8521         * configure: Likewise.
8522         * dwarf_reader.cc: Likewise.
8523         * dynobj.cc: Likewise.
8524         * dynobj.h: Likewise.
8525         * ehframe.cc: Likewise.
8526         * ehframe.h: Likewise.
8527         * errors.cc: Likewise.
8528         * expression.cc: Likewise.
8529         * fileread.cc: Likewise.
8530         * fileread.h: Likewise.
8531         * freebsd.h: Likewise.
8532         * i386.cc: Likewise.
8533         * icf.cc: Likewise.
8534         * incremental.h: Likewise.
8535         * layout.cc: Likewise.
8536         * layout.h: Likewise.
8537         * mapfile.cc: Likewise.
8538         * merge.cc: Likewise.
8539         * merge.h: Likewise.
8540         * object.cc: Likewise.
8541         * object.h: Likewise.
8542         * options.h: Likewise.
8543         * output.cc: Likewise.
8544         * output.h: Likewise.
8545         * parameters.cc: Likewise.
8546         * plugin.cc: Likewise.
8547         * powerpc.cc: Likewise.
8548         * reduced_debug_output.cc: Likewise.
8549         * reduced_debug_output.h: Likewise.
8550         * reloc.cc: Likewise.
8551         * reloc.h: Likewise.
8552         * resolve.cc: Likewise.
8553         * script-sections.cc: Likewise.
8554         * script.cc: Likewise.
8555         * script.h: Likewise.
8556         * sparc.cc: Likewise.
8557         * symtab.cc: Likewise.
8558         * symtab.h: Likewise.
8559         * target-select.cc: Likewise.
8560         * target-select.h: Likewise.
8561         * token.h: Likewise.
8562         * workqueue.cc: Likewise.
8563         * workqueue.h: Likewise.
8564         * x86_64.cc: Likewise.
8565
8566 2009-12-10  Doug Kwan  <dougkwan@google.com>
8567
8568         * arm.cc (attributes.h): New include.
8569         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8570         (Arm_relobj::~Arm_relobj): Delete object pointed by
8571         attributes_section_data_.
8572         (Arm_relobj::attributes_section_data): New method definition.
8573         (Arm_relobj::attributes_section_data_): New data member declaration.
8574         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8575         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8576         attributes_section_data_.
8577         (Arm_dynobj::attributes_section_data): New method definition.
8578         (Arm_dynobj::attributes_section_data_): New data member declaration.
8579         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8580         initialization value of may_use_blx_ to false.
8581         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8582         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8583         object attributes to compute results instead of hard-coding.
8584         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8585         Target_arm::get_secondary_compatible_arch,
8586         Target_arm::set_secondary_compatible_arch
8587         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8588         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8589         New method declarations.
8590         (Target_arm::get_aeabi_object_attribute): New method definition.
8591         (Target_arm::attributes_section_data_): New data member declaration.
8592         (read_arm_attributes_section): New template definition.
8593         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8594         (Arm_dynobj::do_read_symbols): Ditto.
8595         (Target_arm::do_finalize_sections): Merge attributes sections from
8596         input.  Check for BLX use after attributes section merging.
8597         Fix __exidx_start and __exidx_end visibility.  Create an
8598         .ARM.attributes section if necessary.
8599         (Target_arm::get_secondary_compatible_arch,
8600         Target_arm::set_secondary_compatible_arch,
8601         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8602         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8603         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8604         New method definitions.
8605
8606 2009-12-09  Ian Lance Taylor  <iant@google.com>
8607
8608         * plugin.cc (Plugin::load): Don't cast from void* to a function
8609         pointer.
8610
8611 2009-12-09  Ian Lance Taylor  <iant@google.com>
8612
8613         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8614         information fields.
8615
8616 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8617
8618         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8619         Replace two_file_shared_1.so with two_file_shared_2.so.
8620         * testsuite/Makefile.in: Regenerated.
8621
8622 2009-12-08  Doug Kwan  <dougkwan@google.com>
8623
8624         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8625         (HFILES): Add attributes.h and int_encoding.h.
8626         * Makefile.in: Regenerate.
8627         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8628         function definitions to int_encoding.cc
8629         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8630         prototypes to int_encoding.h
8631         * reduced_debug_output.cc (int_encoding.h): New include.
8632         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8633         function definitions to int_encoding.cc
8634         (insert_into_vector, read_from_pointer): Move template definitions to
8635         int_encoding.h
8636         * attributes.cc: New file.
8637         * attributes.h: New file.
8638         * int_encoding.cc: New file.
8639         * int_encoding.h: New file.
8640
8641 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8642
8643         PR gold/11055
8644         * incremental-dump.cc (dump_incremental_inputs): New.
8645         (main): Use dump_incremental_inputs.
8646
8647 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8648
8649         PR gold/10893
8650         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8651         checking elfcpp::STT_FUNC.
8652         (Target_i386::Relocate::relocate): Likewise.
8653         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8654
8655         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8656         symbols from shared libraries into normal FUNC symbols.
8657
8658         * symtab.h (Symbol): Add is_func and use it.
8659
8660 2009-12-05  Doug Kwan  <dougkwan@google.com>
8661
8662         * arm.cc (Target_arm::arm_info): Initialize new fields
8663         attributes_section and attributes_vendor.
8664         * i386.cc (Target_i386::i386_info): Same.
8665         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8666         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8667         fields attributes_section and attributes_vendor.
8668         * sparc.cc (Target_sparc::sparc_info): Same.
8669         * target.h (Target::attributes_section, Target::attributes_vendor,
8670         Target::is_attributes_section, Target::attribute_arg_type,
8671         Target::attributes_order): New method definitions.
8672         (Target::Target_info::attributes_section,
8673         Target::Target_info::attributes_vendor): New fields.
8674         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8675         virtual method definitions.
8676         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8677         attributes_section and attributes_vendor.
8678         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8679
8680 2009-12-05  Doug Kwan  <dougkwan@google.com>
8681
8682         * arm.cc: Update comments about interworking and stub generation.
8683         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8684         considered as non-PIC.
8685         (Arm_relocate_functions::base_abs): Fix formatting.
8686         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8687         of function to use GOT entry address instead of offset.
8688         (Target_arm::Scan::global): Issue an error if a symbol would need a
8689         PLT does not get one because it is untyped.  Remove code to create
8690         dynamic symbols for relative branches.
8691         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8692         takes unsigned integer instead of boolean.
8693
8694 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8695
8696         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8697         (two_file_test_LDADD): Likewise.
8698         (common_test_1_LDADD): Likewise.
8699         (exception_test_LDADD) Likewise.
8700         (weak_test_LDADD): Likewise.
8701         (many_sections_test_LDADD): Likewise.
8702         (initpri1_LDADD): Likewise.
8703         (script_test_1_LDADD): Likewise.
8704         (script_test_2_LDADD): Likewise.
8705         (justsyms_LDADD): Likewise.
8706         (binary_test_LDADD): Likewise.
8707         (large_LDADD): Likewise.
8708         * testsuite/Makefile.in: Regenerated.
8709
8710 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8711
8712         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8713         (Symbol_table::override_with_special): Likewise.
8714         (Symbol_table::add_from_object): Likewise.
8715
8716 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8717
8718         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8719         Don't set the data_offset twice.
8720
8721 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8722
8723         * testsuite/Makefile.in: Regenerate.
8724
8725 2009-12-03  Doug Kwan  <dougkwan@google.com>
8726
8727         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8728         (Target_arm::do_finalize_sections): Add parameter for symbol table
8729         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8730         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8731         parameter for symbol table pointer.
8732         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8733         an additional parameter for a pointer to symbol table.
8734         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8735         parameter for a symbol table pointer.
8736         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8737         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8738         Ditto.
8739         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8740         parameter for a symbol table pointer.
8741
8742 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8743
8744         * incremental.cc (Incremental_inputs_header)
8745         (Incremental_inputs_header_write, Incremental_inputs_entry)
8746         (Incremental_inputs_entry_write): Move ...
8747         * incremental.h (Incremental_inputs_header)
8748         (Incremental_inputs_header_write, Incremental_inputs_entry)
8749         (Incremental_inputs_entry_write): here.
8750
8751 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8752
8753         * incremental.cc (make_sized_incremental_binary): Set the target.
8754         Error if it is incompatible.
8755         * output.h (Output_file): Add filename method.
8756
8757 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8758
8759         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8760         from the get_* methods.
8761
8762 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8763
8764         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8765         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8766         Write 0 for the data_offset of scripts.
8767
8768 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8769
8770         * testsuite/Makefile.am: Add the incremental_test.sh test.
8771         * testsuite/incremental_test.sh: New.
8772         * testsuite/incremental_test_1.c: New.
8773         * testsuite/incremental_test_2.c: New.
8774
8775 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8776
8777         * incremental-dump.cc (main): Fix typos.
8778
8779 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8780
8781         PR gold/11025
8782         * incremental-dump.cc (main): Use llu to print 64 bit values.
8783
8784 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8785             H.J. Lu  <hongjiu.lu@intel.com>
8786
8787         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8788         $(LIBDL).
8789         (incremental_dump_LDADD): Likewise.
8790         * Makefile.in: Regenerated.
8791
8792 2009-11-25  Doug Kwan  <dougkwan@google.com>
8793
8794         Revert:
8795
8796         2009-11-25  Doug Kwan  <dougkwan@google.com>
8797
8798                 * arm.cc (Target_arm::Target_arm): Move method definition
8799                 outside of class definition.  Add code to handle
8800                 --target1-rel, --target1-abs and --target2= options.
8801                 (Target_arm::get_reloc_reloc_type): Change method to be
8802                 non-static and const.
8803                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8804                 New data member declaration.
8805                 (Target_arm::Scan::local, Target_arm::Scan::global,
8806                 Target_arm::Relocate::relocate,
8807                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8808                 Adjust call to Target_arm::get_real_reloc_type.
8809                 (Target_arm::get_real_reloc_type): Use command line options
8810                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8811                 * options.h (--target1-rel, --target1-abs, --target2): New
8812                 ARM-only options.
8813
8814 2009-11-25  Doug Kwan  <dougkwan@google.com>
8815
8816         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8817         class definition.  Add code to handle --target1-rel, --target1-abs
8818         and --target2= options.
8819         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8820         and const.
8821         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8822         member declaration.
8823         (Target_arm::Scan::local, Target_arm::Scan::global,
8824         Target_arm::Relocate::relocate,
8825         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8826         call to Target_arm::get_real_reloc_type.
8827         (Target_arm::get_real_reloc_type): Use command line options to
8828         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8829         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8830         options.
8831
8832 2009-11-25  Doug Kwan  <dougkwan@google.com>
8833
8834         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8835         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8836         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8837         formatting.
8838         (Arm_relocate_functions::thm_call): Replace body with a call to
8839         Arm_relocate_functions::thumb_branch_common.
8840         (Arm_relocate_functions::thm_jump24,
8841         Arm_relocate_functions::thm_xpc22): New method definitions.
8842         (Arm_relocate_functions::thumb_branch_common): New method definition.
8843         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8844         operator.
8845         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8846         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8847
8848 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8849
8850         * Makefile.am: Build incremental-dump
8851         * Makefile.in: Regenerate.
8852         * incremental-dump.cc: New.
8853         * incremental.cc (Incremental_inputs_header_data,
8854         Incremental_inputs_entry_data): Move to incremental.h
8855         * incremental.h: (Incremental_inputs_header_data,
8856         Incremental_inputs_entry_data): Move from incremental.cc
8857
8858 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8859
8860         * incremental.cc (Incremental_inputs_header,
8861         Incremental_inputs_header_write, Incremental_inputs_entry,
8862         Incremental_inputs_entry_write): Add a typedef with the data type.
8863
8864 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8865
8866         * incremental.cc (Incremental_inputs_header,
8867         Incremental_inputs_header_write, Incremental_inputs_entry,
8868         Incremental_inputs_entry_write): Update comment about which
8869         type has the filed descriptions.
8870
8871 2009-11-15  Doug Kwan  <dougkwan@google.com>
8872
8873         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8874         (Arm_relocate_functions::arm_branch_common): Change method defintion
8875         in class definition to a method declaration and update list of formal
8876         parameters.
8877         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8878         Arm_relocation_functions::jump24): Adjust call to
8879         Arm_relocate_functions::arm_branch_common.  Update list of formal
8880         parameters.
8881         (Arm_relocate_functions::xpc25): New method definition.
8882         (Arm_relocate_functions::arm_branch_common): Move method defintion
8883         out from class definition.  Use stubs for mode-switching and extending
8884         branch ranges.
8885         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8886         specially.  Change code to enable use of stubs in ARM branches.
8887
8888 2009-11-10  Doug Kwan  <dougkwan@google.com>
8889
8890         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8891         in method declaration.
8892         (Target_arm::relocate_stub): New method declaration.
8893         (Target_arm::default_target): Change to return a pointer instead of
8894         a const reference.
8895         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8896         Target_arm::default_target.
8897         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8898         method definition.
8899         (Target_arm::relocate_section): Adjust view.
8900         (Target_arm::relocate_stub): New method definition.
8901
8902 2009-11-10  Doug Kwan  <dougkwan@google.com>
8903
8904         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8905         a format warning.
8906         * incremental.cc (open_incremental_binary): Initialized local
8907         variables to avoid warnings.
8908         * object.cc (make_elf_object): Ditto.
8909         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8910         a format warning.
8911
8912 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8913
8914         PR gold/10930
8915         * testsuite/plugin_test.c: Include "config.h".
8916
8917 2009-11-09  Doug Kwan  <dougkwan@google.com>
8918
8919         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8920         (arm_symbol_value): Remove.
8921         (Arm_relocate_functions::arm_branch_common,
8922         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8923         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8924         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8925         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8926         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8927         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8928         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8929         Arm_relocate_functions::thm_mobw_abs_nc,
8930         Arm_relocate_functions::thm_mov_abs,
8931         Arm_relocate_functions::movw_prel_nc,
8932         Arm_relocate_functions::thm_movt_abs,
8933         Arm_relocate_functions::movt_prel,
8934         Arm_relocate_functions::thm_movw_prel_nc,
8935         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8936         (Target_arm::Relocate::relocate): Only decompose address into two
8937         parts if relocation type uses the thumb-bit and pass the actual
8938         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8939         calls to methods in Arm_relocate_functions for this change.
8940
8941 2009-11-08  Ian Lance Taylor  <iant@google.com>
8942
8943         PR 10925
8944         * reloc.cc: Instantiate
8945         Sized_relobj::initialize_input_to_output_maps and
8946         Sized_relobj:free_input_to_output_maps.
8947
8948 2009-11-06  Ian Lance Taylor  <iant@google.com>
8949
8950         PR 10876
8951         * defstd.cc (in_segment): Set only_if_ref true for "end".
8952
8953 2009-11-06  Doug Kwan  <dougkwan@google.com>
8954
8955         * arm.cc (class Reloc_stub): Correct a comment.
8956         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8957         (Target_arm::scan_section_for_stubs): New method declaration.
8958         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8959         Change methods from private to protected.
8960         (Target_arm::do_may_relax): New method definition.
8961         (Target_arm::do_relax, Target_arm::group_sections,
8962         Target_arm::scan_reloc_for_stub,
8963         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8964         (Target_arm::arm_input_section_map_): New data member declaration.
8965         (Target_arm::scan_reloc_for_stub,
8966         Target_arm::scan_reloc_section_for_stubs,
8967         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8968         Target_arm::do_relax): New method definitions.
8969
8970 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8971
8972         * configure.ac: Check for (struct stat)::st_mtim
8973         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8974         * config.in: Regenerate.
8975         * configure: Regenerate.
8976
8977 2009-11-05  Ian Lance Taylor  <iant@google.com>
8978
8979         PR 10910
8980         * output.cc (Output_segment::add_output_section): Add missing
8981         return statement.
8982
8983 2009-11-04  Ian Lance Taylor  <iant@google.com>
8984
8985         PR 10880
8986         * object.h (class Object): Add is_needed and set_is_needed
8987         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8988         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8989         defined in a dynamic object and referenced by a regular object,
8990         set is_needed for the dynamic object.
8991         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8992         if the file is marked with as_needed and it is not needed.
8993
8994 2009-11-04  Ian Lance Taylor  <iant@google.com>
8995
8996         PR 10887
8997         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8998         tags if data is discarded by linker script.
8999         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9000         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9001         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9002         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9003
9004 2009-11-04  Ian Lance Taylor  <iant@google.com>
9005
9006         * layout.cc (Layout::get_output_section): Add is_interp and
9007         is_dynamic_linker_section parameters.  Change all callers.
9008         (Layout::choose_output_section): Likewise.
9009         (Layout::make_output_section): Likewise.
9010         (Layout::add_output_section_data): Add is_dynamic_linker_section
9011         parameter.  Change all callers.
9012         * layout.h (class Layout): Update declarations.
9013         * output.h (class Output_section): Add is_interp, set_is_interp,
9014         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9015         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9016         generate_code_fills_at_write_ to a bitfield.
9017         * output.cc (Output_section::Output_sections): Initialize new
9018         fields.
9019         (Output_segment::add_output_section): Add do_sort parameter.
9020         Change all callers.
9021
9022 2009-11-03  Ian Lance Taylor  <iant@google.com>
9023
9024         PR 10860
9025         * options.h (class General_options): Add --warn-common.
9026         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9027         merging two common symbols.
9028         (Symbol_table::should_override): Handle --warn-common when merging
9029         a common symbol with a defined symbol.  Use report_resolve_problem
9030         for multiple definitions.
9031         (Symbol_table::report_resolve_problem): New function.
9032         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9033
9034 2009-11-03  Doug Kwan  <dougkwan@google.com>
9035
9036         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9037         stub_factory_.
9038         (Target_arm::stub_factory): New method definition.
9039         (Target_arm::new_arm_input_section,
9040         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9041         Target_arm::reloc_uses_thumb_bit): New method declarations.
9042         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9043         New type definitions.
9044         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9045         member declarations.
9046         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9047         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9048         New method definitions.
9049
9050 2009-11-03  Ian Lance Taylor  <iant@google.com>
9051
9052         * options.h (class General_options): Add --warn_constructors.
9053
9054 2009-11-03  Ian Lance Taylor  <iant@google.com>
9055
9056         PR 10893
9057         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9058         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9059
9060 2009-11-03  Ian Lance Taylor  <iant@google.com>
9061
9062         PR 10895
9063         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9064         --msgid-bugs-address.
9065         (install-pdf): New target.
9066         (install-data_yes): Look up one directory to find mkinstalldirs.
9067
9068 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9069
9070         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9071         tree.
9072
9073 2009-10-30  Doug Kwan  <dougkwan@google.com>
9074
9075         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9076
9077 2009-10-30  Doug Kwan  <dougkwan@google.com>
9078
9079         * arm.cc (Stub_addend_reader): New struct template definition
9080         and partial specializations.
9081         (Stub_addend_reader::operator()): New method definition for a
9082         partially specialized template.
9083
9084 2009-10-30  Doug Kwan  <dougkwan@google.com>
9085
9086         * arm.cc (Arm_relobj::processor_specific_flags): New method
9087         definition.
9088         (Arm_relobj::do_read_symbols): New method declaration.
9089         (Arm_relobj::processor_specific_flags_): New data member declaration.
9090         (Arm_dynobj): New class definition.
9091         (Target_arm::do_finalize_sections): Add input_objects parameter.
9092         (Target_arm::do_adjust_elf_header): New method declaration.
9093         (Target_arm::are_eabi_versions_compatible,
9094         (Target_arm::merge_processor_specific_flags): New method declaration.
9095         (Target_arm::do_make_elf_object): New overloaded method definitions
9096         and declaration.
9097         (Arm_relobj::do_read_symbols): New method definition.
9098         (Arm_dynobj::do_read_symbols): Ditto.
9099         (Target_arm::do_finalize_sections): Add input_objects parameters.
9100         Merge processor-specific flags from all input objects.
9101         (Target_arm::are_eabi_versions_compatible,
9102         Target_arm::merge_processor_specific_flags,
9103         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9104         New method definitions.
9105         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9106         Input_objects pointer type parameter.
9107         * layout.cc (Layout::finalize): Pass input objects to target's.
9108         finalize_sections function.
9109         * output.cc (Output_file_header::do_sized_write): Set ELF file
9110         header's processor-specific flags.
9111         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9112         Input_objects pointer type parameter.
9113         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9114         * target.h (Input_objects): New forward class declaration.
9115         (Target::processor_specific_flags,
9116         Target::are_processor_specific_flags_sect): New method definitions.
9117         (Target::finalize_sections): Add input_objects parameter.
9118         (Target::Target): Initialize processor_specific_flags_ and
9119         are_processor_specific_flags_set_.
9120         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9121         parameter.
9122         (Target::set_processor_specific_flags): New method definition.
9123         (Target::processor_specific_flags_,
9124         Target::are_processor_specific_flags_set_): New data member
9125         declarations.
9126         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9127         Input_objects pointer type parameter.
9128
9129 2009-10-30  Doug Kwan  <dougkwan@google.com>
9130
9131         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9132
9133 2009-10-28  Ian Lance Taylor  <iant@google.com>
9134
9135         * object.h (class Relobj): Drop options parameter from
9136         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9137         do_scan_relocs, do_relocate.  Change all callers.
9138         (class Sized_relobj): Drop options parameters from
9139         do_gc_process_relocs, do_scan_relocs, do_relocate,
9140         do_relocate_sections, relocate_sections, emit_relocs_scan,
9141         emit_relocs_scan_reltype.  Change all callers.
9142         (struct Relocate_info): Remove options field and all references to
9143         it.
9144         * reloc.h (class Read_relocs): Remove options constructor
9145         parameter and options_ field.  Change all callers.
9146         (class Gc_process_relocs, class Scan_relocs): Likewise.
9147         (class Relocate_task): Likewise.
9148         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9149         all callers.
9150         (scan_relocatable_relocs): Likewise.
9151         * target.h (class Sized_target): Remove options parameter from
9152         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9153         all callers.
9154         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9155         callers.
9156         * arm.cc: Update functions to remove options parameters.
9157         * i386.cc: Likewise.
9158         * powerpc.cc: Likewise.
9159         * sparc.cc: Likewise.
9160         * x86_64.cc: Likewise.
9161         * testsuite/testfile.cc: Likewise.
9162
9163 2009-10-28  Doug Kwan  <dougkwan@google.com>
9164
9165         * arm.cc (Arm_relobj): New class definition.
9166         (Arm_relobj::scan_sections_for_stubs,
9167         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9168         New method definitions.
9169
9170 2009-10-28  Cary Coutant  <ccoutant@google.com>
9171
9172         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9173         (Plugin::cleanup_done_): New member.
9174         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9175         (Plugin_manager::cleanup_done_): Remove.
9176         (Plugin_manager::add_input_file): Edit error message.
9177         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9178         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9179
9180 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9181
9182         * fileread.cc: (File_read::View::~View): Use the new
9183         data_ownership_ filed.
9184         (File_read::~File_read): Dispose the new whole_file_view_.
9185         (File_read::open): Mmap the whole file if needed.
9186         (File_read::open): Use whole_file_view_ instead of contents_.
9187         (File_read::find_view): Use whole_file_view_ if applicable.
9188         (File_read::do_read): Use whole_file_view_ instead of contents_.
9189         (File_read::make_view): Use whole_file_view_ instead of contents_,
9190         update File_read::View::View call.
9191         (File_read::find_or_make_view): Update File_read::View::View
9192         call.
9193         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9194         remove contents_
9195         (File_read::View::Data_ownership): New enum.
9196         (File_read::View::View): Replace bool mapped_ with Data_ownership
9197         argument.
9198         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9199         (File_read::View::data_ownership_): New field.
9200         (File_read::contents_): Remove (replaced by whole_file_view_).
9201         (File_read::whole_file_view_): New field.
9202         * options.h (class General_options): Add --keep-files-mapped.
9203
9204 2009-10-27  Cary Coutant  <ccoutant@google.com>
9205
9206         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9207         * testsuite/Makefile.am (plugin_test_5): New test case.
9208         * testsuite/Makefile.in: Regenerate.
9209
9210 2009-10-25  Doug Kwan  <dougkwan@google.com>
9211
9212         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9213         from private to protected to allow access by child class.
9214         (Sized_relobj::do_relocate_sections): New method declaration.
9215         (Sized_relobj::relocate_sections): Virtualize.
9216         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9217         Sized_relobj::relocate_sections.  Instantiate template explicitly
9218         for different target sizes and endianity.
9219
9220 2009-10-24  Doug Kwan  <dougkwan@google.com>
9221
9222         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9223         (Arm_input_section::as_arm_input_section): New method.
9224         (Arm_output_section): New class definition.
9225         (Arm_output_section::create_stub_group,
9226         Arm_output_section::group_sections): New method definitions.
9227
9228 2009-10-22  Doug Kwan  <dougkwan@google.com>
9229
9230         * arm.cc (Arm_input_section): New class definition.
9231         (Arm_input_section::init, Arm_input_section:do_write,
9232         Arm_input_section::set_final_data_size,
9233         Arm_input_section::do_reset_address_and_file_offset): New method
9234         definitions.
9235
9236 2009-10-21  Doug Kwan  <dougkwan@google.com>
9237
9238         * arm.cc (Stub_table, Arm_input_section): New forward class
9239         declarations.
9240         (Stub_table): New class defintion.
9241         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9242         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9243         New method definition.
9244
9245 2009-10-21  Doug Kwan  <dougkwan@google.com>
9246
9247         * arm.cc: Update copyright comments.
9248         (Target_arm): New forward class template declaration.
9249         (Arm_address): New type.
9250         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9251         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9252         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9253         constants.
9254         (Insn_template): Same.
9255         (DEF_STUBS): New macro.
9256         (Stub_type): New enum type.
9257         (Stub_template): New class definition.
9258         (Stub): Same.
9259         (Reloc_stub): Same.
9260         (Stub_factory): Same.
9261         (Target_arm::Target_arm): Initialize may_use_blx_ and
9262         should_force_pic_veneer_.
9263         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9264         Target_arm::should_force_pic_veneer,
9265         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9266         Target_arm::using_thumb_only, Target_arm:;default_target): New
9267         method defintions.
9268         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9269         New data member declarations.
9270         (Insn_template::size, Insn_template::alignment): New method defintions.
9271         (Stub_template::Stub_template): New method definition.
9272         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9273         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9274         (Stub_factory::Stub_factory): New method definition.
9275         * gold.h (string_hash): New template.
9276         * output.h (Input_section_specifier::hash_value): Use
9277         gold::string_hash.
9278         (Input_section_specifier::string_hash): Remove.
9279         * stringpool.cc (Stringpool_template::string_hash): Use
9280         gold::string_hash.
9281
9282 2009-10-20  Doug Kwan  <dougkwan@google.com>
9283
9284         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9285         symbols of relaxed input sections.
9286         * output.h (Output_section::find_relaxed_input_section): Make
9287         method public.
9288
9289 2009-10-16  Doug Kwan  <dougkwan@google.com>
9290
9291         * dynobj.cc (Versions::Versions): Initialize version_script_.
9292         Only insert base version symbol definition for a shared object
9293         if version script defines any version versions.
9294         (Versions::define_base_version): New method definition.
9295         (Versions::add_def): Check that base version is not needed.
9296         (Versions::add_need): Define base version lazily.
9297         * dynobj.h (Versions::define_base_version): New method declaration.
9298         (Versions::needs_base_version_): New data member declaration.
9299         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9300         (check_DATA): Add no_version_test.stdout.
9301         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9302         New make rules.
9303         * testsuite/Makefile.in: Regenerate.
9304         * testsuite/no_version_test.c: New file.
9305         * testsuite/no_version_test.sh: Ditto.
9306
9307 2009-10-16  Doug Kwan  <dougkwan@google.com>
9308
9309         * expression.cc (class Segment_start_expression): New class definition.
9310         (Segment_start_expression::value): New method definition.
9311         (script_exp_function_segment_start): Return a new
9312         Segment_start_expression.
9313         * gold/script-c.h (script_saw_segment_start_expression): New function
9314         prototype.
9315         * script-sections.cc (Script_sections::Script_sections): Initialize
9316         SAW_SEGMENT_START_EXPRESSION_ to false.
9317         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9318         and -Tbbs options to specify section addresses if given in
9319         command line and no SEGMENT_START expression is seen in a script.
9320         * script-sections.h (Script_sections::saw_segment_start_expression,
9321         Script_sections::set_saw_segment_start_expression): New method
9322         definition.
9323         (Script_sections::saw_segment_start_expression_): New data member
9324         declaration.
9325         * script.cc (script_saw_segment_start_expression): New function.
9326         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9327         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9328         script_test_7.sh and script_test_8.sh.
9329         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9330         script_test_8.stdout.
9331         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9332         (script_test_6, script_test_6.stdout, script_test_7,
9333         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9334         * Makefile.in: Regenerate.
9335         * testsuite/script_test_6.sh: New file.
9336         * testsuite/script_test_6.t: Same.
9337         * testsuite/script_test_7.sh: Same.
9338         * testsuite/script_test_7.t: Same.
9339         * testsuite/script_test_8.sh: Same.
9340
9341 2009-10-16  Doug Kwan  <dougkwan@google.com>
9342
9343         * output.cc (Output_segment::set_section_list_address): Cast
9344         expressions to unsigned long long type to avoid format warnings.
9345
9346 2009-10-15  Ian Lance Taylor  <iant@google.com>
9347
9348         * script.cc (Script_options::add_symbol_assignment): Always add a
9349         dot assignment to script_sections_.
9350         * script-sections.cc (Script_sections::add_dot_assignment):
9351         Initialize if necessary.
9352
9353         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9354         program headers with no load segment if there is a linker script.
9355
9356         * layout.cc (Layout::set_segment_offsets): Align the file offset
9357         to the segment aligment for -N or -n with no load segment.
9358         * output.cc (Output_segment::add_output_section): Don't crash if
9359         the first section is a TLS section.
9360         (Output_segment::set_section_list_addresses): Print an error
9361         message if the address moves backward in a linker script.
9362         * script-sections.cc
9363         (Output_section_element_input::set_section_addresses): Don't
9364         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9365         (Orphan_output_section::set_section_addresses): Likewise.
9366
9367 2009-10-15  Doug Kwan  <dougkwan@google.com>
9368
9369         * layout.cc (Layout::finish_dynamic_section): Generate tags
9370         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9371         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9372         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9373
9374 2009-10-14  Ian Lance Taylor  <iant@google.com>
9375
9376         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9377         fields.
9378         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9379         data_shdr fields of relinfo.
9380         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9381         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9382         R_386_TLS_LDO_32, adjust based on section flags.
9383         (Target_i386::Relocate::fix_up_ldo): Remove.
9384
9385 2009-10-13  Ian Lance Taylor  <iant@google.com>
9386
9387         Add support for -pie.
9388         * options.h (class General_options): Add -pie and
9389         --pic-executable.
9390         (General_options::output_is_position_independent): Test -pie.
9391         (General_options::output_is_executable): Return true if not shared
9392         and not relocatable.
9393         (General_options::output_is_pie): Remove.
9394         * options.cc (General_options::finalize): Reject incompatible uses
9395         of -pie.
9396         * gold.cc (queue_middle_tasks): A -pie link is not static.
9397         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9398         * symtab.cc (Symbol::final_value_is_known): Return false if
9399         output_is_position_independent.
9400         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9401         output_is_position_independent.
9402         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9403         output_is_position_independent.
9404         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9405         output_is_position_independent.
9406         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9407         two_file_pie_test.
9408         (basic_pie_test.o, basic_pie_test): New targets.
9409         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9410         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9411         (two_file_pie_test): New target.
9412         * testsuite/Makefile.in: Rebuild.
9413         * README: Remove note saying that -pie is not supported.
9414
9415 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9416
9417         * options.h (class General_options): Add -init and -fini.
9418         * layout.cc (Layout::finish_dynamic_section): Emit
9419         given init and fini functions.
9420
9421 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9422
9423         * gc.h (gc_process_relocs): Check if icf is enabled using new
9424         function.
9425         * gold.cc (queue_initial_tasks): Likewise.
9426         (queue_middle_tasks): Likewise.
9427         * object.cc (do_layout): Likewise.
9428         * symtab.cc (is_section_folded): Likewise.
9429         * main.cc (main): Likewise.
9430         * reloc.cc (Read_relocs::run): Likewise.
9431         (Sized_relobj::do_scan_relocs): Likewise.
9432         * icf.cc (is_function_ctor_or_dtor): New function.
9433         (Icf::find_identical_sections): Check if function is ctor or dtor when
9434         safe icf is chosen.
9435         * options.h (General_options::icf): Change option to be an enum.
9436         (Icf_status): New enum.
9437         (icf_enabled): New method.
9438         (icf_safe_folding): New method.
9439         (set_icf_status): New method.
9440         (icf_status_): New variable.
9441         * (options.cc) (General_options::finalize): Set icf_status_.
9442         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9443         icf_test and icf_keep_unique_test to use the --icf enum flag.
9444         * testsuite/icf_safe_test.sh: New file.
9445         * testsuite/icf_safe_test.cc: New file.
9446
9447 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9448
9449         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9450         includes to gc.h and icf.h.
9451         * arm.cc: Include gc.h.
9452         * gold.cc: Likewise.
9453         * i386.cc: Likewise.
9454         * powerpc.cc: Likewise.
9455         * sparc.cc: Likewise.
9456         * x86_64.cc: Likewise.
9457         * gc.h: Include icf.h.
9458
9459 2009-10-11  Ian Lance Taylor  <iant@google.com>
9460
9461         * plugin.cc: Include "gold.h" before other header files.
9462
9463 2009-10-10  Chris Demetriou  <cgd@google.com>
9464
9465         * options.h (Input_file_argument::Input_file_type): New enum.
9466         (Input_file_argument::is_lib_): Replace with...
9467         (Input_file_argument::type_): New member.
9468         (Input_file_argument::Input_file_argument): Take Input_file_type
9469         'type' rather than boolean 'is_lib' as second argument.
9470         (Input_file_argument::is_lib): Use type_.
9471         (Input_file_argument::is_searched_file): New function.
9472         (Input_file_argument::may_need_search): Handle is_searched_file.
9473         * options.cc (General_options::parse_library): Support -l:filename.
9474         (General_options::parse_just_symbols): Update for Input_file_argument
9475         changes.
9476         (Command_line::process): Likewise.
9477         * archive.cc (Archive::get_file_and_offset): Likewise.
9478         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9479         * script.cc (read_script_file, script_add_file): Likewise.
9480         * fileread.cc (Input_file::Input_file): Likewise.
9481         (Input_file::will_search_for): Handle is_searched_file.
9482         (Input_file::open): Likewise.
9483         * readsyms.cc (Read_symbols::get_name): Likewise.
9484         * testsuite/Makefile.am (searched_file_test): New test.
9485         * testsuite/Makefile.in: Regenerate.
9486         * testsuite/searched_file_test.cc: New file.
9487         * testsuite/searched_file_test_lib.cc: New file.
9488
9489 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9490             Ian Lance Taylor  <iant@google.com>
9491
9492         * descriptor.cc: Include <cstdio> and "binary-io.h".
9493         (Descriptors::open): Open the files in binary mode always.
9494         * script.cc (Lex::get_token): Treat \r as whitespace.
9495
9496 2009-10-09  Ian Lance Taylor  <iant@google.com>
9497
9498         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9499
9500 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9501             Ian Lance Taylor  <iant@google.com>
9502
9503         * configure.ac: Check for readv function also.
9504         * fileread.cc (readv): Define if not HAVE_READV.
9505         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9506         does not exist.
9507         * config.in: Regenerate.
9508         * configure: Regenerate.
9509
9510 2009-10-09  Doug Kwan  <dougkwan@google.com>
9511
9512         * layout.cc (Layout::make_output_section): Call target hook to make
9513         ordinary output section.
9514         (Layout::finalize): Adjust parameter list of call the
9515         Target::may_relax().
9516         * layout.h (class Layout::section_list): New method.
9517         * merge.h (Output_merge_base::entsize): Change visibility to public.
9518         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9519         New methods.
9520         (Output_merge_string::do_is_string): New method.
9521         * object.cc (Sized_relobj::do_setup): renamed from
9522         Sized_relobj::set_up.
9523         * object.h (Sized_relobj::adjust_shndx,
9524         Sized_relobj::initializ_input_to_output_maps,
9525         Sized_relobj::free_input_to_output_maps): Change visibilities to
9526         protected.
9527         (Sized_relobj::setup): Virtualize.
9528         (Sized_relobj::do_setup): New method declaration.
9529         (Sized_relobj::invalidate_section_offset,
9530         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9531         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9532         * options.cc (parse_int): New function.
9533         * options.h (parse_int): New declaration.
9534         (DEFINE_int): New macro.
9535         (stub_group_size): New option.
9536         * output.cc (Output_section::Output_section): Initialize memebers
9537         merge_section_map_, merge_section_by_properties_map_,
9538         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9539         (Output_section::add_input_section): Handled deferred code-fill
9540         generation and remove an old comment.
9541         (Output_section::add_relaxed_input_section): New method definition.
9542         (Output_section::add_merge_input_section): Use merge section by
9543         properties map to speed to search.  Update merge section maps
9544         as appropriate.
9545         (Output_section::build_relaxation_map): New method definition.
9546         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9547         Same.
9548         (Output_section::relax_input_section): Renamed to
9549         Output_section::convert_input_sections_to_relaxed_sections and change
9550         interface to take a vector of pointers to relaxed sections.
9551         (Output_section::find_merge_section,
9552         Output_section::find_relaxed_input_section): New method definitions.
9553         (Output_section::is_input_address_mapped,
9554         Output_section::output_offset, Output_section::output_address):
9555         Use output section data maps to speed up searching.
9556         (Output_section::find_starting_output_address): Add comments.
9557         (Output_section::do_write,
9558         Output_section::write_to_postprocessing_buffer): Do code-fill
9559         generation as appropriate.
9560         (Output_section::get_input_sections): Invalidate relaxed input section
9561         map.
9562         (Output_section::restore_states): Adjust type of checkpoint .
9563         Invalidate relaxed input section map.
9564         * output.h (Output_merge_base): New class declaration.
9565         (Input_section_specifier): New class defintion.
9566         (class Output_relaxed_input_section) Change base class to
9567         Output_section_data_build.
9568         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9569         base class initializer.
9570         (Output_section::add_relaxed_input_section): New method declaration.
9571         (Output_section::Input_section): Change visibility to protected.
9572         (Output_section::Input_section::relobj,
9573         Output_section::Input_section::shndx): Handle relaxed input sections.
9574         Output_section::input_sections) Change visibility to protected.  Also
9575         define overload to return a non-const pointer.
9576         (Output_section::Merge_section_properties): New class defintion.
9577         (Output_section::Merge_section_by_properties_map,
9578         Output_section::Output_section_data_by_input_section_map,
9579         Output_section::Relaxation_map): New types.
9580         (Output_section::relax_input_section): Rename method to
9581         Output_section::convert_input_sections_to_relaxed_sections and change
9582         interface to take a vector of relaxed section pointers.
9583         (Output_section::find_merge_section,
9584         Output_section::find_relaxed_input_section,
9585         Output_section::build_relaxation_map,
9586         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9587         New method declarations.
9588         (Output_section::merge_section_map_
9589         Output_section::merge_section_by_properties_map_,
9590         Output_section::relaxed_input_section_map_,
9591         Output_section::is_relaxed_input_section_map_valid_,
9592         Output_section::generate_code_fills_at_write_): New data members.
9593         * script-sections.cc
9594         (Output_section_element_input::set_section_addresses): Call
9595         current_data_size and addralign methods of relaxed input sections.
9596         (Orphan_output_section::set_section_addresses): Call current_data_size
9597         and addralign methods of relaxed input sections.
9598         * symtab.cc (Symbol_table::compute_final_value): Extract template
9599         from the body of Symbol_table::sized_finalize_symbol.
9600         (Symbol_table::sized_finalized_symbol): Call
9601         Symbol_table::compute_final_value.
9602         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9603         (Symbol_table::compute_final_value): New templated method declaration.
9604         * target.cc (Target::do_make_output_section): New method defintion.
9605         * target.h (Target::make_output_section): New method declaration.
9606         (Target::relax): Add more parameters for input objects, symbol table
9607         and layout.  Adjust call to do_relax.
9608         (Target::do_make_output_section): New method declaration.
9609         (Target::do_relax): Add parameters for input objects, symbol table
9610         and layout.
9611
9612 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9613
9614         * pread.c: Include stdio.h.
9615
9616 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9617
9618         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9619         defined.
9620
9621 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9622
9623         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9624         Change read_shndx type to unsigned int.
9625         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9626         int.
9627         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9628         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9629         Change read_shndx type to unsigned int.
9630         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9631         int.
9632         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9633         * layout.cc (Layout::create_symtab_sections): Cast the result of
9634         local_symcount * symsize to off_t in the gold_assert.
9635
9636 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9637
9638         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9639         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9640         R_ARM_BASE_ABS.
9641         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9642         (Arm_relocate_functions::thm_abs5): New function.
9643         (Arm_relocate_functions::abs12): New function.
9644         (Arm_relocate_functions::abs16): New function.
9645         (Arm_relocate_functions::base_abs): New function.
9646         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9647         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9648         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9649         R_ARM_BASE_ABS.
9650         (Scan::global): Likewise.
9651         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9652         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9653         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9654         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9655         R_ARM_BASE_ABS.
9656
9657 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9658
9659         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9660         (Arm_relocate_functions::movt_prel): New function.
9661         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9662         (Arm_relocate_functions::thm_movt_prel): New function.
9663         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9664         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9665         (Scan::global, Relocate::relocate): Likewise.
9666         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9667
9668 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9669
9670         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9671         Incremental_checker.
9672         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9673         unsigned int.
9674         (class Incremental_inputs_header): New class.
9675         (Incremental_inputs_header_writer): Edit comment.
9676         (Incremental_inputs_entry): New class.
9677         (Incremental_inputs_entry_writer): Edit comment.
9678         (Sized_incremental_binary::do_find_incremental_inputs_section):
9679         Add *strtab_shndx parameter, fill it.
9680         (Sized_incremental_binary::do_check_inputs): New method.
9681         (Incremental_checker::can_incrementally_link_output_file): Use
9682         Sized_incremental_binary::check_inputs.
9683         (Incremental_inputs::report_command_line): Save command line in
9684         command_line_.
9685         * incremental.h:
9686         (Incremental_binary::find_incremental_inputs_section): New
9687         method.
9688         (Incremental_binary::do_find_incremental_inputs_section): Add
9689         strtab_shndx parameter.
9690         (Incremental_binary::do_check_inputs): New pure virtual method.
9691         (Sized_incremental_binary::do_check_inputs): Declare.
9692         (Incremental_checker::Incremental_checker): Add incremental_inputs
9693         parameter, use it to initialize incremental_inputs_.
9694         (Incremental_checker::incremental_inputs_): New field.
9695         (Incremental_checker::command_line): New method.
9696         (Incremental_checker::inputs): New method.
9697         (Incremental_checker::command_line_): New field.
9698
9699 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9700
9701         * incremental.cc: Include <cstdarg> and "target-select.h".
9702         (vexplain_no_incremental): New function.
9703         (explain_no_incremental): New function.
9704         (Incremental_binary::error): New method.
9705         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9706         method.
9707         (make_sized_incremental_binary): New function.
9708         (open_incremental_binary): New function.
9709         (can_incrementally_link_file): Add checks if output is ELF and has
9710         inputs section.
9711         * incremental.h: Include "elfcpp_file.h" and "output.h".
9712         (Incremental_binary): New class.
9713         (Sized_incremental_binary): New class.
9714         (open_incremental_binary): Declare.
9715         * object.cc (is_elf_object): Use
9716         elfcpp::Elf_recognizer::is_elf_file.
9717         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9718         * output.h (Output_file::filesize): New method.
9719
9720 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9721
9722         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9723         New function.
9724         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9725         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9726         function.
9727         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9728         function.
9729         (Arm_relocate_functions::movw_abs_nc): New function.
9730         (Arm_relocate_functions::movt_abs): New function.
9731         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9732         (Arm_relocate_functions::thm_movt_abs): New function.
9733         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9734         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9735         (Scan::global): Likewise.
9736         (Relocate::relocate): Likewise.
9737         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9738
9739 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9740
9741         * arm.cc (Arm_relocate_functions::got_prel) New function.
9742         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9743         (Relocate::relocate): Likewise.
9744         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9745
9746 2009-10-06  Ian Lance Taylor  <iant@google.com>
9747
9748         * options.h (class General_options): Define
9749         split_stack_adjust_size parameter.
9750         * object.h (class Object): Add uses_split_stack_ and
9751         has_no_split_stack_ fields.  Add uses_split_stack and
9752         has_no_split_stack accessor functions.  Declare
9753         handle_split_stack_section.
9754         (class Reloc_symbol_changes): Define.
9755         (class Sized_relobj): Define Function_offsets.  Declare
9756         split_stack_adjust, split_stack_adjust_reltype, and
9757         find_functions.
9758         * object.cc (Object::handle_split_stack_section): New function.
9759         (Sized_relobj::do_layout): Call handle_split_stack_section.
9760         * dynobj.cc (Sized_dynobj::do_layout): Call
9761         handle_split_stack_section.
9762         * reloc.cc (Sized_relobj::relocate_sections): Call
9763         split_stack_adjust for executable sections in split_stack
9764         objects.  Pass reloc_map to relocate_section.
9765         (Sized_relobj::split_stack_adjust): New function.
9766         (Sized_relobj::split_stack_adjust_reltype): New function.
9767         (Sized_relobj::find_functions): New function.
9768         * target-reloc.h: Include "object.h".
9769         (relocate_section): Add reloc_symbol_changes parameter.  Change
9770         all callers.
9771         * target.h (class Target): Add calls_non_split method.  Declare
9772         do_calls_non_split virtual method.  Declare match_view and
9773         set_view_to_nop.
9774         * target.cc: Include "elfcpp.h".
9775         (Target::do_calls_non_split): New function.
9776         (Target::match_view): New function.
9777         (Target::set_view_to_nop): New function.
9778         * gold.cc (queue_middle_tasks): Give an error if mixing
9779         split-stack and non-split-stack objects with -r.
9780         * i386.cc (Target_i386::relocate_section): Add
9781         reloc_symbol_changes parameter.
9782         (Target_i386::do_calls_non_split): New function.
9783         * x86_64.cc (Target_x86_64::relocate_section): Add
9784         reloc_symbol_changes parameter.
9785         (Target_x86_64::do_calls_non_split): New function.
9786         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9787         parameter.
9788         * powerpc.cc (Target_powerpc::relocate_section): Add
9789         reloc_symbol_changes parameter.
9790         * sparc.cc (Target_sparc::relocate_section): Add
9791         reloc_symbol_changes parameter.
9792         * configure.ac: Call AM_CONDITIONAL for the default target.
9793         * configure: Rebuild.
9794         * testsuite/Makefile.am (TEST_AS): New variable.
9795         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9796         (check_DATA): Add split_i386 and split_x86_64 files.
9797         (SPLIT_DEFSYMS): Define.
9798         (split_i386_[1234n].o): New targets.
9799         (split_i386_[124]): New targets.
9800         (split_i386_[1234r].stdout): New targets.
9801         (split_x86_64_[1234n].o): New targets.
9802         (split_x86_64_[124]): New targets.
9803         (split_x86_64_[1234r].stdout): New targets.
9804         (MOSTLYCLEANFILES): Add new executables.
9805         * testsuite/split_i386.sh: New file.
9806         * testsuite/split_x86_64.sh: New file.
9807         * testsuite/split_i386_1.s: New file.
9808         * testsuite/split_i386_2.s: New file.
9809         * testsuite/split_i386_3.s: New file.
9810         * testsuite/split_i386_4.s: New file.
9811         * testsuite/split_i386_n.s: New file.
9812         * testsuite/split_x86_64_1.s: New file.
9813         * testsuite/split_x86_64_2.s: New file.
9814         * testsuite/split_x86_64_3.s: New file.
9815         * testsuite/split_x86_64_4.s: New file.
9816         * testsuite/split_x86_64_n.s: New file.
9817         * testsuite/testfile.cc (Target_test): Update relocation_section
9818         function.
9819         * testsuite/Makefile.in: Rebuild.
9820
9821 2009-10-06  Ian Lance Taylor  <iant@google.com>
9822
9823         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9824         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9825         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9826         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9827         the address on ldo_addrs_.
9828         (Target_i386::Relocate::fix_up_ldo): New function.
9829
9830 2009-10-06   Rafael Espindola  <espindola@google.com>
9831
9832         * plugin.cc (add_input_library): New.
9833         (Plugin::load): Add add_input_library to tv.
9834         (Plugin_manager::add_input_file): Add the is_lib argument.
9835         (add_input_file): Update call to Plugin_manager::add_input_file.
9836         (add_input_library): New.
9837         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9838
9839 2009-09-30  Doug Kwan  <dougkwan@google.com>
9840
9841         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9842         symbol and call Symbol::may_need_copy_reloc to determine if
9843         a copy reloc is needed.
9844         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9845         nocopyreloc is given in command line.
9846         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9847         given in command line.
9848         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9849         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9850         of the removed Target_i386::may_need_copy_reloc.
9851         * options.h (copyreloc): New option with default value false.
9852         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9853         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9854         instead of the removed Target_powerpc::may_need_copy_reloc.
9855         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9856         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9857         instead of the removed Target_sparc::may_need_copy_reloc.
9858         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9859         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9860         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9861         instead of the removed Target_x86_64::may_need_copy_reloc.
9862
9863 2009-09-30  Ian Lance Taylor  <iant@google.com>
9864
9865         * object.h (class Object): Remove target_ field, and target,
9866         sized_target, and set_target methods.
9867         (Object::sized_target): Remove.
9868         (class Sized_relobj): Update declarations.  Remove sized_target.
9869         * object.cc (Sized_relobj::setup): Remove target parameter.
9870         Change all callers.
9871         (Input_objects::add_object): Don't do anything with the target.
9872         (make_elf_sized_object): Add punconfigured parameter.  Change all
9873         callers.  Set or test parameter target.
9874         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9875         Change all callers.
9876         * parameters.cc (Parameters::set_target): Change parameter type to
9877         be non-const.
9878         (Parameters::default_target): Remove.
9879         (set_parameters_target): Change parameter type to be non-const.
9880         (parameters_force_valid_target): New function.
9881         (parameters_clear_target): New function.
9882         * parameters.h (class Parameters): Update declarations.  Remove
9883         default_target method.  Add sized_target and clear_target
9884         methods.  Change target_ to be non-const.
9885         (set_parameters_target): Update declaration.
9886         (parameters_force_valid_target): Declare.
9887         (parameters_clear_target): Declare.
9888         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9889         as NULL if we aren't searching.
9890         (Add_symbols::run): Don't check for compatible target.
9891         * fileread.cc (Input_file::open_binary): Call
9892         parameters_force_valid_target.
9893         * gold.cc (queue_middle_tasks): Likewise.
9894         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9895         set_target on object.
9896         * dynobj.h (class Sized_dynobj): Update declarations.
9897         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9898         make_elf_object returns NULL.
9899         (Archive::include_member): Don't check whether object target is
9900         compatible.
9901         * output.cc (Output_section::add_input_section): Get target from
9902         parameters.
9903         (Output_section::relax_input_section): Likewise.
9904         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9905         parameters.
9906         (Sized_relobj::do_scan_relocs): Likewise.
9907         (Sized_relobj::relocate_sections): Likewise.
9908         * resolve.cc (Symbol_table::resolve): Likewise.
9909         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9910         parameter.  Change all callers.
9911         (Symbol_table::add_from_object): Get target from parameters.
9912         (Symbol_table::add_from_relobj): Don't check object target.
9913         (Symbol_table::add_from_dynobj): Likewise.
9914         (Symbol_table::define_special_symbol): Get target from
9915         parameters.
9916         * symtab.h (class Symbol_table): Update declaration.
9917         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9918         parameter.  Change all callers.  Clear parameter target.
9919         (Binary_test): Test target here.
9920         * testsuite/object_unittest.cc (gold_testsuite): Remove
9921         target_test_pointer parameter.  Change all callers.
9922         (Object_test): Test target here.
9923
9924 2009-09-26  Ian Lance Taylor  <iant@google.com>
9925
9926         * testsuite/initpri1.c: Don't try to use constructor priorities if
9927         compiling with gcc before 4.3.
9928
9929 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9930
9931         * testsuite/retain_symbols_file_test.sh (check_present): Change
9932         output file name to retain_symbols_file_test.stdout.
9933         (check_absent): Likewise.
9934
9935 2009-09-18  Craig Silverstein  <csilvers@google.com>
9936
9937         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9938         * options.cc: Include <cerrno> and <fstream>.
9939         (General_options::finalize): Parse -retain-symbols-file tag.
9940         * options.h: New flag.
9941         (General_options): New method should_retain_symbol, new
9942         variable symbols_to_retain.
9943         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9944         should_retain_symbol map.
9945         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9946         * testsuite/Makefile.in: Regenerate.
9947         * testsuite/retain_symbols_file_test.sh: New file.
9948
9949 2009-09-18  Nick Clifton  <nickc@redhat.com>
9950
9951         * po/es.po: Updated Spanish translation.
9952
9953 2009-09-17  Doug Kwan  <dougkwan@google.com>
9954
9955         * debug.h (DEBUG_RELAXATION): New constant.
9956         (DEBUG_ALL): Add DEBUG_RELAXATION.
9957         (debug_string_to_enum): Add relaxation debug option.
9958         * layout.cc
9959         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9960         Layout::Relaxation_debug_check::read_sections,
9961         Layout::Relaxation_debug_check::read_sections): New method definitions.
9962         (Layout::Layout): Initialize data members
9963         record_output_section_data_from_scrips_,
9964         script_output_section_data_list_ and relaxation_debug_check_.
9965         (Layout::save_segments, Layout::restore_segments,
9966         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9967         Layout::relaxation_loop_body): New method definitions.
9968         (Layout::finalize): Support relaxation.  Move section layout code to
9969         Layout::relaxation_loop_body.
9970         (Layout::set_asection_address_from_script): Move code for orphan
9971         section placement out.
9972         (Layout::place_orphan_sections_in_script): New method definition.
9973         * layout.h (Output_segment_headers, Output_file_header):
9974         New forward class declarations.
9975         (Layout::~Layout): Define.
9976         (Layout::new_output_section_data_from_script): New method definition.
9977         (Layout::place_orphan_sections_in_script): New method declaration.
9978         (Layout::Segment_states): New type declaration.
9979         (Layout::save_segments, Layout::restore_segments,
9980         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9981         Layout::relaxation_loop_body): New method declarations.
9982         (Layout::Output_section_data_list): New type declaration.
9983         (Layout::Relaxation_debug_check): New class definition.
9984         (Layout::record_output_section_data_from_script_,
9985         Layout::script_output_section_data_list_, Layout::segment_states_,
9986         Layout::relaxation_debug_check_): New data members.
9987         * output.cc: (Output_section_headers::do_size): New method definition.
9988         (Output_section_headers::Output_section_headers): Move size
9989         computation to Output_section_headers::do_size.
9990         (Output_segment_headers::do_size): New method definition.
9991         (Output_file_header::Output_file_header): Move size computation to
9992         Output_file_header::do_size and call it.
9993         (Output_file_header::do_size): New method definition.
9994         (Output_data_group::Output_data_group): Adjust call to
9995         Output_section_data.
9996         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9997         (Output_symtab_xindex::do_write): Add array bound check.
9998         (Output_section::Input_section::print_to_mapfile): Handle
9999         RELAXED_INPUT_SECTION_CODE.
10000         (Output_section::Output_section): Initialize data member checkpoint_.
10001         (Output_section::~Output_section): Delete checkpoint object pointed
10002         by checkpoint_.
10003         (Output_section::add_input_section): Always add an Input_section if
10004         relaxing.
10005         (Output_section::add_merge_input_section): Add assert.
10006         (Output_section::relax_input_section): New method definition.
10007         (Output_section::set_final_data_size): Set load address to zero for
10008         an unallocated section.
10009         (Output_section::do_address_and_file_offset_have_reset_values):
10010         New method definition.
10011         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10012         Handle relaxed input section.
10013         (Output_section::sort_attached_input_sections): Checkpoint input
10014         section list lazily.
10015         (Output_section::get_input_sections): Change type of input_sections to
10016         list of Simple_input_section pointers.  Checkpoint input section list
10017         lazily.  Also handle relaxed input sections.
10018         (Output_section::add_input_section_for_script): Take a reference to
10019         a Simple_input_section object instead of Relobj pointer and section
10020         index as parameter.  Handle relaxed input sections.
10021         (Output_section::save_states, Output_section::restore_states): New
10022         method definitions.
10023         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10024         (Output_data::is_data_size_fixed): New method definition.
10025         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10026         if it is fixed.
10027         (Output_data::address_and_file_offset_have_reset_values): New method
10028         definition.
10029         (Output_data::do_address_and_file_offset_have_reset_values): New method
10030         definition.
10031         (Output_data::set_data_size): Check that data size is not fixed.
10032         (Output_data::fix_data_size): New method definition.
10033         (Output_data::is_data_size_fixed_): New data member.
10034         (Output_section_headers::set_final_data_size): New method definition.
10035         (Output_section_headers::do_size): New method declaration.
10036         (Output_segment_headers::set_final_data_size): New method definition.
10037         (Output_segment_headers::do_size): New method declaration.
10038         (Output_file_header::set_final_data_size)::New method definition.
10039         (Output_file_header::do_size)::New method declaration.
10040         (Output_section_data::Output_section_data): Add new parameter
10041         is_data_size_fixed and use it to fix data size.
10042         (Output_data_const::Output_data_const): Adjust call to base class
10043         constructor and fix data size.
10044         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10045         base class constructor and fix data size.
10046         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10047         base class constructor and fix data size.
10048         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10049         class constructor and fix data size.
10050         (Output_data_group::set_final_data_size): New method definition.
10051         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10052         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10053         class constructor and fix data size.
10054         (Output_relaxed_input_section): New class definition.
10055         (Output_section::Simple_input_section): New class definition.
10056         (Output_section::get_input_sections): Adjust parameter list.
10057         (Output_section::add_input_section_for_script): Same.
10058         (Output_section::save_states, Output_section::restore_states,
10059         Output_section::do_address_and_file_offset_have_reset_values,
10060         (Output_section::Input_section::Input_section): Handle
10061         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10062         Output_relaxed_input_section.
10063         (Output_section::Input_section::is_input_section,
10064         Output_section::Input_section::set_output_section): Handle relaxed
10065         input section.
10066         (Output_section::Input_section::is_relaxed_input_section,
10067         Output_section::Input_section::output_section_data,
10068         Output_section::Input_section::relaxed_input_section): New method
10069         definitions.
10070         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10071         value.
10072         (Output_section::Input_section::u1_): Update comments.
10073         (Output_section::Input_section::u2_): Add new union member poris.
10074         (Output_section::Checkpoint_output_section): New classs definition.
10075         (Output_section::relax_input_section): New method declaration.
10076         (Output_section::checkpoint_): New data member.
10077         (Output_segment): Update comments.
10078         (Output_segment::Output_segment): Un-privatize copy constructor.
10079         (Output_segment::operator=): Un-privatize.
10080         * script-sections.cc (Output_section_element::Input_section_list):
10081         Change element type to Output_section::Simple_input_section.
10082         (Output_section_element_dot_assignment::set_section_addresses):
10083         Register output section data for relaxation clean up.
10084         (Output_data_exression::Output_data_expression): Adjust call to base
10085         constructor to fix data size.
10086         (Output_section_element_data::set_section_addresses): Register
10087         Output_data_expression object for relaxation clean up.
10088         (struct Input_section_info): Replace Relobj pointer and section index
10089         pair with Output_section::Simple_input_section and Convert struct to a
10090         class.
10091         (Input_section_sorter::operator()): Adjust access to
10092         Input_section_info data member to use accessors.
10093         (Output_section_element_input::set_section_addresses): Use layout
10094         parameter.  Adjust code to use Output_section::Simple_input_section
10095         and Input_secction_info classes.  Register filler for relaxation
10096         clean up.
10097         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10098         and section index pair with Output_section::Simple_input_section
10099         class.  Adjust code accordingly.
10100         (Phdrs_element::release_segment): New method definition.
10101         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10102         segment list.
10103         (Script_sections::release_segments): New method definition.
10104         * gold/script-sections.h (Script_sections::release_segments): New
10105         method declaration.
10106         * gold/target.h (Target::may_relax, Target::relax,
10107         Target::do_may_relax, Target::do_relax): New method definitions.
10108
10109 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10110
10111         * arm.cc (has_signed_unsigned_overflow): New function.
10112         (Arm_relocate_functions::abs8): New function.
10113         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10114         (Target_arm::Scan::global): Likewise.
10115         (Target_arm::relocate::relocate): Likewise.
10116         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10117         Likewise.
10118
10119 2009-09-16  Cary Coutant  <ccoutant@google.com>
10120
10121         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10122         * testsuite/Makefile.in: Regenerate.
10123
10124 2009-09-11  Nick Clifton  <nickc@redhat.com>
10125
10126         * po/gold.pot: Updated by the Translation project.
10127
10128 2009-09-08  Cary Coutant  <ccoutant@google.com>
10129
10130         * output.cc (Output_file::open): Add execute permission to empty file.
10131         * testsuite/Makefile.am (permission_test): New test.
10132         * testsuite/Makefile.in: Regenerate.
10133
10134 2009-09-02  Ian Lance Taylor  <iant@google.com>
10135
10136         * output.cc (Output_file::resize): Call map_no_anonymous rather
10137         than map.
10138
10139 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10140
10141         * gold.cc: Include "incremental.h".
10142         (queue_initial_tasks): Call Incremental_checker methods.
10143         * incremental.cc: Include "output.h".
10144         (Incremental_checker::can_incrementally_link_output_file): New
10145         method.
10146         * incremental.h (Incremental_checker): New class.
10147
10148         * output.cc (Output_file::open_for_modification): New method.
10149         (Output_file::map_anonymous): Changed return type to bool.  Record
10150         map in base_ field.
10151         (Output_file::map_no_anonymous): New method, broken out of map.
10152         (Output_file::map): Use map_no_anonymous and map_anonymous.
10153         * output.h (class Output_file): Update declarations.
10154
10155 2009-08-24  Cary Coutant  <ccoutant@google.com>
10156
10157         * options.h (Command_line::Pre_options): New class.
10158         (Command_line::pre_options): New member.
10159         * options.cc (gold::options::ready_to_register): New variable.
10160         (One_option::register_option): Do nothing if not registering options.
10161         Assert if same short option registered twice.
10162         (General_options::General_options): Turn off option registration when
10163         done constructing.
10164         (Command_line::Pre_options::Pre_options): New constructor.
10165
10166 2009-08-24  Cary Coutant  <ccoutant@google.com>
10167
10168         * options.h (General_options::no_keep_memory): Remove incorrect
10169         short option.
10170
10171 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10172
10173         * Makefile.am (am__skiplex, am__skipyacc): New.
10174         * Makefile.in: Regenerate.
10175
10176 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10177
10178         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10179         (INCLUDES): ... this.
10180         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10181         (AM_CPPFLAGS): Renamed from ...
10182         (INCLUDE): ... this.
10183         * Makefile.in, testsuite/Makefile.in: Regenerate.
10184
10185         * Makefile.in: Regenerate.
10186         * aclocal.m4: Likewise.
10187         * config.in: Likewise.
10188         * configure: Likewise.
10189         * testsuite/Makefile.in: Likewise.
10190
10191         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10192         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10193         * Makefile.in: Regenerate.
10194         * testsuite/Makefile.in: Regenerate.
10195
10196 2009-08-19  Cary Coutant  <ccoutant@google.com>
10197
10198         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10199         symbols in shared libraries overridden by hidden or internal symbols
10200         in the main program.
10201
10202 2009-08-19  Chris Demetriou  <cgd@google.com>
10203
10204         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10205         checking source file names in error messages.
10206
10207 2009-08-18  Doug Kwan  <dougkwan@google.com>
10208
10209         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10210         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10211         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10212         an elfcpp::Ehdr as parameter.
10213         * object.cc (Object::set_target): Remove the version that looks up
10214         a target and sets it.
10215         (Sized_relobj::setup): Take a Target object instead of
10216         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10217         (make_elf_sized_object): Find target and ask target to
10218         make an ELF object.
10219         * object.h: (Object::set_target): Remove the version that looks up
10220         a target and sets it.
10221         (Sized_relobj::setup): Take a Target object instead of
10222         an elfcpp:Ehdr as parameter.
10223         * target.cc: Include dynobj.h.
10224         (Target::do_make_elf_object_implementation): New.
10225         (Target::do_make_elf_object): New.
10226         * target.h (Target::make_elf_object): New template declaration.
10227         (Target::do_make_elf_object): New method declarations.
10228         (Target::do_make_elf_object_implementation): New template declaration.
10229
10230 2009-08-14  Ian Lance Taylor  <iant@google.com>
10231
10232         * gold.h (FUNCTION_NAME): Define.
10233         (gold_unreachable): Use FUNCTION_NAME.
10234
10235 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10236
10237         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10238         symbol in the --keep-unique list is not found.
10239
10240 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10241
10242         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10243         been maked as --keep-unique.
10244         (Icf::unfold_section): New function.
10245         * icf.h (Icf::unfold_section): New function.
10246         * options.h (General_options::keep_unique): New option.
10247         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10248         * testsuite/Makefile.in: Regenerate.
10249         * testsuite/icf_keep_unique_test.sh: New file.
10250         * testsuite/icf_keep_unique_test.cc: New file.
10251
10252 2009-08-12  Cary Coutant  <ccoutant@google.com>
10253
10254         PR 10471
10255         * resolve.cc (Symbol_table::resolve): Check for references from
10256         dynamic objects to hidden and internal symbols.
10257         * testsuite/Makefile.am (hidden_test.sh): New test.
10258         * testsuite/Makefile.in: Regenerate.
10259         * testsuite/hidden_test.sh: New script.
10260         * testsuite/hidden_test_1.c: New test source.
10261         * testsuite/hidden_test_main.c: New test source.
10262
10263 2009-08-11  Doug Kwan  <dougkwan@google.com>
10264
10265         * arm.cc: Update comments.
10266         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10267         segment to locate the .ARM.exidx section if present.
10268
10269 2009-08-09  Doug Kwan  <dougkwan@google.com>
10270
10271         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10272         patch.
10273
10274 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10275         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10276         compiler warnings.
10277
10278 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10279
10280         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10281         valid tls_segment only for non-debug-section relocations.
10282         * testsuite/Makefile.am: Add gc_tls_test.
10283         * testsuite/Makefile.in: Regenerate.
10284         * testsuite/gc_tls_test.cc: New file.
10285         * testsuite/gc_tls_test.sh: New file.
10286
10287 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10288
10289         * icf.cc: New file.
10290         * icf.h: New file.
10291         * Makefile.am (CCFILES): Add icf.cc.
10292         (HFILES): Add icf.h
10293         * Makefile.in: Regenerate.
10294         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10295         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10296         section, symbol and addend information for the relocs.
10297         * gold.cc (queue_middle_tasks): Call identical code folding.
10298         * gold.h: Add defines for multimap.
10299         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10300         to the call of finalize_local_symbols.
10301         * main.cc (main): Create object of class Icf.
10302         * object.cc (Sized_relobj::do_layout): Allow this function to be
10303         called twice during icf.
10304         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10305         to sections marked as identical by icf.
10306         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10307         when available.
10308         (Sized_relobj::do_section_entsize): New function.
10309         * object.h (Object::section_entsize): New function.
10310         (Object::do_section_entsize): New pure virtual function.
10311         (Relobj::finalize_local_symbols): Add new parameter.
10312         (Relobj::do_section_entsize): New function.
10313         * options.h (General_options::icf): New option.
10314         (General_options::icf_iterations): New option.
10315         (General_options::print_icf_sections): New option.
10316         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10317         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10318         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10319         icf.
10320         * symtab.cc (Symbol_table::is_section_folded): New function.
10321         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10322         to sections marked as identical by icf.
10323         * symtab.h (Symbol_table::set_icf): New function.
10324         (Symbol_table::icf): New function.
10325         (Symbol_table::is_section_folded): New function.
10326         (Symbol_table::icf_): New data member.
10327         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10328         * testsuite/Makefile.am: Add commands to build icf_test.
10329         * testsuite/Makefile.in: Regenerate.
10330         * testsuite/icf_test.sh: New file.
10331         * testsuite/icf_test.cc: New file.
10332
10333 2009-07-24  Chris Demetriou  <cgd@google.com>
10334
10335         * layout.cc (is_compressible_debug_section): Fix incorrect
10336         comment about compressed section names.
10337
10338 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10339
10340         PR 10419
10341         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10342
10343 2009-07-16  Ian Lance Taylor  <iant@google.com>
10344
10345         PR 10400
10346         * layout.h: #include <map>.
10347         (class Kept_section): Change from struct to class.  Add accessors
10348         and setters.  Add section size to Comdat_group mapping.  Change
10349         Comdat_group to std::map.  Add is_comdat_ field.  Add
10350         linkonce_size field in union.
10351         (class Layout): Update declaration of find_or_add_kept_section.
10352         Don't declare find_kept_object.
10353         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10354         parameter.  Add object, shndx, is_comdat, and is_group_name
10355         parameters.  Change all callers.  Adjust for new Kept_section.
10356         (Layout::find_kept_object): Remove.
10357         * object.cc (Sized_relobj::include_section_group): Update use of
10358         Kept_section.  Rename secnum to shndx.  Only record
10359         Kept_comdat_section if sections are the same size.
10360         (Sized_relobj::include_linkonce_section): Update use of
10361         Kept_section.  Only record Kept_comdat_section if sections are the
10362         same size.  Set size of linkonce section.
10363         (Sized_relobj::map_to_kept_section): Update call to
10364         get_kept_comdat_section.
10365         * object.h (class Sized_relobj): Rename fields in
10366         Kept_comdat_section to drop trailing underscores; change object
10367         field to Relobj*.  Change Kept_comdat_section_table to store
10368         struct rather than pointer.
10369         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10370         Add kept_object and kept_shndx parameters.  Change all callers.
10371         (Sized_relobj::get_kept_comdat_section): Change return type to
10372         bool.  Add kept_object and kept_shndx parameters.  Change all
10373         callers.
10374         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10375         Layout::find_or_add_kept_section.
10376
10377 2009-07-09  Ian Lance Taylor  <iant@google.com>
10378
10379         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10380         Reserve space in the hash table.
10381
10382 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10383
10384         * fileread.cc (File_read::get_mtime): New method.
10385         * fileread.h (Timespec): New structure.
10386         (File_read::get_mtime): New method.
10387         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10388         Renamed from timestamp_nsec.
10389         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10390         Elf_Xword.
10391         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10392         timestamp_nsec.
10393         (Incremental_inputs::report_archive): Save mtime; style fix.
10394         (Incremental_inputs::report_obejct): Save mtime; style fix.
10395         (Incremental_inputs::report_script): Save mtime; style fix.
10396         (Incremental_inputs::finalize_inputs): Style fix.
10397         (Incremental_inputs::finalize): Style fix.
10398         (Incremental_inputs::create_input_section_data): Store inputs
10399         mtime.
10400         * incremental.h (Incremental_inputs::report_script): Add mtime
10401         argument.
10402         (Incremental_inputs::Input_info::Input_info): Intialize only one
10403         union member.
10404         (Incremental_inputs::Input_info::archive): Move to nameless
10405         union.
10406         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10407         (Incremental_inputs::Input_info::script): Move to nameless union.
10408         (Incremental_inputs::mtime): New field.
10409         * script.cc (read_input_script): Pass file mtime to
10410         Incremental_input.
10411         * script.h (Script_info::inputs): Style fix.
10412
10413 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10414
10415         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10416         instead of 32.
10417
10418 2009-06-24  Ian Lance Taylor  <iant@google.com>
10419
10420         PR 10156
10421         * layout.cc (Layout::choose_output_section): If we find an
10422         existing section, update the flags.
10423         (Layout::create_notes): New function, broken out of
10424         Layout::finalize.
10425         (Layout::finalize): Don't create note sections.
10426         (Layout::create_note): Don't crash if linker script discards
10427         section.
10428         (Layout::create_gold_note): Likewise.
10429         (Layout::create_build_id): Likewise.  Don't set
10430         after_input_sections on the section.
10431         (Layout::create_executable_stack_info): Remove target parameter.
10432         Change caller.
10433         * layout.h (class Layout): Declare create_notes.  Update
10434         declaration of create_executable_stack_info.
10435         * gold.cc (queue_middle_tasks): Call create_notes.
10436         * output.cc (Output_section::update_flags_for_input_section): Move
10437         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10438         invalid.
10439         * output.h (Output_data::mark_address_invalid): New function.
10440         (class Output_section): Only declare, not define,
10441         update_flags_for_input_section.  Remove set_flags.
10442
10443 2009-06-24  Ian Lance Taylor  <iant@google.com>
10444
10445         * script-sections.cc (Output_section_definition::
10446         set_section_addresses): Rename shadowing local load_address to
10447         laddr.
10448
10449 2009-06-24  Ian Lance Taylor  <iant@google.com>
10450
10451         PR 10244
10452         * reloc.cc (relocate_sections): Skip empty relocation sections.
10453
10454 2009-06-23  Ian Lance Taylor  <iant@google.com>
10455
10456         PR 10156
10457         * layout.cc (Layout::create_note): Use choose_output_section
10458         rather than make_output_section.
10459
10460 2009-06-23  Ian Lance Taylor  <iant@google.com>
10461
10462         PR 10237
10463         * options.cc (General_options::parse_V): Set printed_version_.
10464         (General_options::General_options): Initialize printed_version_.
10465         * options.h (class General_options): Add printed_version_ field.
10466         * gold.cc (queue_initial_tasks): If there are no input files,
10467         don't give a fatal error if we printed the version information.
10468         (queue_middle_tasks): If using -r with a shared object, give a
10469         fatal error rather than an ordinary error.
10470
10471 2009-06-23  Ian Lance Taylor  <iant@google.com>
10472
10473         PR 10219
10474         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10475         (Layout::make_output_section): Set have_stabstr_section_ if we see
10476         a .stab*str section.
10477         (Layout::finalize): Call link_stabs_sections.
10478         (Layout::link_stabs_sections): New file.
10479         * layout.h (class Layout): Add have_stabstr_section_ field.
10480         Declare link_stabs_sections.
10481
10482 2009-06-23  Doug Kwan  <dougkwan@google.com>
10483
10484         * Makefile.am (libgold_a_LIBADD): New.
10485         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10486         * Makefile.in: Regenerate.
10487         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10488         * configure: Regenerate.
10489         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10490         * fileread.cc: Include sys/state.h
10491         * gold.h: Declare memmem and strndup if found missing.
10492         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10493
10494 2009-06-23  Ian Lance Taylor  <iant@google.com>
10495
10496         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10497         * configure: Rebuild.
10498
10499 2009-06-23  Ian Lance Taylor  <iant@google.com>
10500
10501         PR 10147
10502         * object.cc (Object::section_contents): Don't try to get a view if
10503         the section has length zero.
10504         (Object::handle_gnu_warning_section): If the section is empty, use
10505         the name of the section as the warning.
10506
10507 2009-06-23  Ian Lance Taylor  <iant@google.com>
10508
10509         PR 10133
10510         * stringpool.h (class Stringpool_template): Add optimize_ field.
10511         (Stringpool_template::set_optimize): New function.
10512         * stringpool.cc (Stringpool_template::Stringpool_template):
10513         Initialize optimize_ field.
10514         (Stringpool_template::set_string_offsets): Test local optimize
10515         fild rather than parameter.
10516         * layout.cc (Layout::Layout): Call set_optimize on the section
10517         name stringpool.
10518
10519 2009-06-22  Ian Lance Taylor  <iant@google.com>
10520
10521         PR 10030
10522         * yyscript.y: Parse TARGET.
10523         * script.cc (script_set_target): New function.
10524         * script-c.h (script_set_target): Declare.
10525         * options.cc (General_options::string_to_object_format): Rename
10526         from string_to_object_format in anonymous namespace.  Change
10527         callers.
10528         * options.h (class General_options): Declare
10529         string_to_object_format.
10530
10531 2009-06-22  Ian Lance Taylor  <iant@google.com>
10532
10533         * script-sections.cc (Script_sections::create_segments): Don't put
10534         program headers in a PT_LOAD segment if -n or -N.
10535
10536 2009-06-22  Ian Lance Taylor  <iant@google.com>
10537
10538         PR 10141
10539         * options.h (class General_options): Add -z lazy and -z now.  Sort
10540         -z options into alphabetical order.
10541         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10542
10543 2009-06-21  Ian Lance Taylor  <iant@google.com>
10544
10545         * layout.cc (Layout::make_output_section): Call
10546         Target::new_output_section.
10547         (Layout::attach_allocated_section_to_segment): Put large section
10548         sections in a separate load segment with the large segment flag
10549         set.
10550         (Layout::segment_precedes): Sort large data segments after other
10551         load segments.
10552         (align_file_offset): New static function.
10553         (Layout::set_segment_offsets): Use align_file_offset.
10554         * output.h (class Output_section): Add is_small_section_ and
10555         is_large_section_ fields.
10556         (Output_section::is_small_section): New function.
10557         (Output_section::set_is_small_section):  New function.
10558         (Output_section::is_large_section): New function.
10559         (Output_section::set_is_large_section): New function.
10560         (Output_section::is_large_data_section): New function.
10561         (class Output_segment): Add is_large_data_segment_ field.
10562         (Output_segment::is_large_data_segment): New function.
10563         (Output_segment::set_is_large_data_segment): New function.
10564         * output.cc (Output_section::Output_section): Initialize new
10565         fields.
10566         (Output_segment::Output_segment): Likewise.
10567         (Output_segment::add_output_section): Add assertion that large
10568         data sections always go in large data segments.  Force small data
10569         sections to the end of the list of data sections.  Force small BSS
10570         sections to the start of the list of BSS sections.  For large BSS
10571         sections to the end of the list of BSS sections.
10572         * symtab.h (class Symbol): Declare is_common_shndx.
10573         (Symbol::is_defined): Check Symbol::is_common_shndx.
10574         (Symbol::is_common): Likewise.
10575         (class Symbol_table): Define enum Commons_section_type.  Update
10576         declarations.  Add small_commons_ and large_commons_ fields.
10577         * symtab.cc (Symbol::is_common_shndx): New function.
10578         (Symbol_table::Symbol_table): Initialize new fields.
10579         (Symbol_table::add_from_object): Put small and large common
10580         symbols in the right list.
10581         (Symbol_table::sized_finalized_symbol): Check
10582         Symbol::is_common_shndx.
10583         (Symbol_table::sized_write_globals): Likewise.
10584         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10585         common symbol lists.  Don't call do_allocate_commons_list if the
10586         list is empty.
10587         (Symbol_table::do_allocate_commons_list): Remove is_tls
10588         parameter.  Add comons_section_type parameter.  Change all
10589         callers.  Handle small and large common symbols.
10590         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10591         Symbol::is_common_shndx.
10592         * resolve.cc (symbol_to_bits): Likewise.
10593         * target.h (Target::small_common_shndx): New function.
10594         (Target::small_common_section_flags): New function.
10595         (Target::large_common_shndx): New function.
10596         (Target::large_common_section_flags): New function.
10597         (Target::new_output_section): New function.
10598         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10599         small_common_section_flags, and large_common_section_flags
10600         fields.
10601         (Target::do_new_output_section): New virtual function.
10602         * arm.cc (Target_arm::arm_info): Initialize new fields.
10603         * i386.cc (Target_i386::i386_info): Likewise.
10604         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10605         Likewise.
10606         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10607         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10608         (Target_x86_64::do_new_output_section): New function.
10609         * configure.ac: Define conditional MCMODEL_MEDIUM.
10610         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10611         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10612         (large_LDFLAGS): Define.
10613         * testsuite/large.c: New file.
10614         * testsuite/testfile.cc (Target_test::test_target_info):
10615         Initialize new fields.
10616         * configure, testsuite/Makefile.in: Rebuild.
10617
10618 2009-06-05  Doug Kwan  <dougkwan@google.com>
10619
10620         * Makefile.am (CCFILES): Add target.cc.
10621         * Makefile.in: Regenerate.
10622         * i386.cc (class Target_i386): Define new virtual method to
10623         override do_is_local_label_name in parent.
10624         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10625         local symbols if --discard-locals or -X is given.
10626         * options.h (class General_options): Declare new options
10627         '--discard-locals' and '-X' for discarding locals.
10628         * target.h (class Target): Define new methods is_local_label_name.
10629         Declare new virtual method do_is_local_label_name.
10630         * target.cc: New file.
10631         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10632         (check_SCRIPTS): Add discard_locals_test.sh.
10633         (check_DATA): Add discard_local_tests.syms.
10634         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10635         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10636         * testsuite/Makefile.in: Regenerate.
10637         * testsuite/discard_locals_test.c: New file.
10638         * testsuite/discard_locals_test.sh: Same.
10639
10640 2009-06-05  Doug Kwan  <dougkwan@google.com>
10641
10642         * object.cc (Sized_relobj::Sized_relobj): Initialize
10643         discarded_eh_frame_shndx_ to -1U.
10644         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10645         section.
10646         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10647         a discarded .eh_frame section.
10648         (Sized_relobj::do_finalize_local_symbols): Ditto.
10649         * object.h (class Sized_relobj): Declare new member
10650         discarded_eh_frame_shndx_.
10651         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10652         (local_labels_test.o, local_labels_test): New rules.
10653         * testsuite/Makefile.in: Regenerate.
10654
10655 2009-06-04  Doug Kwan  <dougkwan@google.com>
10656
10657         * layout.cc (Layout::section_name_mapping): Add mapping for
10658         special ARM sections.
10659
10660 2009-06-03  Doug Kwan  <dougkwan@google.com>
10661
10662         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10663         (utils::has_overflow): Same.
10664
10665 2009-06-03  Ian Lance Taylor  <iant@google.com>
10666
10667         * layout.cc (Layout::section_name_mapping): New array, replacing
10668         Layout::linkonce_mapping.
10669         (Layout::section_name_mapping_count): New variable, replacing
10670         Layout::linkonce_mapping_count.
10671         (Layout::linkonce_output_name): Remove.
10672         (Layout::output_section_name): Rewrite.
10673         * layout.h (class Layout): Rename Linkonce_mapping to
10674         Section_name_mapping, linkonce_mapping to section_name_mapping,
10675         linkonce_mapping_count to section_name_mapping_count.  Don't
10676         declare linkonce_output_name.
10677
10678 2009-06-03  Doug Kwan  <dougkwan@google.com>
10679
10680         * gold/arm.cc (namespace utils): New.
10681         (Target_arm::reloc_is_non_pic): Define new method.
10682         (class Arm_relocate_functions): New.
10683         (Target_arm::Relocate::relocate): Handle relocation types used by
10684         Android.
10685
10686 2009-06-03  Ian Lance Taylor  <iant@google.com>
10687
10688         * arm.cc (Target_arm::scan::global): Use || instead of |.
10689
10690 2009-06-02  Doug Kwan  <dougkwan@google.com>
10691
10692         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10693         issued_non_pic_error_.
10694         (class Target_arm::Scan): Declare new method check_non_pic.
10695         Define new method symbol_needs_plt_entry.
10696         Declare new data member issued_non_pic_error_.
10697         (class Target_arm::Relocate): Declare new method
10698         should_apply_static_reloc.
10699         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10700         (Target_arm::Scan::check_non_pic): Define new method.
10701         (Target_arm::Scan::local): Handle a small subset of reloc types used
10702         by Android.
10703         (Target_arm::Scan::local): Same.
10704         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10705
10706 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10707
10708         * incremental.cc (Incremental_inputs::report_command_line): Filter
10709         out --incremental-* options.
10710
10711 2009-05-29  Doug Kwan  <dougkwan@google.com>
10712
10713         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10714         template class.
10715         (class Target_arm): Update comment.
10716         (Target_arm::Target_arm): Initialize new data members GOT_,
10717         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10718         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10719         and Target_arm::rel_dyn_section.
10720         Declare new_enum Target_arm::Got_type.
10721         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10722         and DYNBSS_.
10723         Update commments for member do_dynsym_value.
10724         (Target_arm::got_size, Target_arm::plt_section,
10725         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10726         new methods inside class defintion.
10727         (Target_arm::got_section): Define new method.
10728         (Target_arm::rel_dyn_section): Same.
10729         (Output_data_plt_arm): New template class.
10730         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10731         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10732         (Output_data_plt_arm::add_entry): Same.
10733         (Output_data_plt_arm::first_plt_entry): Define new
10734         static data member for PLT instruction template.
10735         (Output_data_plt_arm::plt_entry): Same.
10736         (Output_data_plt_arm::do_write): Define new method.
10737         (Target_arm::make_plt_entry): Same.
10738         (Target_arm::do_finalize_sections): Same.
10739         (Target_arm::do_dynsym_value): Same.
10740
10741 2009-05-28  Doug Kwan  <dougkwan@google.com>
10742
10743         * Makefile.am (TARGETSOURCES): Add arm.cc.
10744         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10745         * Makefile.in: Regenerate.
10746         * arm.cc: New file.
10747         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10748
10749 2009-05-26  Doug Kwan  <dougkwan@google.com>
10750
10751         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10752         (General_options::check_excluded_libs): Strip off directories in
10753         archive name before matching like GNU ld does.
10754         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10755         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10756         (exclude_libs_test_LDFLAGS): Add linker option
10757         -Wl,--exclude-libs,libexclude_libs_test_3
10758         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10759         an explicit archive without using -l.
10760         (alt/libexclude_libs_test_3.a): New make rule.
10761         * testsuite/Makefile.in: Regenerate.
10762         * testsuite/exclude_libs_test.c : Declare lib3_default().
10763         (main): Call it.
10764         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10765         * exclude_libs_test_3.c: New file.
10766
10767 2009-05-26  Nick Clifton  <nickc@redhat.com>
10768
10769         * po/id.po: New Indonesian translation.
10770         * po/gold.pot: Updated template file.
10771
10772 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10773
10774         * testsuite/Makefile.am: Add -ffunction-sections to compile
10775         gc_comdat_test files.  Add -Wl,--gc-sections to build
10776         gc_comdat_test.
10777         * testsuite/Makefile.in: Regenerate.
10778         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10779
10780 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10781
10782         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10783         kept comdat section was garbage collected.
10784         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10785         * testsuite/Makefile.in: Regenerate.
10786         * testsuite/gc_comdat_test.sh: New file.
10787         * testsuite/gc_comdat_test_1.cc: New file.
10788         * testsuite/gc_comdat_test_2.cc: New file.
10789
10790 2009-05-19  Doug Kwan  <dougkwan@google.com>
10791
10792         * archive.cc (Archive::Archive): Move constructor from archive.h
10793         to here.  Initialize no_export_.
10794         (Archive::get_elf_object_for_member): Set no_export flag of object.
10795         * archive.h (Archive::Archive): Move constructor body to
10796         archive.cc.
10797         (Archive::no_export): New method.
10798         (Archive::no_export_): New field.
10799         * object.h (Object::Object): Initialize no_export_ to false.
10800         (Object::no_export, Object::set_no_export): New methods.
10801         (Object::no_export_): New field.
10802         * options.cc (General_options::parse_exclude_libs): New method.
10803         (General_options::check_excluded_libs) Same.
10804         * options.h (exclude_libs): New option.
10805         (General_options::check_excluded_libs): New method declaration.
10806         (General_options::excluded_libs_): New field.
10807         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10808         default or protected visibility if an object has no-export flag set.
10809         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10810         (check_SCRIPTS): Add exclude_libs_test.sh.
10811         (check_DATA): Add exclude_libs_test.syms.
10812         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10813         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10814         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10815         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10816         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10817         libexclude_libs_test_2.a): New rules.
10818         * testsuite/Makefile.in: Regenerate.
10819         * testsuite/exclude_libs_test.c: New file.
10820         * testsuite/exclude_libs_test.sh: Ditto.
10821         * testsuite/exclude_libs_test_1.c: Ditto.
10822         * testsuite/exclude_libs_test_2.c: Ditto.
10823
10824 2009-05-15  Ian Lance Taylor  <iant@google.com>
10825
10826         * configure.ac: Check for declarations for cases where libiberty.h
10827         checks HAVE_DECL_xxx.
10828         * configure, config.in: Rebuild.
10829
10830 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10831
10832         * gold.h (Incremental_argument_list): Remove (invalid) forward
10833         declaration.
10834         * incremental.cc (Incremental_inputs::report_achive): New method.
10835         (Incremental_inputs::report_object): New method.
10836         (Incremental_inputs::report_script): New method.
10837         (Incremental_inputs::finalize_inputs): New method.
10838         (Incremental_inputs::finalize): Call finalize_inputs().
10839         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10840         Create inputs entries.
10841         * incremental.h (Incremental_input_type): New enum.
10842         (Incremental_inputs::Incremental_input): Initialize new fields.
10843         (Incremental_inputs::report_inputs): New method.
10844         (Incremental_inputs::report_achive): New method.
10845         (Incremental_inputs::report_object): New method.
10846         (Incremental_inputs::report_script): New method.
10847         (Incremental_inputs::finalize_inputs): New method.
10848         (Incremental_inputs::Input_info): New struct.
10849         (Incremental_inputs::Input_info_map): New typedef.
10850         (Incremental_inputs::lock_): New field.
10851         (Incremental_inputs::Inputs_): New field.
10852         (Incremental_inputs::Inputs_map): New field.
10853         * main.cc (main): Call Incremental_input::report_inputs.
10854         * options.h (Input_argument_list): Typedef moved from
10855         Input_arguments.
10856         (Input_file_group::Files): Remove, use ::Input_argument_list.
10857         (Input_file_group::Input_argument_list): Remove, use
10858         ::Input_argument_list.
10859         * plugin.cc (Plugin_manager::add_input_file): Add error in
10860         incremental build.
10861         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10862         functions.
10863         * script.cc (read_input_script): Call
10864         Incremental_input::report_script.
10865         * script.h (Script_info): New class.
10866
10867 2009-04-27  Ian Lance Taylor  <iant@google.com>
10868
10869         * x86_64.cc (do_adjust_output_section): Set entsize to
10870         plt_entry_size.
10871
10872 2009-04-23  Elliott Hughes  <enh@google.com>
10873
10874         * output.cc (Output_file::close): After short writes, continue
10875         writing from the correct offset in the buffer being written.
10876
10877 2009-04-23  Chris Demetriou  <cgd@google.com>
10878
10879         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10880         * configure: Regenerate.
10881         * config.in: Regenerate.
10882         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10883         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10884
10885 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10886
10887         * incremental.cc (Incremental_inputs_header_data): Renamed from
10888         Incremental_input_header_data.
10889         (Incremental_inputs_header_data::data_size): New field.
10890         (Incremental_inputs_header_data::put_input_file_count): Renamed
10891         from input_file_count.
10892         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10893         from command_line_offset.
10894         (Incremental_inputs_header_data::put_reserved): Renamed from
10895         put_reserved.
10896         (Incremental_inputs_entry_data): Renamed from
10897         Incremental_input_entry_data.
10898         (Incremental_inputs_entry_data::data_size): New field.
10899         (Incremental_inputs::report_command_line): New method.
10900         (Incremental_inputs::finalize): New method.
10901         (Incremental_inputs::create_incremental_inputs_data): New method.
10902         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10903         * incremental.h: New file.
10904         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10905         (Layout::finalize): Create incremental inputs section in
10906         incremental builds.
10907         (Layout::create_incremental_info_sections): New method.
10908         * layout.h (Layout::incremental_inputs): New method.
10909         (Layout::create_incremental_info_sections): New method.
10910         (Layout::incremental_inputs_): New field.
10911         * main.cc (main): Notify Incremental_input of the command line.
10912
10913 2009-04-01  Ian Lance Taylor  <iant@google.com>
10914             Mikolaj Zalewski  <mikolajz@google.com>
10915
10916         * gold.h (reserve_unordered_map): Define, three versions, one for
10917         each version of Unordered_map.
10918         * layout.cc (Layout::Layout): Remove options parameter.  Add
10919         number_of_input_files parameter.  Don't initialize options_.
10920         Initialize number_of_input_files_ and resized_signatures_.  Move
10921         sections_are_attached_.
10922         (Layout::layout_group): Reserve space for group_signatures_.
10923         (Layout::find_or_add_kept_section): Change name parameter to be a
10924         reference.  Resize signatures_ map when it gets large enough.
10925         (Layout::layout_eh_frame): Use parameters->options() instead of
10926         this->options_.
10927         (Layout::make_output_section): Likewise.
10928         (Layout::attach_allocated_section_to_segment): Likewise.
10929         (Layout::finalize, Layout::create_executable_stack): Likewise.
10930         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10931         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10932         * layout.h (class Layout): Update declarations.  Remove options_
10933         field.  Add number_of_input_files_ and resized_signatures_
10934         fields.  Move sections_are_attached_ field.
10935         * main.cc (main): Pass number of input files to Layout
10936         constructor.  Don't pass options.
10937
10938 2009-03-30  Ian Lance Taylor  <iant@google.com>
10939
10940         * ffsll.c (ffsll): Correct implementation.
10941
10942 2009-03-27  Ian Lance Taylor  <iant@google.com>
10943
10944         * ffsll.c: New file.
10945         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10946         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10947         * ftruncate.c (ftruncate): Declare before definition.
10948         * mremap.c (mremap): Likewise.
10949         * pread.c (pread): Likewise.
10950         * configure, Makefile.in, config.in: Rebuild.
10951
10952         * mremap.c: New file.
10953         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10954         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10955         (mremap): Declare if HAVE_MREMAP is not defined.
10956         * configure, Makefile.in, config.in: Rebuild.
10957
10958 2009-03-27  Cary Coutant  <ccoutant@google.com>
10959
10960         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10961         position independent.
10962         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10963         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10964
10965 2009-03-24  Cary Coutant  <ccoutant@google.com>
10966
10967         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10968         an executable.
10969         (needs_dynamic_reloc): Likewise.
10970
10971 2009-03-24  Ian Lance Taylor  <iant@google.com>
10972
10973         * yyscript.y (file_cmd): Recognize EXTERN.
10974         (extern_name_list, extern_name_list_body): New nonterminals.
10975         * script.cc (script_add_extern): Define.
10976         * script-c.h (script_add_extern): Declare.
10977
10978 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10979
10980         * object.cc (is_elf_object): Define.
10981         * object.h (is_elf_object): Declare.
10982         * archive.cc (Archive::get_elf_object_for_member): Call
10983         is_elf_object.
10984         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10985
10986 2009-03-24  Elliott Hughes  <enh@google.com>
10987
10988         * output.cc (Output_file::map_anonymous): Define.
10989         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10990         try an anonymous one.  Report the size if the mmap fails.
10991         * output.h (class Output_file): Declare map_anonymous.
10992
10993 2009-03-24  Ian Lance Taylor  <iant@google.com>
10994
10995         * target-select.cc (instantiate_target): Don't acquire the lock if
10996         the instantiated_target_ field has already been set.
10997
10998 2009-03-23  Ian Lance Taylor  <iant@google.com>
10999
11000         * gold-threads.h (class Initialize_lock): Define.
11001         * gold-threads.cc (class Initialize_lock_once): Define.
11002         (initialize_lock_control): New static variable.
11003         (initialize_lock_pointer): New static variable.
11004         (initialize_lock_once): New static function.
11005         (Initialize_lock::Initialize_lock): Define.
11006         (Initialize_lock::initialize): Define.
11007         * target-select.h: Include "gold-threads.h".
11008         (class Target_selector): Add lock_ and initialize_lock_ fields.
11009         Don't define instantiate_target, just declare it.
11010         * target-select.cc (Target_selector::Target_selector): Initialize
11011         new fields.
11012         (Target_selector::instantiate_target): Define.
11013         * descriptors.h: Include "gold-threads.h".
11014         (class Descriptors): Add initialize_lock_ field.
11015         * descriptors.cc (Descriptors::Descriptors): Initialize new
11016         field.
11017         (Descriptors::open): Use initialize_lock_ field
11018         * errors.h (class Errors): Add initialize_lock_ field.
11019         * errors.cc (Errors::Errors): Initialize new field.
11020         (Errors::initialize_lock): Use initialize_lock_ field.
11021         * powerpc.cc (class Target_selector_powerpc): Remove
11022         instantiated_target_ field.  In do_recognize call
11023         instantiate_target rather than do_instantiate_target.  In
11024         do_instantiate_target just allocate a new target.
11025         * sparc.cc (class Target_selector_sparc): Likewise.
11026
11027         * freebsd.h: New file.
11028         * i386.cc: Include "freebsd.h".
11029         (Target_i386): Derive from Target_freebsd rather than
11030         Sized_target.
11031         (Target_selector_i386): Derive from Target_selector_freebsd rather
11032         than Target_selector.
11033         * x86_64.cc: Include "freebsd.h".
11034         (Target_x86_64): Derive from Target_freebsd rather than
11035         Sized_target.
11036         (Target_selector_x86_64): Derive from Target_selector_freebsd
11037         rather than Target_selector.
11038         * target.h (class Target): Add adjust_elf_header and
11039         do_adjust_elf_header.
11040         * output.cc (Output_file_header:: do_sized_write): Call target
11041         adjust_elf_header routine.
11042         * configure.tgt: Set targ_osabi.
11043         * configure.ac: Define GOLD_DEFAULT_OSABI.
11044         * parameters.cc (Parameters::default_target): Pass
11045         GOLD_DEFAULT_OSABI to select_target.
11046         * target-select.h (class Target_selector): Make instantiate_target
11047         protected rather than private.
11048         * Makefile.am (HFILES): Add freebsd.h.
11049         * configure, Makefile.in, config.in: Rebuild.
11050
11051         * merge.cc (do_add_input_section): Correct pend value.  Change
11052         message about last entry not being null terminated from error to
11053         warning.
11054
11055 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11056
11057         * incremental.cc: New file.
11058         * Makefile.am (CCFILES): Add incremental.cc.
11059         * Makefile.in: Rebuild.
11060
11061 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11062
11063         * layout.cc (Layout::output_section_name): Preserve names
11064         of '.note.' sections.
11065
11066 2009-03-19  Ian Lance Taylor  <iant@google.com>
11067
11068         * descriptors.cc (Descriptors::open): Check that the options are
11069         valid before using them.
11070
11071 2009-03-18  Ian Lance Taylor  <iant@google.com>
11072
11073         * script-sections.h: Include <list>.
11074         (class Script_sections): Change Sections_elements from std::vector
11075         to std::list.  Typedef public Elements_iterator.  Add
11076         orphan_section_placement_, data_segment_align_start_, and
11077         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11078         field.
11079         * script-sections.cc (class Orphan_section_placement): New class.
11080         (class Sections_element): Add virtual functions is_relro and
11081         orphan_section_init.  Remove virtual function place_orphan_here.
11082         (class Output_section_definition): Add is_relro and
11083         orphan_section_init.  Remove place_orphan_here.
11084         (class Orphan_output_section): Likewise.
11085         (Script_sections::Script_sections): Update for field changes.
11086         (Script_sections::data_segment_align): Set saw_data_segment_align_
11087         and data_segment_align_start_, not data_segment_align_index.
11088         (Script_sections::data_segment_relro_end): Check
11089         saw_data_segment_align_.  Use data_segment_align_start_ rather
11090         than data_segment_align_index_.
11091         (Script_sections::place_orphan): Rewrite to use
11092         Orphan_section_placement.
11093
11094 2009-03-17  Ian Lance Taylor  <iant@google.com>
11095
11096         * archive.cc (Archive::add_symbols): Check for a version attached
11097         to the symbol name in the archive map.
11098         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11099         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11100         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11101         (ver_test_11.a): New target.
11102         * testsuite/Makefile.in: Rebuild.
11103
11104         * configure.ac: Check for chsize and posix_fallocate.  Replace
11105         ftruncate.
11106         * ftruncate.c: New file, from gnulib.
11107         * output.cc (posix_fallocate): Define dummy version if not
11108         HAVE_POSIX_FALLOCATE.
11109         (Output_file::map): Call posix_fallocate rather than lseek and
11110         write.
11111         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11112         * configure, Makefile.in, config.in: Rebuild.
11113
11114 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11115
11116         * layout.h (Layout::create_note): Add section_name parameter.
11117         * layout.cc (Layout::create_note): Likewise.
11118         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11119
11120 2009-03-17  Ian Lance Taylor  <iant@google.com>
11121
11122         * descriptors.cc: Include "options.h".
11123         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11124         (Descriptors::open): Always use O_CLOEXEC when opening a new
11125         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11126         then set FD_CLOEXEC.
11127
11128         * sparc.cc (class Target_sparc): Add has_got_section.
11129         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11130         make sure we have a GOT section.
11131
11132         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11133         (Target_sparc::Scan::local): Likewise.
11134         (Target_sparc::Scan::global): Likewise.
11135         (Target_sparc::Relocate::relocate): Likewise.
11136         (Target_sparc::Relocate::relocate_tls): Likewise.
11137
11138         * symtab.cc (Symbol_table::define_default_version): New function,
11139         broken out of add_from_object.
11140         (Symbol_table::add_from_object): Call define_default_version.
11141         (Symbol_table::define_special_symbol): Add resolve_oldsym
11142         parameter.  Change all callers.  If the version for a symbol comes
11143         from a version script, resolve it with the symbol with the same
11144         name with no version.  Also add the symbol without a version if
11145         appropriate.
11146         (do_define_in_output_data): If resolving with oldsym, don't delete
11147         sym.
11148         (do_define_in_output_segment): Likewise.
11149         (do_define_as_constant): Likewise.
11150         * symtab.h (class Symbol_table): Update declarations.
11151
11152 2009-03-13  Ian Lance Taylor  <iant@google.com>
11153
11154         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11155         (Read_symbols::requeue): New function.
11156         (Read_symbols::do_read_symbols): If make_elf_object fails because
11157         the target type is not configured, and the file was searched for,
11158         issue a warning and retry with the next directory.
11159         (Add_symbols::run): If the file has an incompatible format, and
11160         it was searched for, requeue the Read_symbols task.  On error,
11161         release the object.
11162         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11163         dirindex parameter to constructor.  Change all callers.  Declare
11164         incompatible_warning and requeue.
11165         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11166         input_argument_ and input_group_ fields.  Add them to
11167         constructor.  Change all callers.
11168         (class Read_script): Add dirindex_ field.  Add it to constructor.
11169         Change all callers.
11170         * archive.cc (Archive::setup): Remove input_objects parameter.
11171         Change all callers.
11172         (Archive::get_file_and_offset): Likewise.
11173         (Archive::read_all_symbols): Likewise.
11174         (Archive::read_symbols): Likewise.
11175         (Archive::get_elf_object_for_member): Remove input_objects
11176         parameter.  Add punconfigured parameter.  Change all callers.
11177         (Archive::add_symbols): Change return type to bool.  Check return
11178         value of include_member.
11179         (Archive::include_all_members): Likewise.
11180         (Archive::include_member): Change return type to bool.  Return
11181         false if first included object has incompatible target.  Set
11182         included_member_ field.
11183         (Add_archive_symbols::run): If add_symbols returns false, requeue
11184         Read_symbols task.
11185         * archive.h (class Archive): Add included_member_ field.
11186         Initialize it in constructor.  Add input_file and searched_for
11187         methods.  Update declarations.
11188         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11189         input_argument_ fields.  Add them to constructor.  Change all
11190         callers.
11191         * script.cc: Include "target-select.h".
11192         (class Parser_closure): Add skip_on_incompatible_target_ and
11193         found_incompatible_target_ fields.  Add
11194         skip_on_incompatible_target parameter to constructor.  Change all
11195         callers.  Add methods skip_on_incompatible_target,
11196         clear_skip_on_incompatible_target, found_incompatible_target, and
11197         set_found_incompatible_target.
11198         (read_input_script): Add dirindex parameter.  Change all callers.
11199         If parser finds an incompatible target, requeue Read_symbols
11200         task.
11201         (script_set_symbol): Clear skip_on_incompatible_target in
11202         closure.
11203         (script_add_assertion, script_parse_option): Likewise.
11204         (script_start_sections, script_add_phdr): Likewise.
11205         (script_check_output_format): New function.
11206         * script.h (read_input_script): Update declaration.
11207         * script-c.h (script_check_output_format): Declare.
11208         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11209         (ignore_cmd): Remove OUTPUT_FORMAT.
11210         * fileread.cc (Input_file::Input_file): Add explicit this.
11211         (Input_file::will_search_for): New function.
11212         (Input_file::open): Add pindex parameter.  Change all callers.
11213         * fileread.h (class Input_file): Add input_file_argument method.
11214         Declare will_search_for.  Update declarations.
11215         * object.cc (make_elf_object): Add punconfigured parameter.
11216         Change all callers.
11217         * object.h (class Object): Make input_file public.  Add
11218         searched_for method.
11219         (make_elf_object): Update declaration.
11220         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11221         restart search.
11222         * dirsearch.h (class Dirsearch): Update declaration.
11223         * options.h (class General_options): Add --warn-search-mismatch.
11224         * parameters.cc (Parameters::is_compatible_target): New function.
11225         * parameters.h (class Parameters): Declare is_compatible_target.
11226         * workqueue.cc (Workqueue::add_blocker): New function.
11227         * workqueue.h (class Workqueue): Declare add_blocker.
11228
11229         * fileread.cc (Input_file::open): Remove options parameter.
11230         Change all callers.
11231         (Input_file::open_binary): Likewise.
11232         * script.cc (read_input_script): Likewise.
11233         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11234         options parameter from constructor.  Change all callers.
11235         (class Read_script): Likewise.
11236         * fileread.h (class Input_file): Update declarations.
11237         * script.h (read_input_script): Update declaration.
11238
11239 2009-03-10  Nick Clifton  <nickc@redhat.com>
11240
11241         * po/es.po: New Spanish translation.
11242
11243 2009-03-06  Cary Coutant  <ccoutant@google.com>
11244
11245         * options.cc (parse_short_option): Keep dash_z from registering itself.
11246
11247 2009-03-03  Ian Lance Taylor  <iant@google.com>
11248
11249         PR 9918
11250         * target-reloc.h (relocate_section): Pass output_section to
11251         relocate.
11252         * i386.cc (Target_i386::should_apply_static_reloc): Add
11253         output_section parameter.  Change all callers.
11254         (Target_i386::Relocate::relocate): Add output_section parameter.
11255         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11256         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11257         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11258         * testsuite/two_file_shared.sh: New script.
11259         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11260         (check_DATA): Add two_file_shared.dbg.
11261         (two_file_shared.dbg): New target.
11262         * testsuite/Makefile.in: Rebuild.
11263
11264 2009-03-01  Ian Lance Taylor  <iant@google.com>
11265
11266         * configure.ac: Check for byteswap.h.
11267         * configure: Rebuild.
11268         * config.in: Rebuild.
11269
11270 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11271
11272         * layout.cc (Layout::find_or_add_kept_section): New function.
11273         (Layout::add_comdat): Removed.
11274         * layout.h (struct Kept_section): Move out of class Layout.
11275         Remove trailing underscores from field names.  Add group_sections
11276         field.  Rename group_ field to is_group.  Change all uses.
11277         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11278         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11279         comdat_groups_ field.
11280         (Sized_relobj::include_section_group): Use
11281         find_or_add_kept_section and Kept_section::group_sections.
11282         (Sized_relobj::include_linkonce_section): Likewise.
11283         * object.cc (class Sized_relobj): Don't define Comdat_group or
11284         Comdat_group_table.  Remove find_comdat_group and
11285         add_comdat_group.  Remove comdat_groups_ field.
11286         * plugin.cc (include_comdat_group): Use
11287         Layout::find_or_add_kept_section.
11288
11289 2009-02-28  Ian Lance Taylor  <iant@google.com>
11290
11291         * README: --gc-sections and map files are now supported.  Document
11292         some build requirements.
11293
11294         PR 6992
11295         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11296         relocatable link set the value of the section symbol to zero.
11297         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11298         relocatable link don't include the section address in the local
11299         symbol value.
11300
11301 2009-02-27  Ian Lance Taylor  <iant@google.com>
11302
11303         PR 6811
11304         * options.h (class Search_directory): Add is_system_directory.
11305         (class General_options): Declare is_in_system_directory.
11306         * options.cc (get_relative_sysroot): Make static.
11307         (get_default_sysroot): Make static.
11308         (General_optoins::is_in_system_directory): New function.
11309         * fileread.cc (Input_file::is_in_system_directory): New function.
11310         * fileread.h (class Input_file): Declare is_in_system_directory.
11311         * object.h (class Object): Add is_in_system_directory.
11312         (class Input_objects): Remove system_library_directory_ field.
11313         * object.cc (Input_objects::add_object): Don't set
11314         system_library_directory_.
11315         (input_objects::found_in_system_library_directory): Remove.
11316         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11317         parameter.  Change all callers.
11318         (Symbol_table::sized_write_globals): Likewise.
11319         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11320         Call Object::is_in_system_directory.
11321         * symtab.h (class Symbol_table): Update declarations.
11322
11323         PR 5990
11324         * descriptors.h (Open_descriptor): Add is_on_stack field.
11325         * descriptors.cc (Descriptors::open): If the descriptor is on the
11326         top of the stack, remove it.  Initialize is_on_stack field.
11327         (Descriptors::release): Only add pod to stack if it is not on the
11328         stack already.
11329         (Descriptors::close_some_descriptor): Clear stack_next and
11330         is_on_stack fields.
11331
11332         PR 7091
11333         * output.cc (Output_section::find_starting_output_address): Rename
11334         from starting_output_address; add PADDR parameter; change return
11335         type.
11336         * output.h (class Output_section): Declare
11337         find_starting_output_address instead of starting_output_address.
11338         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11339         section symbol for which we can't find a merge section.
11340
11341         PR 9836
11342         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11343         hidden or internal, force the symbol to be local.
11344         * resolve.cc (Symbol::override_visibility): Define.
11345         (Symbol::override_base): Use override_visibility.
11346         (Symbol_table::resolve): Likewise.
11347         (Symbol::override_base_with_special): Likewise.
11348         (Symbol_table::override_with_special): If the visibility is hidden
11349         or internal, force the symbol to be local.
11350         * symtab.h (class Symbol): Add set_visibility and
11351         override_visibility.
11352         * testsuite/ver_test_1.sh: New file.
11353         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11354         (check_DATA): Add ver_test_1.syms.
11355         (ver_test_1.syms): New target.
11356         * testsuite/Makefile.in: Rebuild.
11357
11358 2009-02-25  Cary Coutant  <ccoutant@google.com>
11359
11360         * layout.cc (Layout::choose_output_section): Don't rename sections
11361         when using a linker script that has a SECTIONS clause.
11362         * Makefile.in: Regenerate.
11363
11364         * testsuite/Makefile.am (script_test_5.sh): New test case.
11365         * testsuite/Makefile.in: Regenerate.
11366         * testsuite/script_test_5.cc: New file.
11367         * testsuite/script_test_5.sh: New file.
11368         * testsuite/script_test_5.t: New file.
11369
11370 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11371
11372         * archive.cc (Archive::include_member): Update calls to add_symbols.
11373         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11374         the Layout argument.
11375         * dynobj.h (do_add_symbols): Add the Layout argument.
11376         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11377         Layout argument.
11378         * object.h (Object::add_symbols): Add the Layout argument.
11379         (Object::do_add_symbols): Add the Layout argument.
11380         (Sized_relobj::do_add_symbols): Add the Layout argument.
11381         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11382         Unify the two versions.
11383         (Add_plugin_symbols): Remove.
11384         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11385         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11386         (Add_plugin_symbols): Remove.
11387         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11388         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11389         (Add_symbols::run): Make it work with Pulginobj.
11390
11391 2009-02-06  Ian Lance Taylor  <iant@google.com>
11392
11393         * object.cc (Sized_relobj::do_layout): Make info message start
11394         with lower case letter.
11395
11396 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11397
11398         * binary.cc: Fix file comment.
11399
11400         * options.h (enum Incremental_disposition): Define.
11401         (class General_options): Add new options: --incremental,
11402         --incremental_changed, --incremental_unchanged,
11403         --incremental_unknown.  Add incremental_disposition_ and
11404         implicit_incremental_ fields.
11405         (General_options::incremental_disposition): New function.
11406         (class Position_dependent_options): Add incremental_disposition
11407         option.
11408         (Position_dependent_options::copy_from_options): Set incremental
11409         dispositions.
11410         * options.cc (General_options::parse_incremental_changed): New
11411         function.
11412         (General_options::parse_incremental_unchanged): New function.
11413         (General_options::parse_incremental_unknown): New function.
11414         (General_options::General_options): Initialize new fields
11415         incremental_disposition_ and implicit_incremental_.
11416         (General_options::finalize): Check for uasge of --incremental-*
11417         without --incremental.
11418
11419 2009-02-06  Chris Demetriou  <cgd@google.com>
11420
11421         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11422         pointer and to report location as the file name associated with
11423         the symbol.
11424         (gold_undefined_symbol_at_location): New function to replace the
11425         old gold_undefined_symbol functionality.
11426         * target-reloc.h (relocate_section): Update to use
11427         gold_undefined_symbol_at_location.
11428         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11429         Call gold_undefined_symbol function rather than gold_error.
11430         * errors.h (Errors::undefined_symbol): Take location as a
11431         string, rather than calculating it from a relocation.
11432         * errors.cc (Errors::fatal): Print "fatal error:" before the
11433         formatted message.
11434         (Errors::error, Errors::error_at_location): Print "error: "
11435         before the formatted message.
11436         (Errors::undefined_symbol): Take location as a string, rather
11437         than calculating it from a relocation.
11438         (gold_undefined_symbol_at_location): New function akin to
11439         old gold_undefined_symbol, calculates location from relocation.
11440         (gold_undefined_symbol): Change to take only a Symbol pointer
11441         and to report location as the file name associated with the symbol.
11442         * testsuite/debug_msg.sh: Update for changed error messages.
11443         * testsuite/undef_symbol.sh: Likewise.
11444
11445 2009-02-04  Duncan Sands  <baldrick@free.fr>
11446
11447         PR 9812
11448         * reduced_debug_output.h
11449         (Output_reduced_debug_abbrev_section::failed): Use format for
11450         gold_warning.
11451         (Output_reduced_debug_info_section::faild): Likewise.
11452
11453 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11454
11455         * script.cc (Lazy_demangler): New class.
11456         (Version_script_info::get_symbol_version_helper): Demangle a
11457         symbol only once.
11458
11459 2009-01-29  Cary Coutant  <ccoutant@google.com>
11460
11461         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11462         to __tls_get_addr.
11463         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11464
11465 2009-01-28  Ian Lance Taylor  <iant@google.com>
11466
11467         * version.cc (version_string): Bump to 1.9.
11468
11469         * gold.h: Include <cstring> and <stdint.h>.
11470         * version.cc: Include <cstdio>.
11471         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11472         warning.
11473         * reduced_debug_output.cc (insert_into_vector): Rename from
11474         Insert_into_vector; change all callers.  Use Swap_unaligned to
11475         avoid aliasing issue; remove union since it is unnecessary.
11476
11477 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11478
11479         * Makefile.am (CCFILES): Add gc.cc.
11480         (HFILES): Add gc.h.
11481         * Makefile.in: Regenerate.
11482         * gold.cc (Gc_runner): New class.
11483         (queue_initial_tasks): Call garbage collection related tasks
11484         when corresponding options are invoked.
11485         (queue_middle_gc_tasks): New function.
11486         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11487         processed early before laying out sections during garbage collection.
11488         * gold.h (queue_middle_gc_tasks): New function.
11489         (is_prefix_of): Move from "layout.cc".
11490         * i386.cc (Target_i386::gc_process_relocs): New function.
11491         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11492         * main.cc (main): Create object of class "Garbage_collection".
11493         * object.cc (Relobj::copy_symbols_data): New function.
11494         (Relobj::is_section_name_included): New function.
11495         (Sized_relobj::do_layout): Allow this function to be called twice
11496         during garbage collection and defer layout of section during the
11497         first call.
11498         * object.h (Relobj::get_symbols_data): New function.
11499         (Relobj::is_section_name_included): New function.
11500         (Relobj::copy_symbols_data): New function.
11501         (Relobj::set_symbols_data): New function.
11502         (Relobj::get_relocs_data): New function.
11503         (Relobj::set_relocs_data): New function.
11504         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11505         (Relobj::gc_process_relocs): New function.
11506         (Relobj::do_gc_process_relocs): New pure virtual function.
11507         (Relobj::sd_): New data member.
11508         (Sized_relobj::is_output_section_offset_invalid): New function.
11509         (Sized_relobj::do_gc_process_relocs): New function.
11510         * options.h (General_options::gc_sections): Modify to not be a no-op.
11511         (General_options::print_gc_sections): New option.
11512         * plugin.cc (Plugin_finish::run): Remove function call to
11513         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11514         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11515         * reloc.cc (Read_relocs::run): Add task to process relocs and
11516         determine unreferenced sections when doing garbage collection.
11517         (Gc_process_relocs): New class.
11518         (Sized_relobj::do_gc_process_relocs): New function.
11519         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11520         sections that are garbage collected.
11521         * reloc.h (Gc_process_relocs): New class.
11522         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11523         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11524         symbols whose corresponding sections are garbage collected.
11525         (Symbol_table::Symbol_table): Add new parameter for the garbage
11526         collection object.
11527         (Symbol_table::gc_mark_undef_symbols): New function.
11528         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11529         (Symbol_table::gc_mark_dyn_syms): New function.
11530         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11531         as garbage.
11532         (Symbol_table::add_from_object): Likewise.
11533         (Symbol_table::add_from_relobj): When building shared objects, do not
11534         treat externally visible symbols as garbage.
11535         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11536         table information for static and relocatable links.
11537         * symtab.h (Symbol_table::set_gc): New function.
11538         (Symbol_table::gc): New function.
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::gc_): New data member.
11543         * target.h (Sized_target::gc_process_relocs): New pure virtual
11544         function.
11545         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11546         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11547
11548 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11549
11550         * options.h (General_options::gc_sections): Define as a no-op for now.
11551         (General_options::no_keep_memory): Ditto.
11552         (General_options::Bshareable): Define.
11553         * options.cc (General_options::finalize): Honor -Bshareable.
11554
11555 2009-01-20  Andreas Schwab  <schwab@suse.de>
11556
11557         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11558         read the value in the contents, since we don't use it.  Use the
11559         template endianness when writing.
11560         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11561
11562 2009-01-19  Andreas Schwab  <schwab@suse.de>
11563
11564         * configure.tgt (powerpc64-*): Fix targ_obj.
11565
11566 2009-01-15  Ian Lance Taylor  <iant@google.com>
11567
11568         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11569         local symbols when stripping all symbols.
11570
11571 2009-01-14  Cary Coutant  <ccoutant@google.com>
11572
11573         * output.cc (Output_reloc): Add explicit instantiations.
11574
11575 2009-01-14  Cary Coutant  <ccoutant@google.com>
11576
11577         * archive.cc (Archive::get_elf_object_for_member): Remove call
11578         to File_read::claim_for_plugin.
11579         * descriptors.cc (Descriptors::open): Remove reference to
11580         is_claimed.
11581         (Descriptors::claim_for_plugin): Remove.
11582         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11583         (Descriptors::is_claimed): Remove.
11584         (claim_descriptor_for_plugin): Remove.
11585         * fileread.cc (File_read::claim_for_plugin): Remove.
11586         * fileread.h (File_read::claim_for_plugin): Remove.
11587         (File_read::descriptor): Reopen descriptor if necessary.
11588         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11589         (Plugin_manager::all_symbols_read): Add task parameter. Change
11590         all callers.
11591         (Plugin_manager::get_input_file): New function.
11592         (Plugin_manager::release_input_file): New function.
11593         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11594         corresponding data member.
11595         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11596         and pass to base constructor. Change all callers.
11597         (get_input_file, release_input_file): New functions.
11598         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11599         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11600         (Plugin_manager::all_symbols_read): Add task parameter.
11601         (Plugin_manager::get_input_file): New function.
11602         (Plugin_manager::release_input_file): New function.
11603         (Plugin_manager::task_): New data member.
11604         (Pluginobj::Pluginobj): Add filesize parameter.
11605         (Pluginobj::filename): New function.
11606         (Pluginobj::descriptor): New function.
11607         (Pluginobj::filesize): New function.
11608         (Pluginobj::filesize_): New data member.
11609         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11610         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11611         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11612
11613         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11614         with archive libraries.
11615         * testsuite/Makefile.in: Regenerate.
11616         * testsuite/plugin_test.c (struct sym_info): New type.
11617         (get_input_file, release_input_file): New static variables.
11618         (onload): Capture new transfer vector entries.
11619         (claim_file_hook): Stop reading at end of file according to filesize.
11620         Factor out parsing of readelf output into separate function.
11621         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11622         APIs and get the source file name from the symbol table.  Convert
11623         source file name to corresponding object file name.  Print info
11624         message when adding new input files.
11625         (parse_readelf_line): New function.
11626         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11627         * testsuite/plugin_test_2.sh: Likewise.
11628         * testsuite/plugin_test_3.sh: Likewise.
11629         * testsuite/plugin_test_4.sh: New test case.
11630
11631 2009-01-07  Ian Lance Taylor  <iant@google.com>
11632
11633         * version.cc (version_string): Bump to 1.8.
11634
11635 2008-12-23  Cary Coutant  <ccoutant@google.com>
11636
11637         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11638         * plugin.cc (Plugin_manager::finish): Rename as
11639         layout_deferred_objects.  Move cleanup to separate function.
11640         (Plugin_manager::cleanup): New function.
11641         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11642         separately.
11643         * plugin.h (Plugin_manager::finish): Rename as
11644         layout_deferred_objects.
11645         (Plugin_manager::cleanup): New function.
11646         (Plugin_manager::cleanup_done): New field.
11647
11648 2008-12-23  Cary Coutant  <ccoutant@google.com>
11649
11650         * plugin.cc (is_visible_from_outside): New function.
11651         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11652         so we don't return "IR only" status for exported symbols or -r links.
11653
11654         * testsuite/Makefile.am (plugin_test_3): New test case.
11655         * testsuite/Makefile.in: Regenerate.
11656         * testsuite/plugin_test_3.sh: New file.
11657
11658 2008-12-22  Cary Coutant  <ccoutant@google.com>
11659
11660         * object.cc (Sized_relobj::layout_section): New function.
11661         (Sized_relobj::do_layout): Defer layout of input sections until after
11662         plugin has provided replacement files.
11663         (Sized_relobj::do_layout_deferred_sections): New function.
11664         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11665         (Relobj::layout_deferred_sections): New function.
11666         (Relobj::do_layout_deferred_sections): New function.
11667         (Sized_relobj::do_layout_deferred_sections): New function.
11668         (Sized_relobj::layout_section): New function.
11669         (Sized_relobj::Deferred_layout): New structure.
11670         (Sized_relobj::deferred_layout_): New field.
11671         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11672         Change all callers.  Layout deferred sections.
11673         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11674         references.
11675         (Plugin_hook::run): Move code from do_plugin_hook inline.
11676         (Plugin_hook::do_plugin_hook): Remove.
11677         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11678         (Plugin_manager::finish): Renamed, was cleanup.
11679         (Plugin_manager::should_defer_layout): New function.
11680         (Plugin_manager::add_deferred_layout_object): New function.
11681         (Plugin_manager::Deferred_layout_list): New type.
11682         (Plugin_manager::deferred_layout_objects_): New field.
11683         (Plugin_hook::do_plugin_hook): Remove.
11684
11685 2008-12-17  Ian Lance Taylor  <iant@google.com>
11686
11687         * options.h (class General_options): Add --no case for
11688         --export-dynamic.
11689
11690 2008-12-16  Cary Coutant  <ccoutant@google.com>
11691
11692         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11693         vector.
11694         (Plugin_manager::claim_file): Create plugin object even if
11695         plugin did not call the add_symbols callback.
11696         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11697         asking for more symbols than were added.
11698         * testsuite/Makefile.am (plugin_test_1): Add test case with
11699         no global symbols.
11700         (empty.syms): New target.
11701         * testsuite/Makefile.in: Regenerate.
11702         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11703         message. Don't call add_symbols if no globals.
11704         (all_symbols_read_hook): Don't provide replacement for empty
11705         claimed file.
11706
11707 2008-12-12  Ian Lance Taylor  <iant@google.com>
11708
11709         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11710         r_type == 0 for a local symbol with r_sym == 0.
11711         (scan_relocatable_relocs): Pass r_sym to
11712         local_non_section_strategy.
11713         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11714         r_sym parameter.
11715
11716         * configure.ac: Update test for TLS descriptors: they are
11717         supported as of glibc 2.9.
11718         * configure: Rebuild.
11719
11720 2008-12-11  Ian Lance Taylor  <iant@google.com>
11721
11722         PR 7091
11723         * target-reloc.h (Default_scan_relocatable_relocs): For each
11724         function, map r_type == 0 to RELOC_DISCARD.
11725
11726 2008-12-10  Cary Coutant  <ccoutant@google.com>
11727
11728         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11729         object to override a kept COMDAT group from a plugin object.
11730
11731 2008-12-09  Ian Lance Taylor  <iant@google.com>
11732
11733         PR 7088
11734         * yyscript.y (file_cmd): Handle INPUT.
11735
11736         * testsuite/initpri1.c: Change all declarations to be full
11737         prototypes by adding void, to avoid compiler warnings.
11738
11739 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11740
11741         * options.cc (General_options::parse_plugin_opt): New.
11742         (General_options::add_plugin): The argument now is just the filename.
11743         (General_options::add_plugin_option): New.
11744         * options.h (plugin_opt): New.
11745         (add_plugin): Change argument name.
11746         (add_plugin_option): New.
11747         * plugin.cc (Plugin::load): Don't parse the plugin option.
11748         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11749         (Plugin::add_option): New.
11750         (Plugin::args_): Change type.
11751         (Plugin::filename_): New.
11752         (Plugin_manager::add_plugin_option): New.
11753         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11754         * testsuite/Makefile.in: Regenerate.
11755
11756 2008-12-05  Cary Coutant  <ccoutant@google.com>
11757
11758         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11759         Handle --strip-lto-sections option.
11760         * options.h (strip_lto_sections): New option.
11761
11762 2008-12-01  Cary Coutant  <ccoutant@google.com>
11763
11764         * plugin.cc (ld_plugin_message): Change format parameter to const.
11765         Fix mismatch between new[] and delete.
11766
11767 2008-11-14  Cary Coutant  <ccoutant@google.com>
11768
11769         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11770         instead of -1U.
11771
11772 2008-11-05  Craig Silverstein  <csilvers@google.com>
11773
11774         * options.cc (General_options::parse_dynamic_list): New function.
11775         * options.h (General_options): New flags dynamic_list,
11776         dynamic_list_data, dynamic_list_cpp_new, and
11777         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11778         (General_options::in_dynamic_list): New function.
11779         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11780         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11781         (Lex::can_continue_name): Likewise.
11782         (yylex): Likewise.
11783         (read_script_file): New parameter script_options.
11784         (read_dynamic_list): New function.
11785         (Script_options::define_dynamic_list): New function.
11786         (dynamic_list_keyword_parsecodes): New variable.
11787         (dynamic_list_keywords): New variable.
11788         * script.h (Script_options::define_dynamic_list): New function
11789         prototype.
11790         (read_dynamic_list): New function prototype.
11791         * symtab.cc (strprefix): New macro.
11792         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11793         dynamic_list_data, dynamic_list_cpp_new, and
11794         dynamic_list_cpp_typeinfo.
11795         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11796         (dynamic_list_expr): New rule.
11797         (dynamic_list_nodes): Likewise.
11798         (dynamic_list_node): Likewise.
11799         * testsuite/Makefile.am (dynamic_list): New test.
11800         * testsuite/Makefile.in: Regenerated.
11801         * testsuite/dynamic_list.t: New file.
11802         * testsuite/dynamic_list.sh: New file.
11803
11804 2008-11-05  Craig Silverstein  <csilvers@google.com>
11805
11806         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11807         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11808         (t11_last): Likewise.
11809         * testsuite/ver_test_6.c (main): Likewise.
11810
11811 2008-10-07  Cary Coutant  <ccoutant@google.com>
11812
11813         * options.c (General_options::finalize): Add check for -static and
11814         -shared.
11815         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11816         is not empty.
11817
11818 2008-10-02  Cary Coutant  <ccoutant@google.com>
11819
11820         * plugin.cc (make_sized_plugin_object): Fix conditional
11821         compilation to work when not all targets are enabled.
11822
11823 2008-09-29  Cary Coutant  <ccoutant@google.com>
11824
11825         * archive.cc (Archive::get_file_and_offset): Use filename instead
11826         of name to get library path.
11827         (Archive::include_member): Unlock external member of a thin archive.
11828
11829         * testsuite/Makefile.am (TEST_AR): New variable.
11830         (thin_archive_test_1): New test.
11831         (thin_archive_test_2): New test.
11832         * testsuite/Makefile.in: Regenerate.
11833         * testsuite/thin_archive_main.cc: New file.
11834         * testsuite/thin_archive_test_1.cc: New file.
11835         * testsuite/thin_archive_test_2.cc: New file.
11836         * testsuite/thin_archive_test_3.cc: New file.
11837         * testsuite/thin_archive_test_4.cc: New file.
11838
11839 2008-09-29  Cary Coutant  <ccoutant@google.com>
11840
11841         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11842         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11843         instead of -1U.
11844         (Sized_relobj::do_finalize_local_symbols): Likewise.
11845         (Sized_relobj::map_to_kept_section): Likewise.
11846         * object.h (Sized_relobj::invalid_address): New constant.
11847         (Sized_relobj::do_output_section_offset): Check for invalid_address
11848         and return -1ULL.
11849         * output.cc (Output_reloc::local_section_offset): Use constant
11850         invalid_address instead of -1U.
11851         (Output_reloc::get_address): Likewise.
11852         (Output_section::output_address): Change -1U to -1ULL.
11853         * output.h (Output_reloc::invalid_address): New constant.
11854         * reloc.cc (Sized_relobj::write_sections): Use constant
11855         invalid_address instead of -1U.
11856         (Sized_relobj::relocate_sections): Likewise.
11857         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11858         values for merge sections.
11859         * target-reloc.h (relocate_for_relocatable): Use constant
11860         invalid_address instead of -1U.
11861
11862 2008-09-19  Cary Coutant  <ccoutant@google.com>
11863
11864         Add plugin functionality for link-time optimization (LTO).
11865         * configure.ac (plugins): Add --enable-plugins option.
11866         * configure: Regenerate.
11867         * config.in: Regenerate.
11868         * Makefile.am (LIBDL): New variable.
11869         (CCFILES): Add plugin.cc.
11870         (HFILES): Add plugin.h.
11871         (ldadd_var): Add LIBDL.
11872         * Makefile.in: Regenerate.
11873
11874         * archive.cc: Include "plugin.h".
11875         (Archive::setup): Don't preread archive symbols when using a plugin.
11876         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11877         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11878         files.
11879         (Archive::include_member): Add symbols from plugin objects.
11880         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11881         * descriptors.cc (Descriptors::open): Check for file descriptors
11882         abandoned by plugins.
11883         (Descriptors::claim_for_plugin): New function.
11884         * descriptors.h (Descriptors::claim_for_plugin): New function.
11885         (Open_descriptor::is_claimed): New field.
11886         (claim_descriptor_for_plugin): New function.
11887         * fileread.cc (File_read::claim_for_plugin): New function.
11888         * fileread.h (File_read::claim_for_plugin): New function.
11889         (File_read::descriptor): New function.
11890         * gold.cc: Include "plugin.h".
11891         (queue_initial_tasks): Add task to call plugin hooks for generating
11892         new object files.
11893         * main.cc: Include "plugin.h".
11894         (main): Load plugin libraries.
11895         * object.h (Pluginobj): Declare.
11896         (Object::pluginobj): New function.
11897         (Object::do_pluginobj): New function.
11898         (Object::set_target): New function.
11899         * options.cc: Include "plugin.h".
11900         (General_options::parse_plugin): New function.
11901         (General_options::General_options): Initialize plugins_ field.
11902         (General_options::add_plugin): New function.
11903         * options.h (Plugin_manager): Declare.
11904         (General_options): Add --plugin option.
11905         (General_options::has_plugins): New function.
11906         (General_options::plugins): New function.
11907         (General_options::add_plugin): New function.
11908         (General_options::plugins_): New field.
11909         * plugin.cc: New file.
11910         * plugin.h: New file.
11911         * readsyms.cc: Include "plugin.h".
11912         (Read_symbols::do_read_symbols): Check for archive before checking
11913         for ELF file.  Call plugin hooks to claim files.
11914         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11915         from a real object file; force override when processing replacement
11916         files.
11917         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11918         (Symbol::init_base_object): Likewise.
11919         (Symbol::init_base_output_data): Likewise.
11920         (Symbol::init_base_output_segment): Likewise.
11921         (Symbol::init_base_constant): Likewise.
11922         (Symbol::init_base_undefined): Likewise.
11923         (Symbol::output_section): Assert that object is not a plugin.
11924         (Symbol_table::add_from_pluginobj): New function.
11925         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11926         undefined.
11927         (Symbol_table::sized_write_globals): Likewise.
11928         (Symbol_table::add_from_pluginobj): Instantiate template.
11929         * symtab.h (Sized_pluginobj): Declare.
11930         (Symbol::in_real_elf): New function.
11931         (Symbol::set_in_real_elf): New function.
11932         (Symbol::in_real_elf_): New field.
11933         (Symbol_table::add_from_pluginobj): New function.
11934
11935         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11936         (LIBDL): New variable.
11937         (LDADD): Add LIBDL.
11938         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11939         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11940         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11941         (MOSTLYCLEANFILES): Likewise.
11942         * testsuite/Makefile.in: Regenerate.
11943         * testsuite/plugin_test.c: New file.
11944         * testsuite/plugin_test_1.sh: New file.
11945         * testsuite/plugin_test_2.sh: New file.
11946
11947 2008-09-16  Ian Lance Taylor  <iant@google.com>
11948
11949         * target-reloc.h (relocate_section): Check whether a symbol is
11950         defined by the ABI before reporting an undefined symbol error.
11951         * target.h (Target::is_defined_by_abi): Make parameter const.
11952         (Target::do_is_defined_by_abi): Likewise.
11953         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11954         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11955         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11956         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11957         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11958         * testsuite/Makefile.in: Rebuild.
11959
11960         * fileread.cc (make_view): Add casts to avoid warning.
11961
11962 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11963
11964         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11965         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11966
11967 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11968
11969         * options.h (General_options::output_is_executable): New.
11970         (General_options::output_is_pie): New.
11971         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11972         for shared libraries.
11973         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11974
11975 2008-09-11  Chris Demetriou  <cgd@google.com>
11976
11977         * options.h (origin): New -z option.
11978         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11979         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11980         in DT_FLAGS_1.
11981
11982 2008-09-05  Cary Coutant  <ccoutant@google.com>
11983
11984         * fileread.cc (File_read::make_view): Add check for attempt to map
11985         beyond end of file.
11986
11987 2008-09-05  Cary Coutant  <ccoutant@google.com>
11988
11989         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11990         explicit instantiations.
11991
11992 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11993
11994         PR gold/6858
11995         * options.cc (General_options::finalize): Allow undefined symbols
11996         in shlibs if linking -shared.
11997
11998         PR gold/6859
11999         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12000         symbols as not needing a dynsym entry.
12001
12002 2008-08-20  Craig Silverstein  <csilvers@google.com>
12003
12004         * fileread.cc (File_read::open): Do not lock the file unless it
12005         was successfully opened.
12006
12007 2008-08-14  Cary Coutant  <ccoutant@google.com>
12008
12009         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12010         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12011         * testsuite/tls_test.cc (struct int128): 128-bit struct
12012         for testing TLS relocs with non-zero addend.
12013         (v12): New TLS variable.
12014         (t12): New test.
12015         (t_last): Add check for v12.
12016         * testsuite/tls_test.h (t12): New function.
12017         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12018
12019 2008-08-13  Ian Lance Taylor  <iant@google.com>
12020
12021         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12022         set tls_segment_ or relro_segment_.
12023         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12024         when appropriate.
12025         * output.h (Output_section::clear_is_relro): New function.
12026         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12027         sections specially even when output_data_ is empty.
12028         (Output_segment::maximum_alignment): When first section is relro,
12029         only force alignment for PT_LOAD segments.
12030         * script.cc (script_data_segment_align): New function.
12031         (script_data_segment_relro_end): New function.
12032         * script-c.h (script_data_segment_align): Declare.
12033         (script_data_segment_relro_end): Declare.
12034         * script-sections.h (class Script_sections): Declare
12035         data_segment_align and data_segment_relro_end.  Add fields
12036         segment_align_index_ and saw_relro_end_.
12037         * script-sections.cc (class Sections_element): Add set_is_relro
12038         virtual function.  Add new bool* parameter to place_orphan_here.
12039         Add get_output_section virtual function.
12040         (class Output_section_definition): Add set_is_relro.  Add new
12041         bool* parameter to place_orphan_here.  Add get_output_section.
12042         Add is_relro_ field.
12043         (Output_section_definition::Output_section_definition): Initialize
12044         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12045         and is_relro_ fields.
12046         (Output_section_definition::place_orphan_here): Add is_relro
12047         parameter.
12048         (Output_section_definition::set_section_addresses): Set relro for
12049         output section.
12050         (Output_section_definition::alternate_constraint): Likewise.
12051         (class Orphan_output_section): Add new bool* parameter to
12052         place_orphan_here.  Add get_output_section.
12053         (Orphan_output_section::place_orphan_here): Add is_relro
12054         parameter.
12055         (Script_sections::Script_sections): Initialize
12056         data_segment_align_index_ and saw_relro_end_.
12057         (Script_sections::data_segment_align): New function.
12058         (Script_sections::data_segment_relro_end): New function.
12059         (Script_sections::place_orphan): Set or clear is_relro.
12060         (Script_sections::set_section_addresses): Force alignment of first
12061         TLS section.
12062         * yyscript.y (exp): Call script_data_segment_align and
12063         script_data_segment_relro_end.
12064         * testsuite/relro_script_test.t: New file.
12065         * testsuite/relro_test.cc (using_script): Declare.
12066         (t1, t2): Test using_script.
12067         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12068         (relro_script_test_SOURCES): Define.
12069         (relro_script_test_DEPENDENCIES): Define.
12070         (relro_script_test_LDFLAGS): Define.
12071         (relro_script_test_LDADD): Define.
12072         (relro_script_test.so): New target.
12073         * testsuite/Makefile.in: Rebuild.
12074
12075 2008-08-06  Cary Coutant <ccoutant@google.com>
12076
12077         * archive.cc (Archive::total_archives, Archive::total_members)
12078         (Archive::total_members_loaded): New variables.
12079         (Archive::setup): Add parameter.  Add option to preread
12080         archive symbols.
12081         (Archive::read_armap): Add counter.
12082         (Archive::get_file_and_offset): New function.
12083         (Archive::get_elf_object_for_member): New function.
12084         (Archive::read_all_symbols): New function.
12085         (Archive::read_symbols): New function.
12086         (Archive::add_symbols): Add counters.
12087         (Archive::include_all_members): Use armap to find members if it's
12088         already built.
12089         (Archive::include_member): Skip reading symbols if already read.
12090         Factored code into Archive::get_file_and_offset and
12091         Archive::get_elf_object_for_member.  Changed call to
12092         Mapfile::report_include_archive_member.
12093         (Archive::print_stats): New function.
12094         * archive.h: Declare Object and Read_symbols_data classes.
12095         (Archive::Archive): Add initializers for new members.
12096         (Archive::setup): Add parameter.
12097         (Archive::print_stats): New function.
12098         (Archive::total_archives, Archive::total_members)
12099         (Archive::total_members_loaded): New variables.
12100         (Archive::get_file_and_offset): New function.
12101         (Archive::get_elf_object_for_member): New function.
12102         (Archive::read_all_symbols): New function.
12103         (Archive::read_symbols): New function.
12104         (Archive::Archive_member): New class.
12105         (Archive::members_): New member.
12106         (Archive::num_members_): New member.
12107         * main.cc: Include archive.h.
12108         (main): Call Archive::print_stats.
12109         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12110         archive parameter; member_name is now the fully-decorated name.
12111         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12112         * options.h: (General_options): Add --preread-archive-symbols option.
12113         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12114         Archive::setup.
12115
12116 2008-08-04  Ian Lance Taylor  <iant@google.com>
12117
12118         * symtab.h (Symbol::use_plt_offset): New function.
12119         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12120         * powerpc.cc (Relocate::relocate): Likewise.
12121         * sparc.cc (Relocate::relocate): Likewise.
12122         * x86_64.cc (Relocate::relocate): Likewise.
12123         * testsuite/weak_plt.sh: New test.
12124         * testsuite/weak_plt_main.cc: New test.
12125         * testsuite/weak_plt_shared.cc: New test.
12126         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12127         (check_PROGRAMS): Add weak_plt.
12128         (check_DATA): Add weak_plt_shared.so.
12129         (weak_plt_main_pic.o, weak_plt): New targets.
12130         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12131         * testsuite/Makefile.in: Rebuild.
12132
12133         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12134         gcctestdir/ld.
12135         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12136         * testsuite/Makefile.in: Rebuild.
12137
12138 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12139
12140         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12141         * Makefile.in: Regenerate.
12142         * po/POTFILES.in: Regenerate.
12143
12144 2008-07-29  Ian Lance Taylor  <iant@google.com>
12145
12146         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12147         symbols before other symbols.
12148         * testsuite/script_test_2.cc (test_addr): Declare.
12149         (test_addr_alias): Declare.
12150         (main): Check that test_addr and test_addr_alias have the right
12151         values.
12152         * testsuite/script_test_2.t: Define test_addr_alias and
12153         test_addr.
12154
12155 2008-07-24  Ian Lance Taylor  <iant@google.com>
12156
12157         PR 5990
12158         * descriptors.cc: New file.
12159         * descriptors.h: New file.
12160         * gold-threads.h (class Hold_optional_lock): New class.
12161         * fileread.cc: Include "descriptors.h".
12162         (File_read::~File_read): Release descriptor rather than closing
12163         it.
12164         (File_read::open) [file]: Call open_descriptor rather than open.
12165         Set is_descriptor_opened_.
12166         (File_read::open) [memory]: Assert that descriptor is not open.
12167         (File_read::reopen_descriptor): New function.
12168         (File_read::release): Release descriptor.
12169         (File_read::do_read): Make non-const.  Reopen descriptor.
12170         (File_read::read): Make non-const.
12171         (File_read::make_view): Reopen descriptor.
12172         (File_read::do_readv): Likewise.
12173         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12174         Update declarations.
12175         * layout.cc: Include "descriptors.h".
12176         (Layout::create_build_id): Use open_descriptor rather than open.
12177         * output.cc: Include "descriptors.h".
12178         (Output_file::open): Use open_descriptor rather than open.
12179         * archive.cc (Archive::const_iterator): Change Archive to be
12180         non-const.
12181         (Archive::begin, Archive::end): Make non-const.
12182         (Archive::count_members): Likewise.
12183         * archive.h (class Archive): Update declarations.
12184         * object.h (Object::read): Make non-const.
12185         * Makefile.am (CCFILES): Add descriptors.cc.
12186         (HFILES): Add descriptors.h.
12187         * Makefile.in: Rebuild.
12188
12189         PR 6716
12190         * gold.h: Always include <clocale>.  Add Solaris workarounds
12191         following code in binutils/sysdep.h.
12192
12193         PR 6048
12194         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12195         this->eh_frame_hdr_ is NULL before using it.
12196
12197         * dynobj.cc (Versions::Versions): Update comment.
12198
12199         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12200         the base version name.
12201
12202         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12203         array size plus one.
12204         (Stringpool_template::set_string_offsets): Subtract one from key
12205         before using it as an array index.
12206         (Stringpool_template::get_offset_with_length): Likewise.
12207         (Stringpool_template::write_to_buffer): Likewise.
12208         * stringpool.h (Stringpool_template::get_offset_from_key):
12209         Likewise.
12210
12211 2008-07-23  Ian Lance Taylor  <iant@google.com>
12212
12213         PR 6658
12214         * object.h (Merged_symbol_value::value): Do our best to handle a
12215         negative addend.
12216
12217         PR 6647
12218         * script.cc (Version_script_info::get_versions): Don't add empty
12219         version tag to return value.
12220         (Version_script_info::get_symbol_version_helper): Change return
12221         type to bool.  Add pversion parameter.  Change all callers.
12222         (script_register_vers_node): Don't require a non-NULL tag.
12223         * script.h (class Version_script_info): Update declarations.
12224         (Version_script_info::get_symbol_version): Change return type to
12225         bool.  Add version parameter.  Change all callers.
12226         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12227         handling.  Handle an empty version from a version script.
12228         (Symbol_table::define_special_symbol): Likewise.
12229         * testsuite/ver_test_10.script: New file.
12230         * testsuite/ver_test_10.sh: New file.
12231         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12232         (check_DATA): Add ver_test_10.syms.
12233         (ver_test_10.syms, ver_test_10.so): New target.
12234         * testsuite/Makefile.in: Rebuild.
12235
12236 2008-07-23  Simon Baldwin  <simonb@google.com>
12237
12238         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12239         to zero for undefined symbols from dynamic libraries.
12240
12241 2008-07-23  Ian Lance Taylor  <iant@google.com>
12242
12243         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12244         Change all callers.
12245         * symtab.h (class Symbol_table): Update declaration.
12246         * testsuite/ver_test_9.cc: New file.
12247         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12248         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12249         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12250         (ver_test_9.so, ver_test_9.o): New targets.
12251         * testsuite/Makefile.in: Rebuild.
12252
12253 2008-07-22  Ian Lance Taylor  <iant@google.com>
12254
12255         * options.h (class General_options): Define --check-sections.
12256         * layout.cc (Layout::set_segment_offsets): Handle
12257         --check-sections.
12258
12259         * options.h (class General_options): Define -n/--nmagic and
12260         -N/--omagic.
12261         * options.cc (General_options::finalize): For -n/--nmagic or
12262         -N/--omagic, set -static.
12263         * layout.cc (Layout::attach_allocated_section_to_segment): If
12264         -N/--omagic, don't put read-only and read-write sections in
12265         different segments.
12266         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12267         finding a read-only segment.
12268         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12269         don't set the minimum segment alignment to the common page size,
12270         and don't set the file offset to the address modulo the page size.
12271         * script-sections.cc (Script_sections::create_segments): If
12272         -n/--omagic, don't put read-only and read-write sections in
12273         different segments.
12274
12275         * cref.cc: New file.
12276         * cref.h: New file.
12277         * options.h (class General_options): Add --print-symbol-counts.
12278         * main.cc (main): Issue defined symbol report if requested.
12279         * archive.cc (Archive::interpret_header): Make into a const member
12280         function.
12281         (Archive::add_symbols): Call Input_objects::archive_start and
12282         archive_stop.
12283         (Archive::const_iterator): Define new class.
12284         (Archive::begin, Archive::end): New functions.
12285         (Archive::include_all_members): Rewrite to use iterator.
12286         (Archive::count_members): New function.
12287         * archive.h (class Archive): Update declarations.
12288         (Archive::filename): New function.
12289         * object.cc: Include "cref.h".
12290         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12291         (Sized_relobj::do_get_global_symbol_counts): New function.
12292         (Input_objects::add_object): Add object to cross-referencer.
12293         (Input_objects::archive_start): New function.
12294         (Input_objects::archive_stop): New function.
12295         (Input_objects::print_symbol_counts): New function.
12296         * object.h: Declare Cref and Archive.
12297         (Object::get_global_symbol_counts): New function.
12298         (Object::do_get_global_symbol_counts): New pure virtual function.
12299         (class Sized_relobj): Add defined_count_ field.  Update
12300         declarations.
12301         (class Input_objects): Add cref_ field.  Update constructor.
12302         Update declarations.
12303         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12304         defined_count_.
12305         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12306         symbol counts.
12307         (Sized_dynobj::do_get_global_symbol_counts): New function.
12308         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12309         defined_count_.  Update declarations.  Define Symbols typedef.
12310         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12311         parameter.  Change all callers.
12312         (Symbol_table::add_from_dynobj): Add sympointers and defined
12313         parameters.  Change all callers.
12314         * symtab.h (class Symbol_table): Update declarations.
12315         * Makefile.am (CCFILES): Add cref.cc.
12316         (HFILES): Add cref.h.
12317         * Makefile.in: Rebuild.
12318
12319 2008-07-22  Simon Baldwin  <simonb@google.com>
12320
12321         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12322         to zero when writing undefined symbols.
12323
12324 2008-07-22  Ian Lance Taylor  <iant@google.com>
12325
12326         * output.cc (Output_section::add_input_section): Don't try to
12327         merge empty merge sections.
12328
12329 2008-07-21  Craig Silverstein  <csilvers@google.com>
12330
12331         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12332         Include symbol version in error message.
12333
12334 2008-07-20  Chris Demetriou  <cgd@google.com>
12335
12336         * configure.ac (gold_cv_c_random_seed): New configured variable.
12337         (RANDOM_SEED_CFLAGS): New substituted variable.
12338         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12339         * configure: Rebuild.
12340         * Makefile.in: Likewise.
12341         * testsuite/Makefile.in: Likewise.
12342
12343 2008-07-18  Ian Lance Taylor  <iant@google.com>
12344
12345         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12346         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12347         * testsuite/ver_test_main.cc (main): Call t4.
12348         (t4, t4_2a): Define.
12349         * testsuite/ver_test_2.cc (t4_2): Define.
12350         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12351         * testsuite/ver_test_4.cc (t4_2a): Define.
12352         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12353         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12354
12355 2008-07-17  Ian Lance Taylor  <iant@google.com>
12356
12357         * dynobj.cc (Versions::add_def): If we give an error about a
12358         missing version, go ahead and create the version anyhow.
12359
12360 2008-07-10  Ian Lance Taylor  <iant@google.com>
12361
12362         Handle output sections with more than 0x7fffffff bytes.
12363         * object.h (class Relobj): Change map_to_output_ to
12364         output_sections_, and just keep a section pointer.  Change all
12365         uses.  Move comdat group support to Sized_relobj.
12366         (Relobj::is_section_specially_mapped): Remove.
12367         (Relobj::output_section): Remove poff parameter.  Change all
12368         callers.
12369         (Relobj::output_section_offset): New function.
12370         (Relobj::set_section_offset): Rewrite.
12371         (Relobj::map_to_output): Remove.
12372         (Relobj::output_sections): New function.
12373         (Relobj::do_output_section_offset): New pure virtual function.
12374         (Relobj::do_set_section_offset): Likewise.
12375         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12376         group support from Relobj.  Update declarations.
12377         (Sized_relobj::get_output_section_offset): New function.
12378         (Sized_relobj::do_output_section_offset): New function.
12379         (Sized_relobj::do_set_section_offset): New function.
12380         * object.cc (Relobj::output_section_address): Remove.
12381         (Sized_relobj::Sized_relobj): Initialize new fields.
12382         (Sized_relobj::include_section_group): Cast find_kept_object to
12383         Sized_relobj.
12384         (Sized_relobj::include_linkonce_section): Likewise.
12385         (Sized_relobj::do_layout): Use separate arrays for output section
12386         and output offset.
12387         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12388         output_sections.
12389         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12390         output_sections and section_offsets.
12391         (Sized_relobj::write_local_symbols): Likewise.
12392         (map_to_kept_section): Compute output address directly.
12393         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12394         output_sections and section_offsets.
12395         (Sized_relobj::write_sections): Likewise.
12396         (Sized_relobj::relocate_sections): Likewise.
12397         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12398         * output.h (class Output_reloc): Update declarations.  Change
12399         u2_.relobj to Sized_relobj*.
12400         (class Output_data_reloc): Change add functions to use
12401         Sized_relobj*.
12402         * output.cc (Output_reloc::Output_reloc): Change relobj to
12403         Sized_relobj*.
12404         (Output_reloc::local_section_offset): Change return type to
12405         Elf_Addr.  Use get_output_section_offset.
12406         (Output_reloc::get_address): Likewise.
12407         (Output_section::is_input_address_mapped): Don't call
12408         is_section_specially_mapped.
12409         (Output_section::output_offset): Likewise.
12410         (Output_section::output_address): Likewise.
12411         (Output_section::starting_output_address): Likewise.
12412         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12413         parameter to Sized_relobj*.
12414         (Copy_relocs::need_copy_reloc): Likewise.
12415         (Copy_relocs::save): Likewise.
12416         * copy-relocs.h (class Copy_relocs): Update declarations.
12417         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12418         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12419         * target-reloc.h (relocate_for_relocatable): Change
12420         offset_in_output_section type to Elf_Addr.  Change code that uses
12421         it as well.
12422         * layout.cc (Layout::layout): Always set *off.
12423         * mapfile.cc (Mapfile::print_input_section): Use
12424         output_section_offset.
12425         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12426         Sized_relobj*.
12427         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12428         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12429         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12430
12431 2008-07-03  Ian Lance Taylor  <iant@google.com>
12432
12433         * layout.cc (Layout::include_section): Do not discard unrecognized
12434         SHT_STRTAB sections.
12435
12436 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12437
12438         * script.cc (Lex::can_continue_name): Make '?' allowable in
12439         version-script names.
12440         * testsuite/version_script.map: Change glob pattern to use '?'
12441
12442 2008-06-30  Manish Singh  <yosh@gimp.org>
12443
12444         PR 6585
12445         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12446         Correct typo.
12447
12448 2008-06-30  Ian Lance Taylor  <iant@google.com>
12449
12450         PR 6660
12451         PR 6682
12452         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12453         versions]: Don't try to read the value in the contents, since we
12454         don't use it.  Use the template endianness when writing.
12455
12456 2008-06-25  Cary Coutant  <ccoutant@google.com>
12457
12458         * fileread.cc (File_read::make_view): Assert on zero-length view.
12459         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12460         symbol table when there are no symbols to read.
12461
12462 2008-06-23  Craig Silverstein  <csilvers@google.com>
12463
12464         * version.cc (version_string): Bump to 1.7
12465
12466 2008-06-18  Craig Silverstein  <csilvers@google.com>
12467
12468         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12469         constant 0xFFFF to type Valtype.
12470         (Powerpc_relocate_functions::rel16_ha): Likewise.
12471
12472 2008-06-17  Ian Lance Taylor  <iant@google.com>
12473
12474         * output.h (Output_section::Input_section): Initialize p2align_ to
12475         zero for Output_section_data constructors.
12476         (Output_section::Input_section::addralign): If not an input
12477         section, return the alignment of the Output_section_data.
12478         * testsuite/copy_test.cc: New file.
12479         * testsuite/copy_test_1.cc: New file.
12480         * testsuite/copy_test_2.cc: New file.
12481         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12482         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12483         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12484         (copy_test_1_pic.o, copy_test_1.so): New targets.
12485         (copy_test_2_pic.o, copy_test_2.so): New targets.
12486         * testsuite/Makefile.in: Rebuild.
12487
12488         * script-sections.cc (Script_sections::place_orphan): Initialize
12489         local variable exact.
12490
12491 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12492
12493         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12494
12495 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12496             David S. Miller  <davem@davemloft.net>
12497
12498         * powerpc.cc: New file.
12499         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12500         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12501         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12502         * Makefile.in: Rebuild.
12503
12504 2008-06-09  Ian Lance Taylor  <iant@google.com>
12505
12506         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12507         <exception>.
12508         (throwing, orig_terminate): New static variables.
12509         (terminate_handler): New static function.
12510         (t2): Set terminate handler.
12511
12512 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12513
12514         PR 6584
12515         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12516         alignment.
12517
12518 2008-05-30  Cary Coutant  <ccoutant@google.com>
12519
12520         * archive.cc (Archive::include_all_members) Correct to step
12521         over symbol table and extended name table in thin archives.
12522
12523 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12524
12525         PR 6407
12526         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12527         calculation.
12528
12529 2008-05-28  Caleb Howe  <cshowe@google.com>
12530
12531         * reduced_debug_output.cc: New file.
12532         * reduced_debug_output.h: New file.
12533         * options.h (class General_options): Add --strip-debug-non-line.
12534         * options.cc (General_options::finalize): Add strip_debug_non_line
12535         to the strip heirarchy.
12536         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12537         fields.
12538         * layout.cc: Include "reduced_debug_output.h".
12539         (Layout::Layout): Initialize new fields.
12540         (line_only_debug_sections): New static array.
12541         (is_lines_only_debug_sections): New static inline function.
12542         (Layout::include_section): Handle --strip-debug-non-line.
12543         (Layout::make_output_section): If --strip-debug-non-line, build
12544         new output sections for .debug_abbrev and .debug_info.
12545         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12546         gold.  Warn about possible overflow.
12547         (read_signed_LEB_128): Likewise.
12548         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12549         (read_signed_LEB_128): Declare.
12550         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12551         (HFILES): Add reduced_debug_output.h.
12552         * Makefile.in: Rebuild.
12553
12554 2008-05-21  Ian Lance Taylor  <iant@google.com>
12555
12556         * mapfile.cc: New file.
12557         * mapfile.h: New file.
12558         * options.h (class General_options): Add -M/--print-map and -Map.
12559         * options.cc (General_options::finalize): Make -M equivalent to
12560         -Map -.
12561         * main.cc: Include <cstdio> and "mapfile.h".
12562         (main): Open mapfile if requested.
12563         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12564         constructor.  Change caller.
12565         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12566         (queue_middle_tasks): Likewise.
12567         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12568         declarations.
12569         * archive.cc: Include "mapfile.h".
12570         (Archive::add_symbols): Add mapfile parameter.  Change all
12571         callers.  Pass mapfile, symbol, and reason to include_member.
12572         (Archive::include_all_members): Add mapfile parameter.  Change all
12573         callers.
12574         (Archive::include_member): Add mapfile, sym, and why parameters.
12575         Change all callers.  Report inclusion to map file.
12576         * archive.h: Include "fileread.h".
12577         (class Archive): Update declarations.
12578         (Archive::file): New const method.
12579         (class Add_archive_symbols): Add mapfile_ field.  Update
12580         constructor.  Change all callers.
12581         * readsyms.h (class Read_symbols): Likewise.
12582         (class Finish_group): Likewise.
12583         (class Read_script): Likewise.
12584         * common.cc: Include "mapfile.h".
12585         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12586         all callers.
12587         (Symbol_table::do_allocate_commons): Likewise.
12588         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12589         symbol allocation to mapfile.
12590         * common.h (class Allocate_commons_task): Add mapfile_ field.
12591         Update constructor.  Change all callers.
12592         * symtab.h (class Symbol_table): Update declarations.
12593         * layout.cc: Include "mapfile.h".
12594         (Layout_task_runner::run): Print information to mapfile.
12595         (Layout::create_gold_note): Change Output_data_fixed_space to
12596         Output_data_zero_fill.
12597         (Layout::create_build_id): Likewise.
12598         (Layout::print_to_mapfile): New function.
12599         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12600         constructor.  Change caller.
12601         (class Layout): Declare print_to_mapfile.
12602         * output.cc (Output_section::Input_section::print_to_mapfile): New
12603         function.
12604         (Output_section::add_input_section): If producing a map, always
12605         add to input_sections_ list.
12606         (Output_section::do_print_to_mapfile): New function.
12607         (Output_segment::print_sections_to_mapfile): New function.
12608         (Output_segment::print_section_list_to_mapfile): New function.
12609         * output.h: Include "mapfile.h".
12610         (Output_data::print_to_mapfile): New function.
12611         (Output_data::do_print_to_mapfile): New virtual function.
12612         (Output_segment_headers::do_print_to_mapfile): New function.
12613         (Output_file_header::do_print_to_mapfile): New function.
12614         (Output_data_const::do_print_to_mapfile): New function.
12615         (class Output_data_const_buffer): Add map_name_ field.  Update
12616         constructor.  Change all callers.  Add do_print_to_mapfile
12617         function.
12618         (class Output_data_fixed_space): Likewise.
12619         (class Output_data_space): Likewise.
12620         (class Output_data_zero_fill): New class.
12621         (Output_data_strtab::do_print_to_mapfile): New function.
12622         (Output_data_reloc_base::do_print_to_mapfile): New function.
12623         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12624         (Output_data_group::do_print_to_mapfile): New function.
12625         (Output_data_got::do_print_to_mapfile): New function.
12626         (Output_data_dynamic::do_print_to_mapfile): New function.
12627         (Output_symtab_xindex::do_print_to_mapfile): New function.
12628         (class Output_section): Declare do_print_to_mapflie.  Declare
12629         print_to_mapfile in Input_section.
12630         (class Output_segment): Declare new functions.
12631         * object.h (Sized_relobj::symbol_count): New function.
12632         * script-sections.cc
12633         (Output_section_element_dot_assignment::set_section_addresses):
12634         Change Output_data_fixed_space to Output_data_zero_fill.
12635         (Output_data_expression::do_print_to_mapfile): New function.
12636         * script.cc (read_input_script): Add mapfile parameter.  Change
12637         all callers.
12638         * script.h (read_input_script): Update declaration.
12639         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12640         (Eh_frame::do_print_to_mapfile): New function.
12641         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12642         (Output_merge_string::do_print_to_mapfile): New function.
12643         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12644         function.
12645         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12646         function.
12647         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12648         function.
12649         * Makefile.am (CCFILES): Add mapfile.cc.
12650         (HFILES): Add mapfile.h.
12651         * Makefile.in: Rebuild.
12652
12653 2008-05-19  Ian Lance Taylor  <iant@google.com>
12654
12655         * options.h (class General_options): Add -z relro.
12656         * layout.cc (Layout::Layout): Initialize relro_segment_.
12657         (Layout::add_output_section_data): Return the output section.
12658         (Layout::make_output_section): Rcognize relro sections and mark
12659         them appropriately.
12660         (Layout::attach_allocated_section_to_segment): Put relro sections
12661         in a PT_GNU_RELRO segment.
12662         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12663         section as relro.
12664         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12665         PT_TLS segments.
12666         (Layout::linkonce_mapping): Map d.rel.ro.local to
12667         .data.rel.ro.local.
12668         (Layout::output_section_name): Us .data.rel.ro.local for any
12669         section which begins with that.
12670         * layout.h (class Layout): Update add_output_section_data
12671         declaration.  Add relro_segment_ field.
12672         * output.cc (Output_section::Output_section): Initialize is_relro_
12673         and is_relro_local_ fields.
12674         (Output_segment::add_output_section): Group relro sections.
12675         (Output_segment::is_first_section_relro): New function.
12676         (Output_segment::maximum_alignment): If there is a relro section,
12677         align the segment to the common page size.
12678         (Output_segment::set_section_addresses): Track whether we are
12679         looking at relro sections.  If the last section is a relro
12680         section, align to the common page size.
12681         (Output_segment::set_section_list_addresses): Add in_relro
12682         parameter.  Change all callers.  Align to the page size when
12683         moving from relro to non-relro section.
12684         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12685         segment.
12686         * output.h (class Output_section): Add is_relro_ and
12687         is_relro_local_ fields.
12688         (Output_section::is_relro): New function.
12689         (Output_section::set_is_relro): New function.
12690         (Output_section::is_relro_local): New function.
12691         (Output_section::set_is_relro_local): New function.
12692         (class Output_segment): Update declarations.
12693         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12694         * sparc.cc (Target_sparc::got_section): Likewise.
12695         * x86_64.cc (Target_x86_64::got_section): Likewise.
12696         * testsuite/relro_test_main.cc: New file.
12697         * testsuite/relro_test.cc: New file.
12698         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12699         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12700         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12701         (relro_test.so, relro_test_pic.o): New targets.
12702         * testsuite/Makefile.in: Rebuild.
12703
12704 2008-05-16  Ian Lance Taylor  <iant@google.com>
12705
12706         * output.cc (Output_segment::add_output_section): Remove front
12707         parameter.
12708         * output.h (class Output_segment): Remove
12709         add_initial_output_section and overloaded add_output_section.
12710         Update declaration of remaining add_output_section.
12711         * layout.cc (Layout::create_interp): Call add_output_section
12712         rather than add_initial_output_section.
12713         (Layout::finish_dynamic_section): Likewise.
12714
12715         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12716         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12717         know the dynamic type.
12718         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12719         field.  Initialize it in constructor.
12720         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12721         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12722         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12723         reloc.
12724
12725         * output.cc (Output_reloc::get_address): Change return type to
12726         Elf_Addr.
12727         * output.h (class Output_reloc): Update get_address declaration.
12728         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12729         for section addresses.
12730
12731 2008-05-09  Ian Lance Taylor  <iant@google.com>
12732
12733         PR 6493
12734         * gold.cc (gold_nomem): Use return value of write.
12735
12736 2008-05-08  Ian Lance Taylor  <iant@google.com>
12737
12738         * symtab.c (Symbol::init_base_output_data): Add version
12739         parameter.  Change all callers.
12740         (Symbol::init_base_output_segment): Likewise.
12741         (Symbol::init_base_constant): Likewise.
12742         (Symbol::init_base_undefined): Likewise.
12743         (Sized_symbol::init_output_data): Likewise.
12744         (Sized_symbol::init_output_segment): Likewise.
12745         (Sized_symbol::init_constant): Likewise.
12746         (Sized_symbol::init_undefined): Likewise.
12747         (Symbol_table::do_define_in_output_data): If the new symbol has a
12748         version, mark it as the default.
12749         (Symbol_table::do_define_in_output_segment): Likewise.
12750         (Symbol_table::do_define_as_constant): Likewise.
12751         * symtab.h (class Symbol): Update declarations.
12752         (class Sized_symbol): Likewise.
12753         * resolve.cc (Symbol::override_version): New function.
12754         (Symbol::override_base): Call override_version.
12755         (Symbol::override_base_with_special): Likewise.
12756         * testsuite/ver_script_8.script: New file.
12757         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12758         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12759         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12760         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12761
12762 2008-05-06  Ian Lance Taylor  <iant@google.com>
12763
12764         PR 6049
12765         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12766         functions.
12767         (class General_options): Remove existing --undefined, and add
12768         --no-undefined instead.  Add new --undefined as synonym for -u.
12769         * archive.cc (Archive::add_symbols): Check whether symbol was
12770         named with -u.
12771         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12772         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12773         all uses.  Add IS_UNDEFINED.  Update declarations to split
12774         different versions of init_base.  Declare init_base_undefined.
12775         (Symbol::is_defined): Handle IS_UNDEFINED.
12776         (Symbol::is_undefined): Likewise.
12777         (Symbol::is_weak_undefined): Call is_undefined.
12778         (Symbol::is_absolute): Handle IS_CONSTANT.
12779         (class Sized_symbol): Update declarations to split different
12780         versions of init.  Declare init_undefined.
12781         (class Symbol_table): Declare new functions.
12782         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12783         Change all callers.
12784         (Symbol::init_base_output_data): Likewise.
12785         (Symbol::init_base_output_segment): Likewise.
12786         (Symbol::init_base_constant): Likewise.
12787         (Symbol::init_base_undefined): New function.
12788         (Sized_symbol::init_object): Rename from init.  Change all
12789         callers.
12790         (Sized_symbol::init_output_data): Likewise.
12791         (Sized_symbol::init_output_segment): Likewise.
12792         (Sized_symbol::init_constant): Likewise.
12793         (Sized_symbol::init_undefined): New function.
12794         (Symbol_table::add_undefined_symbols_from_command_line): New
12795         function.
12796         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12797         function.
12798         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12799         (Symbol::output_section): Likewise.
12800         (Symbol::set_output_section): Likewise.
12801         (Symbol_table::sized_finalize_symbol): Likewise.
12802         (Symbol_table::sized_write_globals): Likewise.
12803         * resolve.cc (Symbol_table::should_override): Likewise.
12804         (Symbol::override_base_with_special): Likewise.
12805
12806         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12807         symbol, change it to have default visibility.
12808         * testsuite/protected_1.cc: New file.
12809         * testsuite/protected_2.cc: New file.
12810         * testsuite/protected_3.cc: New file.
12811         * testsuite/protected_main_1.cc: New file.
12812         * testsuite/protected_main_2.cc: New file.
12813         * testsuite/protected_main_3.cc: New file.
12814         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12815         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12816         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12817         (protected_1.so): New target.
12818         (protected_1_pic.o, protected_2_pic.o): New targets.
12819         (protected_3_pic.o): New target.
12820         (check_PROGRAMS): Add protected_2.
12821         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12822         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12823         * testsuite/Makefile.in: Rebuild.
12824
12825         * options.h (DEFINE_var): Add set_user_set_##varname__.
12826         (DEFINE_bool_alias): New macro.
12827         (class General_options): Define -Bstatic using DEFINE_bool_alias
12828         rather than DEFINE_special.  Add --undefined as an alias for -z
12829         defs.
12830         * options.cc (General_options::parse_Bstatic): Remove.
12831
12832         * options.h (class General_options): Add --fatal-warnings.
12833         * main.cc (main): Implement --fatal-warnings.
12834         * errors.h (Errors::warning_count): New function.
12835
12836         * options.h (class General_options): Add -Bsymbolic-functions.
12837         * symtab.h (Symbol::is_preemptible): Check for
12838         -Bsymbolic-functions.
12839
12840 2008-05-05  Ian Lance Taylor  <iant@google.com>
12841
12842         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12843         as noVARNAME rather than no-VARNAME.
12844         (class General_options): Add option -z combreloc.
12845         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12846         get_address.
12847         (Output_reloc::sort_before) [SHT_REL]: New function.
12848         (Output_reloc::sort_before) [SHT_RELA]: New function.
12849         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12850         Sort_relocs_comparison.
12851         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12852         parameter.  Change all callers.
12853         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12854         sort_relocs parameter.  Change all callers.
12855         * output.cc (Output_reloc::get_address): New function, broken out
12856         of write_rel.
12857         (Output_reloc::write_rel): Call it.
12858         (Output_reloc::compare): New function.
12859         (Output_data_reloc_base::do_write): Optionally sort relocs.
12860
12861         * configure.ac: If targ_extra_obj is set, link it in.
12862         * configure.tgt: Initialize all variables.
12863         (x86_64*): Set targ_extra_obj and targ_extra_size.
12864         * configure: Rebuild.
12865
12866         * object.cc (Sized_relobj::include_section_group): Adjust section
12867         indexes read from group data.  Build vector to pass to
12868         layout_group.
12869         * layout.cc (Layout::layout_group): Add flags and shndxes
12870         parameters.  Remove contents parameter.  Change caller.  Update
12871         explicit instantiations.
12872         * layout.h (class Layout): Update layout_group declaration.
12873         * output.cc (Output_data_group::Output_data_group): Add flags and
12874         input_shndxes parameters.  Remove contents parameter.  Change
12875         caller.
12876         (Output_data_group::do_write): Change input_sections_ to
12877         input_shndxes_.
12878         * output.h (class Output_data_group): Update constructor
12879         declaration.  Rename input_sections_ to input_shndxes_.
12880         * testsuite/many_sections_test.cc: Add template.
12881
12882 2008-04-30  Cary Coutant  <ccoutant@google.com>
12883
12884         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12885
12886         * layout.cc (Layout::include_section): Refactored check for debug
12887         info section.
12888         (Layout::add_comdat): Add new parameters.  Change type
12889         of signature parameter.  Add object and shndx to signatures table.
12890         (Layout::find_kept_object): New function.
12891         * layout.h: Include <cstring>.
12892         (Layout::is_debug_info_section): New function.
12893         (Layout::add_comdat): Add new parameters.
12894         (Layout::find_kept_object): New function.
12895         (Layout::Kept_section): New struct.
12896         (Layout::Signatures): Change type of map range.
12897         * object.cc (Relobj::output_section_address): New function.
12898         (Sized_relobj::include_section_group): Add new parameters.  Change
12899         calls to Layout::add_comdat.  Change to build table of kept comdat
12900         groups and table mapping discarded sections to kept sections.
12901         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12902         (Sized_relobj::do_layout): Change calls to include_section_group and
12903         include_linkonce_section.
12904         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12905         value to zero when section is discarded.
12906         (Sized_relobj::map_to_kept_section): New function.
12907         * object.h (Relobj::output_section_address): New function.
12908         (Relobj::Comdat_group): New type.
12909         (Relobj::find_comdat_group): New function.
12910         (Relobj::Comdat_group_table): New type.
12911         (Relobj::Kept_comdat_section): New type.
12912         (Relobj::Kept_comdat_section_table): New type.
12913         (Relobj::add_comdat_group): New function.
12914         (Relobj::set_kept_comdat_section): New function.
12915         (Relobj::get_kept_comdat_section): New function.
12916         (Relobj::comdat_groups_): New field.
12917         (Relobj::kept_comdat_sections_): New field.
12918         (Symbol_value::input_value): Update comment.
12919         (Sized_relobj::map_to_kept_section) New function.
12920         (Sized_relobj::include_linkonce_section): Add new parameter.
12921         * target-reloc.h (Comdat_behavior): New type.
12922         (get_comdat_behavior): New function.
12923         (relocate_section): Add code to map a discarded section to the
12924         corresponding kept section when applying a relocation.
12925
12926 2008-04-30  Craig Silverstein  <csilvers@google.com>
12927
12928         * dwarf_reader.cc (next_generation_count): New static var.
12929         (Addr2line_cache_entry): New struct.
12930         (addr2line_cache): New static var.
12931         (Dwarf_line_info::one_addr2line): Added caching.
12932         (Dwarf_line_info::clear_addr2line_cache): New function.
12933         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12934         cache-size parameter.
12935         (Dwarf_line_info::one_addr2line_cache): New function.
12936         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12937         new cache-size argument to one_addr2line(), and clear cache.
12938
12939 2008-04-28  Cary Coutant  <ccoutant@google.com>
12940
12941         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12942         R_386_PC8 relocations.
12943
12944 2008-04-23  Ian Lance Taylor  <iant@google.com>
12945
12946         * object.cc (Sized_relobj::include_section_group): Check for
12947         invalid section group.
12948
12949         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12950         header size.
12951
12952         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12953         than read for file header.
12954         * archive.cc (Archive::include_member): Likewise.
12955
12956 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12957
12958         * aclocal.m4: Regenerate.
12959         * configure: Regenerate.
12960
12961 2008-04-19  Ian Lance Taylor  <iant@google.com>
12962
12963         * version.cc (version_string): Bump to 1.6.
12964
12965         * testsuite/Makefile.am (many_sections_r_test): New target.
12966         (many_sections_r_test_SOURCES): Remove.
12967         (many_sections_r_test_DEPENDENCIES): Remove.
12968         (many_sections_r_test_LDFLAGS): Remove.
12969         (many_sections_r_test_LDADD): Remove.
12970
12971         * object.cc (Sized_relobj::do_add_symbols): Always pass
12972         local_symbol_count_ to add_from_relobj.
12973
12974         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12975         every thousand variables.
12976         * testsuite/Makefile.in: Rebuild.
12977
12978         * object.cc (Xindex::initialize_symtab_xindex): New function.
12979         (Xindex::read_symtab_xindex): New function.
12980         (Xindex::sym_xindex_to_shndx): New function.
12981         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12982         available.
12983         (Sized_relobj::do_initialize_xindex): New function.
12984         (Sized_relobj::do_read_symbols): Adjust section links.
12985         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12986         parameter.  Change all callers.
12987         (Sized_relobj::include_section_group): Adjust section links and
12988         symbol section indexes.
12989         (Sized_relobj::do_layout): Adjust section links.
12990         (Sized_relobj::do_count_local_symbols): Adjust section links and
12991         symbol section indexes.
12992         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12993         ordinary and special symbols.
12994         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12995         dynsym_xindex parameters.  Change all callers.  Adjust section
12996         links.  Use SHN_XINDEX when needed.
12997         (Sized_relobj::get_symbol_location_info): Adjust section links.
12998         Don't get fooled by special symbols.
12999         * object.h (class Xindex): Define.
13000         (class Object): Add xindex_ parameter.  Declare virtual functoin
13001         do_initialize_xindex.
13002         (Object::adjust_sym_shndx): New function.
13003         (Object::set_xindex): New protected function.
13004         (class Symbol_value): Add is_ordinary_shndx_ field.
13005         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13006         (Symbol_value::value): Assert ordinary section.
13007         (Symbol_value::initialize_input_to_output_map): Likewise.
13008         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13009         Change all callers.
13010         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13011         all callers.
13012         (class Sized_relobj): Update declarations.
13013         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13014         parameter.  Change all callers.
13015         (Sized_relobj::adjust_shndx): New function.
13016         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13017         field.
13018         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13019         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13020         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13021         (Sized_dynobj::read_dynsym_section): Adjust section links.
13022         (Sized_dynobj::read_dynamic): Likewise.
13023         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13024         section links.
13025         (Sized_dynobj::do_initialize_xindex): New function.
13026         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13027         do_initialize_xindex.
13028         (Sized_dynobj::adjust_shndx): New function.
13029         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13030         dynsym_xindex_ fields.
13031         (Layout::finalize): Add a call to set_section_indexes before
13032         creating the symtab sections.
13033         (Layout::set_section_indexes): Don't do anything if the section
13034         already has a section index.
13035         (Layout::create_symtab_sections): Add shnum parameter.  Change
13036         caller.  Create .symtab_shndx section if needed.
13037         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13038         caller.
13039         (Layout::allocated_output_section_count): New function.
13040         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13041         needed.
13042         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13043         fields.  Update declarations.
13044         (Layout::symtab_xindex): New function.
13045         (Layout::dynsym_xindex): New function.
13046         (class Write_symbols_task): Add layout_ field.
13047         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13048         Change caller.
13049         * output.cc (Output_section_headers::Output_section_headers): Add
13050         shstrtab_section parameter.  Change all callers.
13051         (Output_section_headers::do_sized_write): Store overflow values
13052         for section count and section string table section index in
13053         section header zero.
13054         (Output_file_header::do_sized_write): Check for overflow of
13055         section count and section string table section index.
13056         (Output_symtab_xindex::do_write): New function.
13057         (Output_symtab_xindex::endian_do_write): New function.
13058         * output.h (class Output_section_headers): Add shstrtab_section_.
13059         Update declarations.
13060         (class Output_symtab_xindex): Define.
13061         (Output_section::has_out_shndx): New function.
13062         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13063         field.
13064         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13065         Change all callers.
13066         (Sized_symbol::init): Likewise.
13067         (Symbol::output_section): Check for ordinary symbol.
13068         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13069         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13070         callers.
13071         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13072         Change all callers.  Simplify handling of symbols from sections
13073         not included in the link.
13074         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13075         distinction.
13076         (Weak_alias_sorter::operator()): Assert that symbols are
13077         ordinary.
13078         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13079         distinction.
13080         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13081         parameters.  Change all callers.
13082         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13083         symbol distinction.  Use SHN_XINDEX when needed.
13084         (Symbol_table::write_section_symbol): Add symtab_xindex
13085         parameter.  Change all callers.
13086         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13087         SHN_XINDEX when needed.
13088         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13089         declarations.
13090         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13091         (Symbol::is_defined): Check is_ordinary.
13092         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13093         (Symbol::is_absolute, Symbol::is_common): Likewise.
13094         (class Sized_symbol): Update declarations.
13095         (class Symbol_table): Update declarations.
13096         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13097         parameters.  Change all callers.
13098         (Sized_symbol::override): Likewise.
13099         (Symbol_table::override): Likewise.
13100         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13101         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13102         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13103         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13104         to be in an ordinary section.
13105         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13106         object and is_ordinary parameters.  Change all callers.
13107         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13108         Change all callers.  Don't add undefined or non-ordinary symbols
13109         to reloc_map_.
13110         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13111         Change all callers.
13112         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13113         declarations.
13114         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13115         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13116         (Sized_relobj::relocate_sections): Likewise.
13117         * target-reloc.h (scan_relocs): Adjust section symbol index.
13118         (scan_relocatable_relocs): Likewise.
13119         * i386.cc (Scan::local): Check for ordinary symbols.
13120         * sparc.cc (Scan::local): Likewise.
13121         * x86_64.cc (Scan::local): Likewise.
13122         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13123         to symbol_section_and_value.
13124         * testsuite/many_sections_test.cc: New file.
13125         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13126         (check_PROGRAMS): Add many_sections_test.
13127         (many_sections_test_SOURCES): Define.
13128         (many_sections_test_DEPENDENCIES): Define.
13129         (many_sections_test_LDFLAGS): Define.
13130         (BUILT_SOURCES): Add many_sections_define.h.
13131         (many_sections_define.h): New target.
13132         (BUILT_SOURCES): Add many_sections_check.h.
13133         (many_sections_check.h): New target.
13134         (check_PROGRAMS): Add many_sections_r_test.
13135         (many_sections_r_test_SOURCES): Define.
13136         (many_sections_r_test_DEPENDENCIES): Define.
13137         (many_sections_r_test_LDFLAGS): Define.
13138         (many_sections_r_test_LDADD): Define.
13139         (many_sections_r_test.o): New target.
13140         * testsuite/Makefile.in: Rebuild.
13141
13142 2008-04-17  Cary Coutant  <ccoutant@google.com>
13143
13144         * errors.cc (Errors::info): New function.
13145         (gold_info): New function.
13146         * errors.h (Errors::info): New function.
13147         * gold.h (gold_info): New function.
13148         * object.cc (Input_objects::add_object): Print trace output.
13149         * options.cc (options::parse_set): New function.
13150         (General_options::parse_wrap): Deleted.
13151         (General_options::General_options): Deleted initializer.
13152         * options.h (options::String_set): New typedef.
13153         (options::parse_set): New function.
13154         (DEFINE_set): New macro.
13155         (General_options::wrap): Changed to use DEFINE_set. Changed
13156         callers of any_wrap_symbols and is_wrap_symbol.
13157         (General_options::trace, General_options::trace_symbol):
13158         New options.
13159         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13160         (General_options::wrap_symbols_): Deleted.
13161         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13162
13163 2008-04-17  David S. Miller  <davem@davemloft.net>
13164
13165         * options.cc (General_options::parse_V): New function.
13166         * options.h: Add entries for -V and -Qy.
13167
13168 2008-04-17  Ian Lance Taylor  <iant@google.com>
13169
13170         * common.cc (Symbol_table::allocate_commons): Remove options
13171         parameter.  Change caller.
13172         (Symbol_table::do_allocate_commons): Remove options parameter.
13173         Change caller.  Just call do_allocate_commons_list twice.
13174         (Symbol_table::do_allocate_commons_list): New function, broken out
13175         of do_allocate_commons.
13176         * common.h (class Allocate_commons_task): Remove options_ field.
13177         Update constructor.
13178         * symtab.cc (Symbol_table::Symbol_table): Initialize
13179         tls_commons_.
13180         (Symbol_table::add_from_object): Put TLS common symbols on
13181         tls_commons_ list.
13182         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13183         which are IN_OUTPUT_DATA.
13184         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13185         allocate_commons and do_allocate_commons declarations.  Declare
13186         do_allocate_commons_list.
13187         * gold.cc (queue_middle_tasks): Update creation of
13188         Allocate_commons_task to not pass options.
13189         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13190         (TLS_TEST_C_FLAGS): New variable.
13191         (tls_test_c_pic.o): New target.
13192         (tls_test_shared.so): Link in tls_test_c_pic.o.
13193         (tls_test_c_pic_ie.o): New target.
13194         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13195         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13196         (tls_test_c.o): New target.
13197         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13198         (tls_pic_test_LDADD): Likewise.
13199         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13200         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13201         (tls_test_c_gnu2.o): New target.
13202         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13203         tls_test_c_gnu2.o.
13204         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13205         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13206         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13207         * testsuite/tls_test.cc: Include "config.h".
13208         (t_last): Call t11_last.
13209         * testsuite/tls_test.h (t11, t11_last): Declare.
13210         * testsuite/tls_test_c.c: New file.
13211         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13212         * configure.ac: Check for OpenMP support.
13213         * configure, config.in, Makefile.in: Rebuild.
13214         * testsuite/Makefile.in: Rebuild.
13215
13216 2008-04-16  Cary Coutant  <ccoutant@google.com>
13217
13218         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13219         (Target_i386::tls_base_symbol_defined_): New field.
13220         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13221         (Target_i386::Scan::global): Likewise.
13222         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13223         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13224         (Target_x86_64::tls_base_symbol_defined_): New field.
13225         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13226         (Target_x86_64::Scan::global): Likewise.
13227
13228 2008-04-16  Cary Coutant  <ccoutant@google.com>
13229
13230         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13231         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13232         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13233         building shared libraries.
13234         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13235         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13236         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13237         * testsuite/Makefile.in: Rebuild.
13238         * testsuite/weak_undef.h: New file.
13239         * testsuite/weak_undef_file1.cc: Add extra test cases.
13240         * testsuite/weak_undef_file2.cc: Likewise.
13241         * testsuite/weak_undef_test.cc: Likewise.
13242
13243 2008-04-16  David S. Miller  <davem@davemloft.net>
13244
13245         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13246         Add issued_non_pic_error_ field.  Declare check_non_pic.
13247         (Target_sparc::Scan::check_non_pic): New function.
13248         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13249         (Target_sparc::Scan::global): Likewise.
13250
13251         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13252         * configure: Rebuild.
13253
13254         * options.h (DEFINE_enable): New macro.
13255         (new_dtags): New enable option.
13256         (initfirst, interpose, loadfltr, nodefaultlib,
13257         nodelete, nodlopen, nodump): New -z options.
13258         * layout.cc (Layout:finish_dynamic_section): If new
13259         dtags enabled, emit DT_RUNPATH.  Also, emit a
13260         DT_FLAGS_1 containing any specified -z flags.
13261
13262 2008-04-16  Ian Lance Taylor  <iant@google.com>
13263
13264         * copy-relocs.cc: New file.
13265         * copy-relocs.h: New file.
13266         * reloc.cc: Remove Copy_relocs code.
13267         * reloc.h: Likewise.
13268         * reloc-types.h (struct Reloc_types) [both versions]: Add
13269         get_reloc_addend_noerror.
13270         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13271         variants of add_global which take an addend which must be zero.
13272         * i386.cc: Include "copy-relocs.h".
13273         (class Target_i386): Change type of copy_relocs_ to variable,
13274         update initializer.
13275         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13276         Change all callers.
13277         (Target_i386::do_finalize_sections): Change handling of
13278         copy_relocs_.
13279         * sparc.cc: Include "copy-relocs.h".
13280         (class Target_sparc): Change type of copy_relocs_ to variable,
13281         update initializer.
13282         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13283         Change all callers.
13284         (Target_sparc::do_finalize_sections): Change handling of
13285         copy_relocs_.
13286         * x86_64.cc: Include "copy-relocs.h".
13287         (class Target_x86_64): Change type of copy_relocs_ to variable,
13288         update initializer.
13289         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13290         class.  Change all callers.
13291         (Target_x86_64::do_finalize_sections): Change handling of
13292         copy_relocs_.
13293         * Makefile.am (CCFILES): Add copy-relocs.cc.
13294         (HFILES): Add copy-relocs.h.
13295
13296         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13297
13298         * testsuite/script_test_4.sh: Permit leading zeroes.
13299
13300 2008-04-15  Ian Lance Taylor  <iant@google.com>
13301
13302         * script-sections.cc (Script_sections::create_segments): Use
13303         header_size_adjustment even when there is enough room for the
13304         headers.
13305         * testsuite/script_test_4.sh: New file.
13306         * testsuite/script_test_4.t: New file.
13307         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13308         (check_DATA): Add script_test_4.stdout.
13309         (MOSTLYCLEANFILES): Likewise.
13310         (script_test_4): New target.
13311         (script_test_4.stdout): New target.
13312         * testsuite/Makefile.in: Rebuild.
13313
13314         * sparc.cc: Add definitions for Output_data_plt_sparc class
13315         constants.
13316
13317 2008-04-14  David S. Miller  <davem@davemloft.net>
13318
13319         * sparc.cc: New file.
13320         * Makefile.am (TARGETSOURCES): Add sparc.cc
13321         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13322         * configure.tgt: Document targ_extra_size and
13323         targ_extra_big_endian.  Add entries for sparc-* and
13324         sparc64-*.
13325         * configure.ac: Handle targ_extra_size and
13326         targ_extra_big_endian.
13327         * Makefile.in: Rebuild.
13328         * configure: Likewise.
13329         * po/POTFILES.in: Likewise.
13330         * po/gold.pot: Likewise.
13331
13332 2008-04-14  Ian Lance Taylor  <iant@google.com>
13333
13334         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13335         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13336         in the name/type/flags to section mapping.  Don't call
13337         allocate_output_section.
13338         (Layout::choose_output_section): Change parameter from adjust_name
13339         to is_input_section.  Don't permit input sections after sections
13340         are attached to segments.  Don't call allocate_output_section.
13341         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13342         not write_enable_output_section.
13343         (Layout::make_output_section): Don't push to
13344         unattached_section_list_ nor call attach_to_segment.  Call
13345         attach_section_to_segment if sections are attached.
13346         (Layout::attach_sections_to_segments): New function.
13347         (Layout::attach_section_to_segment): New function.
13348         (Layout::attach_allocated_section_to_segment): Rename from
13349         attach_to_segment.  Remove flags parameter.
13350         (Layout::allocate_output_section): Remove function.
13351         (Layout::write_enable_output_section): Remove function.
13352         * layout.h (class Layout): Update for above changes.  Add new
13353         field sections_are_attached_.
13354         * output.h (Output_section::update_flags_for_input_section): New
13355         function.
13356         * output.cc (Output_section::add_input_section): Call
13357         update_flags_for_input_section.
13358         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13359
13360 2008-04-11  Cary Coutant  <ccoutant@google.com>
13361
13362         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13363         thought unnecessary.
13364         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13365
13366 2008-04-11  Ian Lance Taylor  <iant@google.com>
13367
13368         * output.h (class Output_section_data): Remove inline definition
13369         of set_addralign.
13370         * output.cc (Output_section_data::set_addralign): New function.
13371
13372 2008-04-11  Cary Coutant  <ccoutant@google.com>
13373
13374         Add support for TLS descriptors for i386 and x86_64.
13375         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13376         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13377         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13378         GOT_TYPE_TLS_DESC.
13379         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13380         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13381         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13382         relocations.
13383         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13384         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13385         Fix problem with initial-exec relocations.
13386         (Target_i386::Relocate::relocate_tls): Likewise.
13387         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13388         relaxation.
13389         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13390         support for section-plus-offset dynamic table entries.
13391         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13392         (Output_data_dynamic::Dynamic_entry): Add support for
13393         section-plus-offset dynamic table entries.
13394         (Output_data_dynamic::Classification): Likewise.
13395         (Output_data_dynamic::classification_): Renamed offset_.
13396         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13397         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13398         (Target_x86_64::make_plt_section): New function.
13399         (Target_x86_64::reserve_tlsdesc_entries): New function.
13400         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13401         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13402         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13403         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13404         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13405         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13406         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13407         add extra PLT entry for TLS descriptors.
13408         (Output_data_plt_x86_64::got_): New field.
13409         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13410         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13411         fields.
13412         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13413         descriptors.
13414         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13415         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13416         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13417         R_386_TLS_DESC_CALL relocations.
13418         (Target_x86_64::Scan::global): Likewise.
13419         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13420         for TLS descriptors.
13421         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13422         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13423         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13424         GD-to-IE relaxation.
13425         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13426         and TLS_DESCRIPTORS.
13427         * Makefile.in: Rebuild.
13428         * configure: Rebuild.
13429         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13430         (tls_test_shared2.so): New target.
13431         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13432         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13433         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13434         (tls_shared_gd_to_ie_test_LDADD): New variable.
13435         (tls_shared_gnu2_gd_to_ie_test): New target.
13436         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13437         New targets.
13438         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13439         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13440         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13441         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13442         (tls_shared_gnu2_test): New target.
13443         (tls_test_gnu2_shared.so): New target.
13444         (tls_shared_gnu2_test_SOURCES): New variable.
13445         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13446         (tls_shared_gnu2_test_LDFLAGS): New variable.
13447         (tls_shared_gnu2_test_LDADD): New variable.
13448         * testsuite/Makefile.in: Rebuild.
13449         * testsuite/Makefile.
13450
13451 2008-04-11  Ian Lance Taylor  <iant@google.com>
13452
13453         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13454         justsyms.t.
13455         * testsuite/Makefile.in: Rebuild.
13456
13457         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13458         long.
13459         * testsuite/script_test_2.cc (main): Adjust test.
13460
13461 2008-04-11  David S. Miller  <davem@davemloft.net>
13462             Ian Lance Taylor  <iant@google.com>
13463
13464         * options.h (General_options): Add entries for '-Y' and
13465         '-relax'.
13466         * options.cc (General_options:finalize): If -Y was used, add those
13467         entries to the library path instead of the default "/lib" and
13468         "/usr/lib".
13469
13470 2008-04-11  David S. Miller  <davem@davemloft.net>
13471
13472         * testsuite/justsyms.t: Start at 0x100.
13473         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13474         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13475         long.
13476         * testsuite/script_test_2.cc: Adjust string and section length
13477         checks.
13478
13479 2008-04-09  Ian Lance Taylor  <iant@google.com>
13480
13481         PR gold/5996
13482         * script-sections.cc (Sections_element::allocate_to_segment): Add
13483         orphan parameter.
13484         (Output_section_definition::allocate_to_segment): Likewise.
13485         (Orphan_output_section::allocate_to_segment): Likewise.
13486         (Script_sections::attach_sections_using_phdrs_clause): Don't
13487         propagate non-PT_LOAD segments to orphan sections.
13488         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13489         readelf rather than objdump.
13490         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13491         .interp section and PT_INTERP segment are the same size.
13492         * testsuite/Makefile.in: Rebuild.
13493
13494         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13495         aliases for symbols defined in the same object.
13496         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13497         (weak_alias_test_SOURCES): New variable.
13498         (weak_alias_test_DEPENDENCIES): New variable.
13499         (weak_alias_test_LDFLAGS): New variable.
13500         (weak_alias_test_LDADD): New variable.
13501         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13502         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13503         (weak_alias_test_3.o): New target.
13504         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13505         * testsuite/weak_alias_test_main.cc: New file.
13506         * testsuite/weak_alias_test_1.cc: New file.
13507         * testsuite/weak_alias_test_2.cc: New file.
13508         * testsuite/weak_alias_test_3.cc: New file.
13509
13510 2008-04-08  Ian Lance Taylor  <iant@google.com>
13511
13512         * options.h (class General_options): Add --noinhibit-exec option.
13513         * main.cc (main): Check --noinhibit-exec.
13514
13515         * options.h (class General_options): Define --wrap as a special
13516         option.  Add wrap_symbols_ field.
13517         (General_options::any_wrap_symbols): New function.
13518         (General_options::is_wrap_symbol): New function.
13519         * options.cc (General_options::parse_wrap): New function.
13520         (General_options::General_options): Initialize wrap_symbols_.
13521         * symtab.cc (Symbol_table::wrap_symbol): New function.
13522         (Symbol_table::add_from_object): Handle --wrap.
13523         * symtab.h (class Symbol_table): Declare wrap_symbol.
13524         * target.h (Target::wrap_char): New function.
13525         (Target::Target_info): Add wrap_char field.
13526         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13527         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13528         * testsuite/testfile.cc (Target_test::test_target_info):
13529         Likewise.
13530
13531         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13532         there is one.
13533
13534         * layout.h (class Layout): Add added_eh_frame_data_ field.
13535         * layout.cc (Layout::Layout): Initialize new field.
13536         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13537         output section until we find a section we merged successfully.
13538         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13539         that the size be non-zero.
13540
13541         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13542         qualifier.
13543
13544 2008-04-08  Craig Silverstein  <csilvers@google.com>
13545
13546         * configure.ac: Export new conditional variable HAVE_ZLIB.
13547         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13548         on HAVE_ZLIB.
13549         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13550         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13551
13552 2008-04-07  Ian Lance Taylor  <iant@google.com>
13553
13554         * version.cc (version_string): Set to "1.5".
13555
13556         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13557         Add issued_non_pic_error_ field.  Declare check_non_pic.
13558         (Target_x86_64::Scan::check_non_pic): New function.
13559         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13560         (Target_x86_64::Scan::global): Likewise.
13561
13562         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13563         addend parameter.  Change caller.  Handle merge sections.
13564         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13565         Address to Addend.  Don't add in the result of
13566         local_section_offset, pass down the addend and use the returned
13567         value.
13568         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13569         Update declarations of local_section_offset and symbol_value.
13570         * testsuite/two_file_test_1.cc (t18): New function.
13571         * testsuite/two_file_test_2.cc (f18): New function.
13572         * testsuite/two_file_test_main.cc (main): Call t18.
13573         * testsuite/two_file_test.h (t18, f18): Declare.
13574
13575         * configure.ac: Don't test for objdump, c++filt, or readelf.
13576         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13577         conditionals.
13578         (TEST_READELF): New variable.
13579         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13580         (check_PROGRAMS): Add two_file_strip_test.
13581         (two_file_strip_test): New target.
13582         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13583         (two_file_same_shared_strip_test_SOURCES): New variable.
13584         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13585         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13586         (two_file_same_shared_strip_test_LDADD): New variable.
13587         (two_file_shared_strip.so): New target.
13588         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13589         (ver_test_5.syms, ver_test_7.syms): Likewise.
13590         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13591         (strip_test_3.stdout): Use TEST_OBJDUMP.
13592         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13593
13594 2008-04-04  Cary Coutant  <ccoutant@google.com>
13595
13596         * symtab.h (Symbol::is_weak_undefined): New function.
13597         (Symbol::is_strong_undefined): New function.
13598         (Symbol::is_absolute): New function.
13599         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13600         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13601         absolute symbols.
13602         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13603         (weak_undef_test): New target.
13604         * testsuite/Makefile.in: Rebuild.
13605         * testsuite/weak_undef_file1.cc: New file.
13606         * testsuite/weak_undef_file2.cc: New file.
13607         * testsuite/weak_undef_test.cc: New file.
13608
13609 2008-04-03  Craig Silverstein  <csilvers@google.com>
13610
13611         * compressed_output.h (class Output_compressed_section): Use
13612         unsigned buffer.
13613         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13614         add zlib header.
13615         (zlib_compressed_suffix): Removed.
13616         (Output_compressed_section::set_final_data_size): Use unsigned
13617         buffers.
13618         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13619         Fix linker invocation.
13620         (flagstest_o_specialfile_and_compress_debug_sections):
13621         Likewise.
13622         * testsuite/Makefile.in: Regenerated.
13623
13624 2008-04-02  David S. Miller  <davem@davemloft.net>
13625
13626         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13627         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13628
13629 2008-04-02  Craig Silverstein  <csilvers@google.com>
13630
13631         * TODO: New file.
13632
13633 2008-04-02  Ian Lance Taylor  <iant@google.com>
13634
13635         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13636         parameters.  Update for new key type to views_.  Change all
13637         callers.
13638         (File_read::read): Adjust for byteshift in returned view.
13639         (File_read::add_view): New function, broken out of
13640         find_and_make_view.
13641         (File_read::make_view): New function, broken out of
13642         find_and_make_view.
13643         (File_read::find_or_make_view): Add offset and aligned
13644         parameters.  Rewrite accordingly.  Change all callers.
13645         (File_read::get_view): Add offset and aligned parameters.  Adjust
13646         for byteshift in return value.
13647         (File_read::get_lasting_view): Likewise.
13648         * fileread.h (class File_read): Update declarations.
13649         (class File_read::View): Add byteshift_ field.  Add byteshift to
13650         constructor.  Add byteshift method.
13651         * archive.h (Archive::clear_uncached_views): New function.
13652         (Archive::get_view): Add aligned parameter.  Change all callers.
13653         * object.h (Object::get_view): Add aligned parameter.  Change all
13654         callers.
13655         (Object::get_lasting_view): Likewise.
13656
13657         * fileread.cc (File_read::release): Don't call clear_views if
13658         there are multiple objects.
13659         * fileread.h (File_read::clear_uncached_views): New function.
13660         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13661         on the archive.
13662
13663 2008-03-31  Cary Coutant  <ccoutant@google.com>
13664
13665         Add thin archive support.
13666         * archive.cc (Archive::armagt): New const.
13667         (Archive::setup): Remove task parameter and calls to unlock.
13668         (Archive::unlock_nested_archives): New function.
13669         (Archive::read_header): Add nested_off parameter. Change
13670         all callers.
13671         (Archive::interpret_header): Likewise.
13672         (Archive::include_all_members): Change to handle thin
13673         archives.
13674         (Archive::include_member): Likewise.
13675         * archive.h (Archive::Archive): Add new parameters and
13676         initializers.
13677         (Archive::armagt): New const.
13678         (Archive::setup): Remove task parameter.
13679         (Archive::unlock_nested_archives): New function.
13680         (Archive::read_header): Add nested_off parameter.
13681         (Archive::interpret_header): Likewise.
13682         (Archive::Nested_archive_table): New typedef.
13683         (Archive::is_thin_archive_): New field.
13684         (Archive::nested_archives_): New field.
13685         (Archive::options_): New field.
13686         (Archive::dirpath_): New field.
13687         (Archive::task_): New field.
13688         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13689         for thin archives.  Pass additional parameters to
13690         Archive::Archive.  Unlock the archive file after calling
13691         Archive::setup.
13692
13693 2008-03-29  Ian Lance Taylor  <iant@google.com>
13694
13695         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13696         version symbol to be local.
13697         * testsuite/ver_test_4.sh: New file.
13698         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13699         (check_DATA): Add ver_test_4.syms.
13700         (ver_test_4.syms): New target.
13701         * testsuite/Makefile.in: Rebuild.
13702
13703         * output.cc
13704         (Output_section::Input_section_sort_entry::has_priority): New
13705         function.
13706         (Output_section::Input_section_sort_entry::match_file_name): New
13707         function.
13708         (Output_section::Input_section_sort_entry::match_section_name):
13709         Remove.
13710         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13711         Remove.
13712         (Output_section::Input_section_sort_entry::match_section_file):
13713         Remove.
13714         (Output_section::Input_section_sort_compare::operator()): Rewrite
13715         using new Input_section_sort_entry functions.  Sort crtbegin and
13716         crtend first.  Sort sections with no priority before sections with
13717         a priority.
13718         * testsuite/initpri1.c (d3): Check j != 4.
13719         (cd5): New constructor/destructor function.
13720         (main): Check j != 2.
13721
13722         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13723         new symbol when resolving, don't call set_is_default.
13724         * testsuite/ver_test_7.cc: New file.
13725         * testsuite/ver_test_7.sh: New file.
13726         * testsuite/Makefile.am (ver_test_7.so): New target.
13727         (ver_test_7.o): New target.
13728         (check_SCRIPTS): Add ver_test_7.sh.
13729         (check_DATA): Add ver_test_7.syms.
13730         (ver_test_7.syms): New target.
13731
13732 2008-03-28  Ian Lance Taylor  <iant@google.com>
13733
13734         * layout.cc (Layout::layout): If we see an input section with a
13735         name that needs sorting, set the must_sort flag for the output
13736         section.
13737         (Layout::make_output_section): If the name of the output section
13738         indicates that it might require sorting, set the may_sort flag.
13739         * output.h (Output_section::may_sort_attached_input_sections): New
13740         function.
13741         (Output_section::set_may_sort_attached_input_sections): New
13742         function.
13743         (Output_section::must_sort_attached_input_sections): New
13744         function.
13745         (Output_section::set_must_sort_attached_input_sections): New
13746         function.
13747         (class Output_section): Declare Input_section_sort_entry.  Define
13748         Input_section_sort_compare.  Declare
13749         sort_attached_input_sections.  Add new fields:
13750         may_sort_attached_input_sections_,
13751         must_sort_attached_input_sections_,
13752         attached_input_sections_are_sorted_.
13753         * output.cc (Output_section::Output_section): Initialize new
13754         fields.
13755         (Output_section::add_input_section): Add an entry to
13756         input_sections_ if may_sort or must_sort are true.
13757         (Output_section::set_final_data_size): Call
13758         sort_attached_input_sections if necessary.
13759         (Output_section::Input_section_sort_entry): Define new class.
13760         (Output_section::Input_section_sort_compare::operator()): New
13761         function.
13762         (Output_section::sort_attached_input_sections): New function.
13763         * configure.ac: Check whether the compiler supports constructor
13764         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13765         * testsuite/initpri1.c: New file.
13766         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13767         CONSTRUCTOR_PRIORITY.
13768         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13769         (initpri1_LDFLAGS): New variable.
13770         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13771
13772 2008-03-27  Ian Lance Taylor  <iant@google.com>
13773
13774         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13775         * testsuite/common_test_1.c: New file.
13776         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13777         (common_test_1_SOURCES): New variable.
13778         (common_test_1_DEPENDENCIES): New variable.
13779         (common_test_1_LDFLAGS): New variable.
13780
13781         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13782         and commons_ correctly when NAME/VERSION does not override
13783         NAME/NULL.
13784         * testsuite/ver_test_6.c: New file.
13785         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13786         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13787         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13788
13789 2008-03-26  Ian Lance Taylor  <iant@google.com>
13790
13791         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13792         of an undefined symbol from a version script.
13793         * testsuite/Makefile.am (ver_test_5.so): New target.
13794         (ver_test_5.o): New target.
13795         (check_SCRIPTS): Add ver_test_5.sh.
13796         (check_DATA): Add ver_test_5.syms.
13797         (ver_test_5.syms): New target.
13798         * testsuite/ver_test_5.cc: New file.
13799         * testsuite/ver_test_5.script: New file.
13800         * testsuite/ver_test_5.sh: New file.
13801         * Makefile.in, testsuite/Makefile.in: Rebuild.
13802
13803         PR gold/5986
13804         Fix problems building gold with gcc 4.3.0.
13805         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13806         (gold_error_at_location, gold_warning_at_location): Use it.
13807         * configure.ac: Check whether we can compile and use a template
13808         function with a printf attribute.
13809         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13810         when jumping over bytes.
13811         * object.cc: Instantiate Object::read_section_data.
13812         * debug.h: Include <cstring>
13813         * dwarf_reader.cc: Include <algorithm>
13814         * main.cc: Include <cstring>.
13815         * options.cc: Include <cstring>.
13816         * output.cc: Include <cstring>.
13817         * script.cc: Include <cstring>.
13818         * script.h: Include <string>.
13819         * symtab.cc: Include <cstring> and <algorithm>.
13820         * target-select.cc: Include <cstring>.
13821         * version.cc: Include <string>.
13822         * testsuite/testmain.cc: Include <cstdlib>.
13823         * configure, config.in: Rebuild.
13824
13825 2008-03-25  Ian Lance Taylor  <iant@google.com>
13826
13827         * options.cc: Include "../bfd/bfdver.h".
13828         (options::help): Print bug reporting address.
13829
13830         * version.cc (print_version): Adjust output for current value of
13831         BFD_VERSION_STRING.
13832
13833         * NEWS: New file.
13834
13835         * options.cc (options::help): Print list of supported targets.
13836         * target-select.h: Include <vector>.
13837         (class Target_selector): Make machine_, size_, and is_big_endian_
13838         fields const.  Add bfd_name_ and instantiated_target_ fields.
13839         (Target_selector::Target_selector): Add bfd_name parameter.
13840         (Target_selector::recognize): Make non-virtual, call
13841         do_recognize.
13842         (Target_selector::recognize_by_name): Make non-virtual, call
13843         do_recognize_by_name.
13844         (Target_selector::supported_names): New function.
13845         (Target_selector::bfd_name): New function.
13846         (Target_selector::do_instantiate_target): New pure virtual
13847         function.
13848         (Target_selector::do_recognize): New virtual function.
13849         (Target_selector::do_recognize_by_name): New virtual function.
13850         (Target_selector::instantiate_target): New private function.
13851         (supported_target_names): Declare.
13852         * target-select.cc (Target_selector::Target_selector): Update for
13853         new parameter and fields.
13854         (select_target_by_name): Check that the name matches before
13855         calling recognize_by_name.
13856         (supported_target_names): New function.
13857         * i386.cc (class Target_selector_i386): Update Target_selector
13858         constructor call.  Remove recognize and recognize_by_name.  Add
13859         do_instantiate_target.
13860         * x86_64.cc (class Target_selector_x86_64): Likewise.
13861         * testsuite/testfile.cc (class Target_selector_test): Update for
13862         changes to Target_selector.
13863
13864         * README: Rewrite, with some notes on unsupported features.
13865
13866 2008-03-24  Cary Coutant  <ccoutant@google.com>
13867
13868         * i386.cc (Target_i386::Got_type): New enum declaration.
13869         (Target_i386::Scan::local): Updated callers of Output_data_got
13870         member functions.
13871         (Target_i386::Scan::global): Likewise.
13872         (Target_i386::Relocate::relocate): Likewise.
13873         (Target_i386::Relocate::relocate_tls): Likewise.
13874         * object.h (Got_offset_list): New class.
13875         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13876         (Sized_relobj::local_got_offset): Likewise.
13877         (Sized_relobj::set_local_got_offset): Likewise.
13878         (Sized_relobj::local_has_tls_got_offset): Removed.
13879         (Sized_relobj::local_tls_got_offset): Removed.
13880         (Sized_relobj::set_local_tls_got_offset): Removed.
13881         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13882         * output.cc (Output_data_got::add_global): Added got_type parameter.
13883         (Output_data_got::add_global_with_rel): Likewise.
13884         (Output_data_got::add_global_with_rela): Likewise.
13885         (Output_data_got::add_global_pair_with_rel): New function.
13886         (Output_data_got::add_global_pair_with_rela): New function.
13887         (Output_data_got::add_local): Added got_type parameter.
13888         (Output_data_got::add_local_with_rel): Likewise.
13889         (Output_data_got::add_local_with_rela): Likewise.
13890         (Output_data_got::add_local_pair_with_rel): New function.
13891         (Output_data_got::add_local_pair_with_rela): New function.
13892         (Output_data_got::add_global_tls): Removed.
13893         (Output_data_got::add_global_tls_with_rel): Removed.
13894         (Output_data_got::add_global_tls_with_rela): Removed.
13895         (Output_data_got::add_local_tls): Removed.
13896         (Output_data_got::add_local_tls_with_rel): Removed.
13897         (Output_data_got::add_local_tls_with_rela): Removed.
13898         * output.h (Output_data_got::add_global): Added got_type parameter.
13899         (Output_data_got::add_global_with_rel): Likewise.
13900         (Output_data_got::add_global_with_rela): Likewise.
13901         (Output_data_got::add_global_pair_with_rel): New function.
13902         (Output_data_got::add_global_pair_with_rela): New function.
13903         (Output_data_got::add_local): Added got_type parameter.
13904         (Output_data_got::add_local_with_rel): Likewise.
13905         (Output_data_got::add_local_with_rela): Likewise.
13906         (Output_data_got::add_local_pair_with_rel): New function.
13907         (Output_data_got::add_local_pair_with_rela): New function.
13908         (Output_data_got::add_global_tls): Removed.
13909         (Output_data_got::add_global_tls_with_rel): Removed.
13910         (Output_data_got::add_global_tls_with_rela): Removed.
13911         (Output_data_got::add_local_tls): Removed.
13912         (Output_data_got::add_local_tls_with_rel): Removed.
13913         (Output_data_got::add_local_tls_with_rela): Removed.
13914         * resolve.cc (Symbol::override_base_with_special): Removed
13915         reference to has_got_offset_ field.
13916         * symtab.cc (Symbol::init_fields): Replaced initialization
13917         of got_offset_ with got_offsets_.  Removed initialization
13918         of has_got_offset_
13919         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13920         (Symbol::got_offset): Likewise.
13921         (Symbol::set_got_offset): Likewise.
13922         (Symbol::has_tls_got_offset): Removed.
13923         (Symbol::tls_got_offset): Removed.
13924         (Symbol::set_tls_got_offset): Removed.
13925         (Symbol::got_offset_): Removed.
13926         (Symbol::tls_mod_got_offset_): Removed.
13927         (Symbol::tls_pair_got_offset_): Removed.
13928         (Symbol::got_offsets_): New field.
13929         (Symbol::has_got_offset): Removed.
13930         (Symbol::has_tls_mod_got_offset): Removed.
13931         (Symbol::has_tls_pair_got_offset): Removed.
13932         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13933         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13934         member functions.
13935         (Target_x86_64::Scan::global): Likewise.
13936         (Target_x86_64::Relocate::relocate): Likewise.
13937         (Target_x86_64::Relocate::relocate_tls): Likewise.
13938
13939 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13940
13941         * yyscript.y: Fix spelling error in comment.
13942
13943 2008-03-24  Ian Lance Taylor  <iant@google.com>
13944
13945         * options.h (class General_options): Define build_id option.
13946         * layout.h (class Layout): Declare write_build_id, create_note,
13947         create_build_id.  Add build_id_note_ member.
13948         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13949         "libiberty.h", "md5.h", "sha1.h".
13950         (Layout::Layout): Initialize eh_frame_data_,
13951         eh_frame_hdr_section_, and build_id_note_.
13952         (Layout::finalize): Call create_build_id.
13953         (Layout::create_note): New function, broken out of
13954         Layout::create_gold_note.
13955         (Layout::create_gold_note): Call create_note.
13956         (Layout::create_build_id): New function.
13957         (Layout::write_build_id): New function.
13958         (Close_task_runner::run): Call write_build_id.
13959
13960         * x86_64.cc: Correct license to GPLv3.
13961
13962 2008-03-23  Ian Lance Taylor  <iant@google.com>
13963
13964         * options.cc: Include "demangle.h".
13965         (parse_optional_string): New function.
13966         (parse_long_option): Handle takes_optional_argument.
13967         (parse_short_option): Update dash_z initializer.  Handle
13968         takes_optional_argument.
13969         (General_options::General_options): Initialize do_demangle_.
13970         (General_options::finalize): Set do_demangle_.  Handle demangling
13971         style.
13972         * options.h (parse_optional_string): Declare.
13973         (struct One_option): Add optional_arg field.  Update constructor.
13974         Update call constructor calls.  Add takes_optional_argument
13975         function.
13976         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13977         (DEFINE_optional_string): Define.
13978         (General_options::demangle): Change from DEFINE_bool to
13979         DEFINE_optional_string.
13980         (General_options::no_demangle): New function.
13981         (General_options::do_demangle): New function.
13982         (General_options::set_do_demangle): New function.
13983         (General_options::execstack_status_): Move definition to end of
13984         class definition.
13985         (General_options::static_): Likewise.
13986         (General_options::do_demangle_): New field.
13987         * object.cc (big_endian>::get_symbol_location_info): Call
13988         Options::do_demangle, not Options::demangle.
13989         * symtab.cc (demangle): Likewise.
13990
13991 2008-03-22  Ian Lance Taylor  <iant@google.com>
13992
13993         * gold.h: Include <cstddef> and <sys/types.h>
13994         * options.h: Include <cstring>.
13995
13996 2008-03-21  Ian Lance Taylor  <iant@google.com>
13997
13998         * Added source code to GNU binutils.